Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Side by Side Diff: chrome/browser/ntp_background_util.cc

Issue 9332006: ui/gfx: Make the first version of Canvas::TileImageInt take a gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put back the Peter's nits Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher.cc ('k') | chrome/browser/ui/panels/panel_browser_frame_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (tiling != ThemeService::REPEAT && 43 if (tiling != ThemeService::REPEAT &&
44 tiling != ThemeService::REPEAT_Y) { 44 tiling != ThemeService::REPEAT_Y) {
45 height = ntp_background->height(); 45 height = ntp_background->height();
46 } else if (y_pos > 0) { 46 } else if (y_pos > 0) {
47 y_pos = y_pos % ntp_background->height() - ntp_background->height(); 47 y_pos = y_pos % ntp_background->height() - ntp_background->height();
48 } 48 }
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->TileImage(*ntp_background, gfx::Rect(x_pos, y_pos, width, height));
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 // static 58 // static
59 void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, 59 void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp,
60 gfx::Canvas* canvas, 60 gfx::Canvas* canvas,
61 const gfx::Rect& area, 61 const gfx::Rect& area,
62 int tab_contents_height) { 62 int tab_contents_height) {
63 // Draw the background to match the new tab page. 63 // Draw the background to match the new tab page.
64 canvas->FillRect(area, tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND)); 64 canvas->FillRect(area, tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND));
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, &tiling); 68 tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, &tiling);
69 int alignment; 69 int alignment;
70 if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, 70 if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT,
71 &alignment)) { 71 &alignment)) {
72 SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND); 72 SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND);
73 73
74 PaintThemeBackground( 74 PaintThemeBackground(
75 canvas, ntp_background, tiling, alignment, area, tab_contents_height); 75 canvas, ntp_background, tiling, alignment, area, tab_contents_height);
76 } 76 }
77 } 77 }
78 } 78 }
OLDNEW
« no previous file with comments | « ash/launcher/launcher.cc ('k') | chrome/browser/ui/panels/panel_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698