diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 05:43:31 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 05:43:31 +0000 |
commit | f2705ac0994dd4eb07ce08c1d70b94a20eae016c (patch) | |
tree | fde36dc250d3590ad1e9f8347339ca811742c485 | |
parent | 398e5d1ce15fb26fc8172ba9963b86d9fd6765d5 (diff) | |
download | chromium_src-f2705ac0994dd4eb07ce08c1d70b94a20eae016c.zip chromium_src-f2705ac0994dd4eb07ce08c1d70b94a20eae016c.tar.gz chromium_src-f2705ac0994dd4eb07ce08c1d70b94a20eae016c.tar.bz2 |
Speculative Revert 120885 - ui/gfx: Make the first version of Canvas::TileImageInt take a gfx::Rect.
BUG=100898
R=pkasting@chromium.org
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9332006
TBR=tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9358015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120943 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/launcher/launcher.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ntp_background_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/panels/panel_browser_frame_view.cc | 37 | ||||
-rw-r--r-- | chrome/browser/ui/views/about_chrome_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_view.cc | 16 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc | 47 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/glass_browser_frame_view.cc | 20 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc | 20 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab.cc | 21 | ||||
-rw-r--r-- | chrome/common/extensions/extension_action.cc | 19 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_win.cc | 3 | ||||
-rw-r--r-- | ui/gfx/canvas.h | 3 | ||||
-rw-r--r-- | ui/gfx/canvas_skia.cc | 5 | ||||
-rw-r--r-- | ui/gfx/canvas_skia.h | 4 | ||||
-rw-r--r-- | ui/views/bubble/bubble_border.cc | 24 | ||||
-rw-r--r-- | ui/views/controls/scrollbar/bitmap_scroll_bar.cc | 12 | ||||
-rw-r--r-- | ui/views/painter.cc | 10 | ||||
-rw-r--r-- | ui/views/window/custom_frame_view.cc | 22 | ||||
-rw-r--r-- | ui/views/window/frame_background.cc | 46 |
19 files changed, 166 insertions, 153 deletions
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc index 705675f..61810e2 100644 --- a/ash/launcher/launcher.cc +++ b/ash/launcher/launcher.cc @@ -32,7 +32,7 @@ class ShelfPainter : public views::Painter { } virtual void Paint(int w, int h, gfx::Canvas* canvas) OVERRIDE { - canvas->TileImage(image_, gfx::Rect(0, 0, w, h)); + canvas->TileImageInt(image_, 0, 0, w, h); } private: diff --git a/chrome/browser/ntp_background_util.cc b/chrome/browser/ntp_background_util.cc index caabc4e..c6682d0 100644 --- a/chrome/browser/ntp_background_util.cc +++ b/chrome/browser/ntp_background_util.cc @@ -50,7 +50,7 @@ void PaintThemeBackground( x_pos += area.x(); y_pos += area.y(); - canvas->TileImage(*ntp_background, gfx::Rect(x_pos, y_pos, width, height)); + canvas->TileImageInt(*ntp_background, x_pos, y_pos, width, height); } } // namespace diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index b356a0d..bc437d4 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -786,7 +786,7 @@ void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { canvas->DrawRect(gfx::Rect(0, 0, width(), kTitlebarHeight), paint); } else { SkBitmap* bitmap = GetFrameTheme(paint_state_); - canvas->TileImage(*bitmap, gfx::Rect(0, 0, width(), kTitlebarHeight)); + canvas->TileImageInt(*bitmap, 0, 0, width(), kTitlebarHeight); } #if defined(USE_AURA) @@ -802,42 +802,41 @@ void PanelBrowserFrameView::PaintFrameBorder(gfx::Canvas* canvas) { // Draw the top border. const EdgeResources& frame_edges = GetFrameEdges(); canvas->DrawBitmapInt(*(frame_edges.top_left), 0, 0); - canvas->TileImage(*(frame_edges.top), gfx::Rect(frame_edges.top_left->width(), - 0, - width() - frame_edges.top_left->width() - frame_edges.top_right->width(), - frame_edges.top->height())); + canvas->TileImageInt( + *(frame_edges.top), frame_edges.top_left->width(), 0, + width() - frame_edges.top_right->width(), frame_edges.top->height()); canvas->DrawBitmapInt( *(frame_edges.top_right), width() - frame_edges.top_right->width(), 0); // Draw the right border. - canvas->TileImage(*(frame_edges.right), - gfx::Rect(width() - frame_edges.right->width(), - frame_edges.top_right->height(), frame_edges.right->width(), - height() - frame_edges.top_right->height() - - frame_edges.bottom_right->height())); + canvas->TileImageInt( + *(frame_edges.right), width() - frame_edges.right->width(), + frame_edges.top_right->height(), frame_edges.right->width(), + height() - frame_edges.top_right->height() - + frame_edges.bottom_right->height()); // Draw the bottom border. canvas->DrawBitmapInt( *(frame_edges.bottom_right), width() - frame_edges.bottom_right->width(), height() - frame_edges.bottom_right->height()); - canvas->TileImage(*(frame_edges.bottom), - gfx::Rect(frame_edges.bottom_left->width(), - height() - frame_edges.bottom->height(), - width() - frame_edges.bottom_left->width() - - frame_edges.bottom_right->width(), - frame_edges.bottom->height())); + canvas->TileImageInt( + *(frame_edges.bottom), frame_edges.bottom_left->width(), + height() - frame_edges.bottom->height(), + width() - frame_edges.bottom_left->width() - + frame_edges.bottom_right->width(), + frame_edges.bottom->height()); canvas->DrawBitmapInt( *(frame_edges.bottom_left), 0, height() - frame_edges.bottom_left->height()); // Draw the left border. - canvas->TileImage(*(frame_edges.left), gfx::Rect(0, - frame_edges.top_left->height(), + canvas->TileImageInt( + *(frame_edges.left), 0, frame_edges.top_left->height(), frame_edges.left->width(), height() - frame_edges.top_left->height() - - frame_edges.bottom_left->height())); + frame_edges.bottom_left->height()); // Draw the divider between the titlebar and the client area. if (height() > kTitlebarHeight) { diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index 907c3b5..be136e7 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -430,11 +430,11 @@ void AboutChromeView::OnPaint(gfx::Canvas* canvas) { // dialog. SkBitmap* background = ResourceBundle::GetSharedInstance().GetBitmapNamed( IDR_ABOUT_BACKGROUND_COLOR); - canvas->TileImage(*background, gfx::Rect(0, 0, dialog_dimensions_.width(), - background->height())); + canvas->TileImageInt(*background, 0, 0, dialog_dimensions_.width(), + background->height()); gfx::Font font = - ui::ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); + ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); const gfx::Rect label_bounds = main_text_label_->bounds(); diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index b1a3fd2..b36d07e 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -234,17 +234,17 @@ void FindBarView::OnPaint(gfx::Canvas* canvas) { gfx::Point back_button_origin = find_previous_button_->bounds().origin(); // Draw the image to the left that creates a curved left edge for the box. - canvas->TileImage(*text_box_background_left_, - gfx::Rect(find_text_x - text_box_background_left_->width(), - back_button_origin.y(), text_box_background_left_->width(), - text_box_background_left_->height())); + canvas->TileImageInt(*text_box_background_left_, + find_text_x - text_box_background_left_->width(), + back_button_origin.y(), text_box_background_left_->width(), + text_box_background_left_->height()); // Draw the top and bottom border for whole text box (encompasses both the // find_text_ edit box and the match_count_text_ label). - canvas->TileImage(*text_box_background_, gfx::Rect(find_text_x, - back_button_origin.y(), - back_button_origin.x() - find_text_x, - text_box_background_->height())); + canvas->TileImageInt(*text_box_background_, find_text_x, + back_button_origin.y(), + back_button_origin.x() - find_text_x, + text_box_background_->height()); } void FindBarView::Layout() { diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc index dcc58cf..4226f7a9a 100644 --- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc @@ -356,52 +356,51 @@ void AppPanelBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { } // Draw the theme frame. - canvas->TileImage(*theme_frame, - gfx::Rect(0, 0, width(), theme_frame->height())); + canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); // Top. canvas->DrawBitmapInt(*top_left_corner, 0, 0); - canvas->TileImage(*top_edge, gfx::Rect(top_left_corner->width(), 0, - width() - top_left_corner->width() - top_right_corner->width(), - top_edge->height())); + canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, + width() - top_right_corner->width(), top_edge->height()); canvas->DrawBitmapInt(*top_right_corner, width() - top_right_corner->width(), 0); // Right. - canvas->TileImage(*right_edge, gfx::Rect(width() - right_edge->width(), + canvas->TileImageInt(*right_edge, width() - right_edge->width(), top_right_corner->height(), right_edge->width(), - height() - top_right_corner->height() - bottom_right_corner->height())); + height() - top_right_corner->height() - bottom_right_corner->height()); // Bottom. canvas->DrawBitmapInt(*bottom_right_corner, width() - bottom_right_corner->width(), height() - bottom_right_corner->height()); - canvas->TileImage(*bottom_edge, gfx::Rect(bottom_left_corner->width(), + canvas->TileImageInt(*bottom_edge, bottom_left_corner->width(), height() - bottom_edge->height(), width() - bottom_left_corner->width() - bottom_right_corner->width(), - bottom_edge->height())); + bottom_edge->height()); canvas->DrawBitmapInt(*bottom_left_corner, 0, height() - bottom_left_corner->height()); // Left. - canvas->TileImage(*left_edge, gfx::Rect(0, top_left_corner->height(), + canvas->TileImageInt(*left_edge, 0, top_left_corner->height(), left_edge->width(), - height() - top_left_corner->height() - bottom_left_corner->height())); + height() - top_left_corner->height() - bottom_left_corner->height()); } void AppPanelBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SkBitmap* frame_image = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); - canvas->TileImage(*frame_image, gfx::Rect(0, FrameBorderThickness(), width(), - frame_image->height())); + canvas->TileImageInt(*frame_image, 0, FrameBorderThickness(), width(), + frame_image->height()); // The bottom of the titlebar actually comes from the top of the Client Edge // graphic, with the actual client edge clipped off the bottom. SkBitmap* titlebar_bottom = rb.GetBitmapNamed(IDR_APP_TOP_CENTER); int edge_height = titlebar_bottom->height() - kClientEdgeThickness; - canvas->TileImage(*titlebar_bottom, gfx::Rect(0, - frame()->client_view()->y() - edge_height, width(), edge_height)); + canvas->TileImageInt(*titlebar_bottom, 0, + frame()->client_view()->y() - edge_height, + width(), edge_height); } void AppPanelBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) { @@ -432,28 +431,28 @@ void AppPanelBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { int top_edge_y = client_area_top - top->height(); canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(), top_edge_y); - canvas->TileImage(*top, gfx::Rect(client_area_bounds.x(), top_edge_y, - client_area_bounds.width(), top->height())); + canvas->TileImageInt(*top, client_area_bounds.x(), top_edge_y, + client_area_bounds.width(), top->height()); canvas->DrawBitmapInt(*top_right, client_area_bounds.right(), top_edge_y); // Right. int client_area_bottom = std::max(client_area_top, client_area_bounds.bottom()); int client_area_height = client_area_bottom - client_area_top; - canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), - client_area_top, right->width(), client_area_height)); + canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, + right->width(), client_area_height); // Bottom. canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right(), client_area_bottom); - canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(), - client_area_bottom, client_area_bounds.width(), bottom_right->height())); + canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, + client_area_bounds.width(), bottom_right->height()); canvas->DrawBitmapInt(*bottom_left, client_area_bounds.x() - bottom_left->width(), client_area_bottom); // Left. - canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(), - client_area_top, left->width(), client_area_height)); + canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), + client_area_top, left->width(), client_area_height); // Draw the toolbar color to fill in the edges. canvas->DrawRect(gfx::Rect( diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index 8084065..65e515f 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -312,8 +312,8 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { canvas->DrawBitmapInt(*toolbar_left, left_x, y); // Draw center edge. - canvas->TileImage(*toolbar_center, gfx::Rect(left_x + toolbar_left->width(), - y, right_x - (left_x + toolbar_left->width()), toolbar_center->height())); + canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, + right_x - (left_x + toolbar_left->width()), toolbar_center->height()); // Right edge. canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), @@ -342,20 +342,22 @@ void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { // Draw the client edge images. SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); - canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), - client_area_top, right->width(), client_area_height)); + canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, + right->width(), client_area_height); canvas->DrawBitmapInt( *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), client_area_bounds.right(), client_area_bottom); SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); - canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(), - client_area_bottom, client_area_bounds.width(), bottom->height())); - SkBitmap* bottom_left = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); + canvas->TileImageInt(*bottom, client_area_bounds.x(), + client_area_bottom, client_area_bounds.width(), + bottom->height()); + SkBitmap* bottom_left = + tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); canvas->DrawBitmapInt(*bottom_left, client_area_bounds.x() - bottom_left->width(), client_area_bottom); SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); - canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(), - client_area_top, left->width(), client_area_height)); + canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), + client_area_top, left->width(), client_area_height); // Draw the toolbar color so that the client edges show the right color even // where not covered by the toolbar image. NOTE: We do this after drawing the diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 7267dbb..83e5fed 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -654,8 +654,8 @@ void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { SkBitmap* top_center = GetThemeProvider()->GetBitmapNamed(IDR_APP_TOP_CENTER); int edge_height = top_center->height() - kClientEdgeThickness; - canvas->TileImage(*top_center, gfx::Rect(0, - frame()->client_view()->y() - edge_height, width(), edge_height)); + canvas->TileImageInt(*top_center, 0, + frame()->client_view()->y() - edge_height, width(), edge_height); } } @@ -832,20 +832,22 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { // Draw the client edge images. // Draw the client edge images. SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); - canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), image_top, - right->width(), image_height)); + canvas->TileImageInt(*right, client_area_bounds.right(), image_top, + right->width(), image_height); canvas->DrawBitmapInt( *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), client_area_bounds.right(), client_area_bottom); SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); - canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(), - client_area_bottom, client_area_bounds.width(), bottom->height())); - SkBitmap* bottom_left = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); + canvas->TileImageInt(*bottom, client_area_bounds.x(), + client_area_bottom, client_area_bounds.width(), + bottom->height()); + SkBitmap* bottom_left = + tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); canvas->DrawBitmapInt(*bottom_left, client_area_bounds.x() - bottom_left->width(), client_area_bottom); SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); - canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(), - image_top, left->width(), image_height)); + canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), + image_top, left->width(), image_height); // Draw the toolbar color so that the client edges show the right color even // where not covered by the toolbar image. NOTE: We do this after drawing the diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index aedee73..34236ec 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -486,11 +486,13 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) { // Now draw the highlights/shadows around the tab edge. canvas->DrawBitmapInt(*tab_inactive_image->image_l, 0, 0); - gfx::Rect tile_rect(GetLocalBounds()); - tile_rect.Inset(tab_inactive_image->l_width, 0, - tab_inactive_image->r_width, 0); - canvas->TileImage(*tab_inactive_image->image_c, tile_rect); - canvas->DrawBitmapInt(*tab_inactive_image->image_r, tile_rect.right(), 0); + canvas->TileImageInt(*tab_inactive_image->image_c, + tab_inactive_image->l_width, 0, + width() - tab_inactive_image->l_width - + tab_inactive_image->r_width, + height()); + canvas->DrawBitmapInt(*tab_inactive_image->image_r, + width() - tab_inactive_image->r_width, 0); } void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { @@ -529,10 +531,9 @@ void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { // Now draw the highlights/shadows around the tab edge. canvas->DrawBitmapInt(*tab_image->image_l, 0, 0); - gfx::Rect tile_rect(GetLocalBounds()); - tile_rect.Inset(tab_image->l_width, 0, tab_image->r_width, 0); - canvas->TileImage(*tab_image->image_c, tile_rect); - canvas->DrawBitmapInt(*tab_image->image_r, tile_rect.right(), 0); + canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, 0, + width() - tab_image->l_width - tab_image->r_width, height()); + canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0); } int Tab::IconCapacity() const { diff --git a/chrome/common/extensions/extension_action.cc b/chrome/common/extensions/extension_action.cc index 9845c31..284da0e 100644 --- a/chrome/common/extensions/extension_action.cc +++ b/chrome/common/extensions/extension_action.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,6 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/rect.h" -#include "ui/gfx/skia_util.h" namespace { @@ -146,9 +145,10 @@ void ExtensionAction::PaintBadge(gfx::Canvas* canvas, rect.fBottom = SkIntToScalar(bounds.bottom() - kBottomMargin); rect.fTop = rect.fBottom - SkIntToScalar(kBadgeHeight); if (badge_width >= kCenterAlignThreshold) { - rect.fLeft = SkScalarFloorToScalar(SkIntToScalar(bounds.x()) + - SkIntToScalar(bounds.width()) / 2 - - SkIntToScalar(badge_width) / 2); + rect.fLeft = SkIntToScalar( + SkScalarFloor(SkIntToScalar(bounds.x()) + + SkIntToScalar(bounds.width()) / 2 - + SkIntToScalar(badge_width) / 2)); rect.fRight = rect.fLeft + SkIntToScalar(badge_width); } else { rect.fRight = SkIntToScalar(bounds.right()); @@ -172,9 +172,12 @@ void ExtensionAction::PaintBadge(gfx::Canvas* canvas, IDR_BROWSER_ACTION_BADGE_CENTER); canvas->GetSkCanvas()->drawBitmap(*gradient_left, rect.fLeft, rect.fTop); - gfx::Rect tile_rect(gfx::SkRectToRect(rect)); - tile_rect.Inset(gradient_left->width(), 0, gradient_right->width(), 0); - canvas->TileImage(*gradient_center, tile_rect); + canvas->TileImageInt(*gradient_center, + SkScalarFloor(rect.fLeft) + gradient_left->width(), + SkScalarFloor(rect.fTop), + SkScalarFloor(rect.width()) - gradient_left->width() - + gradient_right->width(), + SkScalarFloor(rect.height())); canvas->GetSkCanvas()->drawBitmap(*gradient_right, rect.fRight - SkIntToScalar(gradient_right->width()), rect.fTop); diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index 112fa13..d567762 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -1149,8 +1149,7 @@ void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, canvas.Translate(gfx::Point().Subtract(dirty_area.origin())); gfx::Rect dc_rect(dc->m_ps.rcPaint); - dc_rect.set_origin(gfx::Point()); - canvas.TileImage(background_, dc_rect); + canvas.TileImageInt(background_, 0, 0, dc_rect.width(), dc_rect.height()); skia::DrawToNativeContext(canvas.sk_canvas(), *dc, dirty_area.x(), dirty_area.y(), NULL); diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h index 3ae17ab..61d42a4 100644 --- a/ui/gfx/canvas.h +++ b/ui/gfx/canvas.h @@ -197,7 +197,8 @@ class UI_EXPORT Canvas { virtual void DrawFocusRect(const gfx::Rect& rect) = 0; // Tiles the image in the specified region. - virtual void TileImage(const SkBitmap& bitmap, const gfx::Rect& rect) = 0; + virtual void TileImageInt(const SkBitmap& bitmap, + int x, int y, int w, int h) = 0; virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, int dest_x, int dest_y, int w, int h) = 0; diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc index 22b2e17..6d93d8d6 100644 --- a/ui/gfx/canvas_skia.cc +++ b/ui/gfx/canvas_skia.cc @@ -325,8 +325,9 @@ void CanvasSkia::DrawStringInt(const string16& text, display_rect.width(), display_rect.height()); } -void CanvasSkia::TileImage(const SkBitmap& bitmap, const gfx::Rect& rect) { - TileImageInt(bitmap, 0, 0, rect.x(), rect.y(), rect.width(), rect.height()); +void CanvasSkia::TileImageInt(const SkBitmap& bitmap, + int x, int y, int w, int h) { + TileImageInt(bitmap, 0, 0, x, y, w, h); } void CanvasSkia::TileImageInt(const SkBitmap& bitmap, diff --git a/ui/gfx/canvas_skia.h b/ui/gfx/canvas_skia.h index e8980d0..aee7711 100644 --- a/ui/gfx/canvas_skia.h +++ b/ui/gfx/canvas_skia.h @@ -157,8 +157,8 @@ class UI_EXPORT CanvasSkia : public Canvas { const gfx::Rect& display_rect); #endif virtual void DrawFocusRect(const gfx::Rect& rect) OVERRIDE; - virtual void TileImage(const SkBitmap& bitmap, - const gfx::Rect& rect) OVERRIDE; + virtual void TileImageInt(const SkBitmap& bitmap, + int x, int y, int w, int h) OVERRIDE; virtual void TileImageInt(const SkBitmap& bitmap, int src_x, int src_y, int dest_x, int dest_y, int w, int h) OVERRIDE; diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc index c2e4756..51f4ce2 100644 --- a/ui/views/bubble/bubble_border.cc +++ b/ui/views/bubble/bubble_border.cc @@ -319,8 +319,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { after_arrow, images_->left->width() - images_->left_arrow->width()); } else { - canvas->TileImage(*images_->left, gfx::Rect(left, top + tl_height, l_width, - height - tl_height - bl_height)); + canvas->TileImageInt(*images_->left, left, top + tl_height, l_width, + height - tl_height - bl_height); } // Top left corner. @@ -348,8 +348,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { after_arrow, images_->top->height() - images_->top_arrow->height()); } else { - canvas->TileImage(*images_->top, gfx::Rect(left + tl_width, top, - width - tl_width - tr_width, t_height)); + canvas->TileImageInt(*images_->top, left + tl_width, top, + width - tl_width - tr_width, t_height); } // Top right corner. @@ -379,8 +379,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { after_arrow, 0); } else { - canvas->TileImage(*images_->right, gfx::Rect(right - r_width, - top + tr_height, r_width, height - tr_height - br_height)); + canvas->TileImageInt(*images_->right, right - r_width, top + tr_height, + r_width, height - tr_height - br_height); } // Bottom right corner. @@ -412,8 +412,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { after_arrow, 0); } else { - canvas->TileImage(*images_->bottom, gfx::Rect(left + bl_width, - bottom - b_height, width - bl_width - br_width, b_height)); + canvas->TileImageInt(*images_->bottom, left + bl_width, bottom - b_height, + width - bl_width - br_width, b_height); } // Bottom left corner. @@ -441,9 +441,9 @@ void BubbleBorder::DrawEdgeWithArrow(gfx::Canvas* canvas, * before_arrow ─┘ └─ after_arrow */ if (before_arrow) { - canvas->TileImage(*edge, gfx::Rect(start_x, start_y, + canvas->TileImageInt(*edge, start_x, start_y, is_horizontal ? before_arrow : edge->width(), - is_horizontal ? edge->height() : before_arrow)); + is_horizontal ? edge->height() : before_arrow); } canvas->DrawBitmapInt(*arrow, @@ -453,9 +453,9 @@ void BubbleBorder::DrawEdgeWithArrow(gfx::Canvas* canvas, if (after_arrow) { start_x += (is_horizontal ? before_arrow + arrow->width() : 0); start_y += (is_horizontal ? 0 : before_arrow + arrow->height()); - canvas->TileImage(*edge, gfx::Rect(start_x, start_y, + canvas->TileImageInt(*edge, start_x, start_y, is_horizontal ? after_arrow : edge->width(), - is_horizontal ? edge->height() : after_arrow)); + is_horizontal ? edge->height() : after_arrow); } } diff --git a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc index b8de236..f0a8db3 100644 --- a/ui/views/controls/scrollbar/bitmap_scroll_bar.cc +++ b/ui/views/controls/scrollbar/bitmap_scroll_bar.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -124,8 +124,8 @@ class BitmapScrollBarThumb : public BaseScrollBarThumb { int top_cap_height = start_cap_bitmap()->height(); int bottom_cap_height = end_cap_bitmap()->height(); int thumb_body_height = height() - top_cap_height - bottom_cap_height; - canvas->TileImage(*background_bitmap(), gfx::Rect(0, top_cap_height, - background_bitmap()->width(), thumb_body_height)); + canvas->TileImageInt(*background_bitmap(), 0, top_cap_height, + background_bitmap()->width(), thumb_body_height); canvas->DrawBitmapInt(*end_cap_bitmap(), 0, height() - bottom_cap_height); @@ -292,8 +292,10 @@ void BitmapScrollBar::Layout() { void BitmapScrollBar::OnPaint(gfx::Canvas* canvas) { // Paint the track. - canvas->TileImage(*images_[THUMB_TRACK][GetThumbTrackState()], - GetTrackBounds()); + gfx::Rect track_bounds = GetTrackBounds(); + canvas->TileImageInt(*images_[THUMB_TRACK][GetThumbTrackState()], + track_bounds.x(), track_bounds.y(), + track_bounds.width(), track_bounds.height()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/views/painter.cc b/ui/views/painter.cc index 3e6415d..ef5cfbf 100644 --- a/ui/views/painter.cc +++ b/ui/views/painter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,6 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/insets.h" #include "ui/gfx/point.h" -#include "ui/gfx/rect.h" namespace views { @@ -190,8 +189,11 @@ void HorizontalPainter::Paint(int w, int h, gfx::Canvas* canvas) { } canvas->DrawBitmapInt(*images_[LEFT], 0, 0); canvas->DrawBitmapInt(*images_[RIGHT], w - images_[RIGHT]->width(), 0); - canvas->TileImage(*images_[CENTER], gfx::Rect(images_[LEFT]->width(), - 0, w - images_[LEFT]->width() - images_[RIGHT]->width(), height_)); + canvas->TileImageInt(*images_[CENTER], + images_[LEFT]->width(), + 0, + w - images_[LEFT]->width() - images_[RIGHT]->width(), + height_); } } // namespace views diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc index b2d5b10..dc3a4b2 100644 --- a/ui/views/window/custom_frame_view.cc +++ b/ui/views/window/custom_frame_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -371,8 +371,8 @@ void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { SkBitmap* titlebar_bottom = rb.GetBitmapNamed(IDR_APP_TOP_CENTER); int edge_height = titlebar_bottom->height() - (ShouldShowClientEdge() ? kClientEdgeThickness : 0); - canvas->TileImage(*titlebar_bottom, gfx::Rect(0, - frame_->client_view()->y() - edge_height, width(), edge_height)); + canvas->TileImageInt(*titlebar_bottom, 0, + frame_->client_view()->y() - edge_height, width(), edge_height); } void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { @@ -410,28 +410,28 @@ void CustomFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { int top_edge_y = client_area_top - top->height(); canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(), top_edge_y); - canvas->TileImage(*top, gfx::Rect(client_area_bounds.x(), top_edge_y, - client_area_bounds.width(), top->height())); + canvas->TileImageInt(*top, client_area_bounds.x(), top_edge_y, + client_area_bounds.width(), top->height()); canvas->DrawBitmapInt(*top_right, client_area_bounds.right(), top_edge_y); // Right. int client_area_bottom = std::max(client_area_top, client_area_bounds.bottom()); int client_area_height = client_area_bottom - client_area_top; - canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), - client_area_top, right->width(), client_area_height)); + canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, + right->width(), client_area_height); // Bottom. canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right(), client_area_bottom); - canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(), - client_area_bottom, client_area_bounds.width(), bottom_right->height())); + canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, + client_area_bounds.width(), bottom_right->height()); canvas->DrawBitmapInt(*bottom_left, client_area_bounds.x() - bottom_left->width(), client_area_bottom); // Left. - canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(), - client_area_top, left->width(), client_area_height)); + canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), + client_area_top, left->width(), client_area_height); // Draw the toolbar color to fill in the edges. canvas->DrawRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1, diff --git a/ui/views/window/frame_background.cc b/ui/views/window/frame_background.cc index f89c30a..553604f 100644 --- a/ui/views/window/frame_background.cc +++ b/ui/views/window/frame_background.cc @@ -69,8 +69,8 @@ void FrameBackground::PaintRestored(gfx::Canvas* canvas, View* view) const { PaintFrameColor(canvas, view); // Draw the theme frame. - canvas->TileImage(*theme_bitmap_, - gfx::Rect(0, 0, view->width(), theme_bitmap_->height())); + canvas->TileImageInt(*theme_bitmap_, + 0, 0, view->width(), theme_bitmap_->height()); // Draw the theme frame overlay, if available. if (theme_overlay_bitmap_) @@ -85,10 +85,11 @@ void FrameBackground::PaintRestored(gfx::Canvas* canvas, View* view) const { 0, 0, top_left_corner_->width(), top_left_height, 0, 0, top_left_corner_->width(), top_left_height, false); - canvas->TileImage(*top_edge_, gfx::Rect(top_left_corner_->width(), + canvas->TileImageInt(*top_edge_, + top_left_corner_->width(), 0, view->width() - top_left_corner_->width() - top_right_corner_->width(), - top_edge_->height())); + top_edge_->height()); int top_right_height = std::min(top_right_corner_->height(), view->height() - bottom_right_corner_->height()); @@ -102,31 +103,32 @@ void FrameBackground::PaintRestored(gfx::Canvas* canvas, View* view) const { // Right edge. int right_edge_height = view->height() - top_right_height - bottom_right_corner_->height(); - canvas->TileImage(*right_edge_, - gfx::Rect(view->width() - right_edge_->width(), - top_right_height, - right_edge_->width(), - right_edge_height)); + canvas->TileImageInt(*right_edge_, + view->width() - right_edge_->width(), + top_right_height, + right_edge_->width(), + right_edge_height); // Bottom corners and edge. canvas->DrawBitmapInt(*bottom_right_corner_, view->width() - bottom_right_corner_->width(), view->height() - bottom_right_corner_->height()); - canvas->TileImage( + canvas->TileImageInt( *bottom_edge_, - gfx::Rect(bottom_left_corner_->width(), - view->height() - bottom_edge_->height(), - view->width() - bottom_left_corner_->width() - - bottom_right_corner_->width(), - bottom_edge_->height())); + bottom_left_corner_->width(), + view->height() - bottom_edge_->height(), + view->width() - bottom_left_corner_->width() + - bottom_right_corner_->width(), + bottom_edge_->height()); canvas->DrawBitmapInt(*bottom_left_corner_, 0, view->height() - bottom_left_corner_->height()); // Left edge. int left_edge_height = view->height() - top_left_height - bottom_left_corner_->height(); - canvas->TileImage(*left_edge_, gfx::Rect(0, top_left_height, - left_edge_->width(), left_edge_height)); + canvas->TileImageInt(*left_edge_, + 0, top_left_height, + left_edge_->width(), left_edge_height); } void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const { @@ -157,11 +159,11 @@ void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const { } // Draw the theme frame. - canvas->TileImage(*theme_bitmap_, - gfx::Rect(left_offset, - maximized_top_offset_, - view->width() - (left_offset + right_offset), - theme_bitmap_->height())); + canvas->TileImageInt(*theme_bitmap_, + left_offset, + maximized_top_offset_, + view->width() - (left_offset + right_offset), + theme_bitmap_->height()); // Draw the theme frame overlay, if available. if (theme_overlay_bitmap_) canvas->DrawBitmapInt(*theme_overlay_bitmap_, 0, theme_background_y_); |