OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ntp_background_util.h" | 5 #include "chrome/browser/ntp_background_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/themes/theme_service.h" | 8 #include "chrome/browser/themes/theme_service.h" |
9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 x_pos += area.x(); | 50 x_pos += area.x(); |
51 y_pos += area.y(); | 51 y_pos += area.y(); |
52 | 52 |
53 canvas->TileImageInt(*ntp_background, x_pos, y_pos, width, height); | 53 canvas->TileImageInt(*ntp_background, x_pos, y_pos, width, height); |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 // static | 58 // static |
59 void NtpBackgroundUtil::PaintBackgroundDetachedMode( | 59 void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, |
60 ui::ThemeProvider* tp, gfx::Canvas* canvas, const gfx::Rect& area, | 60 gfx::Canvas* canvas, |
61 int tab_contents_height) { | 61 const gfx::Rect& area, |
| 62 int tab_contents_height) { |
62 // Draw the background to match the new tab page. | 63 // Draw the background to match the new tab page. |
63 canvas->FillRectInt(tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND), | 64 canvas->FillRect(tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND), area); |
64 area.x(), area.y(), area.width(), area.height()); | |
65 | 65 |
66 if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { | 66 if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { |
67 int tiling = ThemeService::NO_REPEAT; | 67 int tiling = ThemeService::NO_REPEAT; |
68 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, | 68 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, &tiling); |
69 &tiling); | |
70 int alignment; | 69 int alignment; |
71 if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, | 70 if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, |
72 &alignment)) { | 71 &alignment)) { |
73 SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND); | 72 SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND); |
74 | 73 |
75 PaintThemeBackground( | 74 PaintThemeBackground( |
76 canvas, ntp_background, tiling, alignment, area, tab_contents_height); | 75 canvas, ntp_background, tiling, alignment, area, tab_contents_height); |
77 } | 76 } |
78 } | 77 } |
79 } | 78 } |
OLD | NEW |