diff options
Diffstat (limited to 'chrome/browser')
25 files changed, 214 insertions, 186 deletions
diff --git a/chrome/browser/chromeos/panels/panel_scroller_header.cc b/chrome/browser/chromeos/panels/panel_scroller_header.cc index 12de46e..93f8a04 100644 --- a/chrome/browser/chromeos/panels/panel_scroller_header.cc +++ b/chrome/browser/chromeos/panels/panel_scroller_header.cc @@ -40,11 +40,11 @@ gfx::Size PanelScrollerHeader::GetPreferredSize() { void PanelScrollerHeader::OnPaint(gfx::Canvas* canvas) { // TODO(brettw) fill this out with real styling. - canvas->FillRectInt(0xFFFFFFFF, 0, 0, size().width(), size().height()); + canvas->FillRect(0xFFFFFFFF, GetLocalBounds()); canvas->DrawLineInt(0xFFE6E6E6, 0, size().height() - 1, size().width(), size().height() - 1); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); gfx::Font font = rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD); int font_top = 1; diff --git a/chrome/browser/chromeos/status/status_area_button.cc b/chrome/browser/chromeos/status/status_area_button.cc index 7987d59f3..e4b4103 100644 --- a/chrome/browser/chromeos/status/status_area_button.cc +++ b/chrome/browser/chromeos/status/status_area_button.cc @@ -65,8 +65,7 @@ StatusAreaButton::StatusAreaButton(StatusAreaHost* host, void StatusAreaButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { if (state() == BS_PUSHED) { // Apply 10% white when pushed down. - canvas->FillRectInt(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), - 0, 0, width(), height()); + canvas->FillRect(SkColorSetARGB(0x19, 0xFF, 0xFF, 0xFF), GetLocalBounds()); } if (use_menu_button_paint_) { diff --git a/chrome/browser/ntp_background_util.cc b/chrome/browser/ntp_background_util.cc index 5dc0d6f..96496f5 100644 --- a/chrome/browser/ntp_background_util.cc +++ b/chrome/browser/ntp_background_util.cc @@ -56,17 +56,16 @@ void PaintThemeBackground( } // namespace // static -void NtpBackgroundUtil::PaintBackgroundDetachedMode( - ui::ThemeProvider* tp, gfx::Canvas* canvas, const gfx::Rect& area, - int tab_contents_height) { +void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, + gfx::Canvas* canvas, + const gfx::Rect& area, + int tab_contents_height) { // Draw the background to match the new tab page. - canvas->FillRectInt(tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND), - area.x(), area.y(), area.width(), area.height()); + canvas->FillRect(tp->GetColor(ThemeService::COLOR_NTP_BACKGROUND), area); if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { int tiling = ThemeService::NO_REPEAT; - tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, - &tiling); + tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, &tiling); int alignment; if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment)) { diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index b509943..b7d0bb6 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -827,11 +827,8 @@ void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) { // paint a "hole" in the canvas so that the render of the web page is on // top of whatever else has already been painted in the views hierarchy. // Later views might still get to paint on top. - if (!get_use_acceleration_when_possible()) { - canvas->FillRectInt(SK_ColorBLACK, 0, 0, - bounds().width(), bounds().height(), - SkXfermode::kClear_Mode); - } + if (!get_use_acceleration_when_possible()) + canvas->FillRect(SK_ColorBLACK, GetLocalBounds(), SkXfermode::kClear_Mode); DCHECK(!about_to_validate_and_paint_); @@ -896,8 +893,7 @@ void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) { whiteout_start_time_ = base::TimeTicks::Now(); if (get_use_acceleration_when_possible()) - canvas->FillRectInt(SK_ColorWHITE, 0, 0, - bounds().width(), bounds().height()); + canvas->FillRect(SK_ColorWHITE, GetLocalBounds()); } } diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc index b96333d..47a0fe9 100644 --- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc +++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc @@ -13,8 +13,8 @@ #include "content/browser/renderer_host/mock_render_process_host.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/tab_contents/render_view_host_manager.h" -#include "content/public/browser/notification_service.h" #include "content/common/view_messages.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "skia/ext/platform_canvas.h" #include "testing/gtest/include/gtest/gtest.h" @@ -220,7 +220,7 @@ TEST_F(ThumbnailGeneratorSimpleTest, CalculateBoringScore_SingleColor) { const gfx::Size kSize(20, 10); gfx::CanvasSkia canvas(kSize.width(), kSize.height(), true); // Fill all pixesl in black. - canvas.FillRectInt(kBlack, 0, 0, kSize.width(), kSize.height()); + canvas.FillRect(kBlack, gfx::Rect(gfx::Point(), kSize)); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); @@ -235,9 +235,9 @@ TEST_F(ThumbnailGeneratorSimpleTest, CalculateBoringScore_TwoColors) { gfx::CanvasSkia canvas(kSize.width(), kSize.height(), true); // Fill all pixesl in black. - canvas.FillRectInt(kBlack, 0, 0, kSize.width(), kSize.height()); + canvas.FillRect(kBlack, gfx::Rect(gfx::Point(), kSize)); // Fill the left half pixels in white. - canvas.FillRectInt(kWhite, 0, 0, kSize.width() / 2, kSize.height()); + canvas.FillRect(kWhite, gfx::Rect(0, 0, kSize.width() / 2, kSize.height())); SkBitmap bitmap = skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(false); diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc index 1e48900..795b618 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service.cc @@ -27,8 +27,8 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/pref_names.h" #include "content/browser/user_metrics.h" -#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_details.h" +#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -1077,9 +1077,9 @@ SkBitmap* GtkThemeService::GenerateFrameImage( canvas.DrawRectInt(0, 0, kToolbarImageWidth, gradient_size, paint); } - canvas.FillRectInt(base, 0, gradient_size, - kToolbarImageWidth, - kToolbarImageHeight - gradient_size); + canvas.FillRect(base, gfx::Rect(0, gradient_size, + kToolbarImageWidth, + kToolbarImageHeight - gradient_size)); return new SkBitmap(canvas.ExtractBitmap()); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index b7f1818..ec950a4 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -654,9 +654,7 @@ void BookmarkBarView::PaintChildren(gfx::Canvas* canvas) { indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); // TODO(sky/glen): make me pretty! - canvas->FillRectInt(kDropIndicatorColor, indicator_bounds.x(), - indicator_bounds.y(), indicator_bounds.width(), - indicator_bounds.height()); + canvas->FillRect(kDropIndicatorColor, indicator_bounds); } } diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 67b47bc..4557c0a 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -845,9 +845,7 @@ void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { // Color of the drop indicator. static const SkColor kDropIndicatorColor = SK_ColorBLACK; - canvas->FillRectInt(kDropIndicatorColor, indicator_bounds.x(), - indicator_bounds.y(), indicator_bounds.width(), - indicator_bounds.height()); + canvas->FillRect(kDropIndicatorColor, indicator_bounds); } } diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index d48427c..b9f5af5 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -450,18 +450,28 @@ void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas* canvas) { // Fill with the frame color first so we have a constant background for // areas not covered by the theme image. - canvas->FillRectInt(frame_color, 0, 0, width(), theme_frame->height()); - // Now fill down the sides. - canvas->FillRectInt(frame_color, 0, theme_frame->height(), left_edge->width(), - height() - theme_frame->height()); - canvas->FillRectInt(frame_color, width() - right_edge->width(), - theme_frame->height(), right_edge->width(), - height() - theme_frame->height()); - // Now fill the bottom area. - canvas->FillRectInt(frame_color, - left_edge->width(), height() - bottom_edge->height(), - width() - left_edge->width() - right_edge->width(), - bottom_edge->height()); + canvas->FillRect(frame_color, + gfx::Rect(0, 0, width(), theme_frame->height())); + + int remaining_height = height() - theme_frame->height(); + if (remaining_height > 0) { + // Now fill down the sides. + canvas->FillRect(frame_color, gfx::Rect(0, theme_frame->height(), + left_edge->width(), + remaining_height)); + canvas->FillRect(frame_color, gfx::Rect(width() - right_edge->width(), + theme_frame->height(), + right_edge->width(), + remaining_height)); + int center_width = width() - left_edge->width() - right_edge->width(); + if (center_width > 0) { + // Now fill the bottom area. + canvas->FillRect(frame_color, + gfx::Rect(left_edge->width(), + height() - bottom_edge->height(), + center_width, bottom_edge->height())); + } + } // Draw the theme frame. canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); @@ -508,13 +518,8 @@ void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) { gfx::Rect frame_shadow_bounds(client_edge_bounds); frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness); - canvas->FillRectInt(kContentsBorderShadow, frame_shadow_bounds.x(), - frame_shadow_bounds.y(), frame_shadow_bounds.width(), - frame_shadow_bounds.height()); - - canvas->FillRectInt(ResourceBundle::toolbar_color, client_edge_bounds.x(), - client_edge_bounds.y(), client_edge_bounds.width(), - client_edge_bounds.height()); + canvas->FillRect(kContentsBorderShadow, frame_shadow_bounds); + canvas->FillRect(ResourceBundle::toolbar_color, client_edge_bounds); } void ConstrainedWindowFrameView::LayoutWindowControls() { diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc index 568df1c..c2187a6 100644 --- a/chrome/browser/ui/views/default_search_view.cc +++ b/chrome/browser/ui/views/default_search_view.cc @@ -9,9 +9,9 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url.h" +#include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/browser/search_engines/template_url_service_factory.h" -#include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/views/constrained_window_views.h" @@ -19,8 +19,8 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" -#include "ui/base/message_box_flags.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/message_box_flags.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "views/controls/button/text_button.h" @@ -28,8 +28,8 @@ #include "views/controls/label.h" #include "views/layout/grid_layout.h" #include "views/layout/layout_constants.h" -#include "views/window/dialog_client_view.h" #include "views/widget/widget.h" +#include "views/window/dialog_client_view.h" namespace { @@ -134,12 +134,13 @@ DefaultSearchView::~DefaultSearchView() { void DefaultSearchView::OnPaint(gfx::Canvas* canvas) { // Fill in behind the background image with the standard gray toolbar color. - canvas->FillRectInt(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), - 0, 0, width(), background_image_->height()); + canvas->FillRect(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), + gfx::Rect(0, 0, width(), background_image_->height())); // The rest of the dialog background should be white. DCHECK(height() > background_image_->height()); - canvas->FillRectInt(SK_ColorWHITE, 0, background_image_->height(), width(), - height() - background_image_->height()); + canvas->FillRect(SK_ColorWHITE, + gfx::Rect(0, background_image_->height(), width(), + height() - background_image_->height())); } void DefaultSearchView::ButtonPressed(views::Button* sender, diff --git a/chrome/browser/ui/views/detachable_toolbar_view.cc b/chrome/browser/ui/views/detachable_toolbar_view.cc index 60c09e0..b7b31cc 100644 --- a/chrome/browser/ui/views/detachable_toolbar_view.cc +++ b/chrome/browser/ui/views/detachable_toolbar_view.cc @@ -28,10 +28,8 @@ void DetachableToolbarView::PaintBackgroundAttachedMode( views::View* view, const gfx::Point& background_origin) { ui::ThemeProvider* tp = view->GetThemeProvider(); - SkColor theme_toolbar_color = - tp->GetColor(ThemeService::COLOR_TOOLBAR); - canvas->FillRectInt(theme_toolbar_color, 0, 0, - view->width(), view->height()); + SkColor theme_toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); + canvas->FillRect(theme_toolbar_color, view->GetLocalBounds()); canvas->TileImageInt(*tp->GetBitmapNamed(IDR_THEME_TOOLBAR), background_origin.x(), background_origin.y(), 0, 0, view->width(), view->height()); @@ -58,14 +56,16 @@ void DetachableToolbarView::PaintHorizontalBorder(gfx::Canvas* canvas, // the view (bar/shelf) is attached or detached. int thickness = views::NonClientFrameView::kClientEdgeThickness; int y = view->IsDetached() ? 0 : (view->height() - thickness); - canvas->FillRectInt(ResourceBundle::toolbar_separator_color, - 0, y, view->width(), thickness); + canvas->FillRect(ResourceBundle::toolbar_separator_color, + gfx::Rect(0, y, view->width(), thickness)); } // static void DetachableToolbarView::PaintContentAreaBackground( - gfx::Canvas* canvas, ui::ThemeProvider* theme_provider, - const SkRect& rect, double roundness) { + gfx::Canvas* canvas, + ui::ThemeProvider* theme_provider, + const SkRect& rect, + double roundness) { SkPaint paint; paint.setAntiAlias(true); paint.setColor(theme_provider->GetColor(ThemeService::COLOR_TOOLBAR)); diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc index 8044192..2592e64 100644 --- a/chrome/browser/ui/views/download/download_shelf_view.cc +++ b/chrome/browser/ui/views/download/download_shelf_view.cc @@ -16,8 +16,8 @@ #include "chrome/browser/ui/views/download/download_item_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "content/browser/download/download_item.h" -#include "content/browser/download/download_stats.h" #include "content/browser/download/download_manager.h" +#include "content/browser/download/download_stats.h" #include "content/browser/tab_contents/navigation_entry.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -171,7 +171,7 @@ void DownloadShelfView::OnPaint(gfx::Canvas* canvas) { } void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) { - canvas->FillRectInt(kBorderColor, 0, 0, width(), 1); + canvas->FillRect(kBorderColor, gfx::Rect(0, 0, width(), 1)); } void DownloadShelfView::OpenedDownload(DownloadItemView* view) { diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc index 84af86f..a85e451 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.cc +++ b/chrome/browser/ui/views/first_run_search_engine_view.cc @@ -183,12 +183,13 @@ void FirstRunSearchEngineView::ButtonPressed(views::Button* sender, void FirstRunSearchEngineView::OnPaint(gfx::Canvas* canvas) { // Fill in behind the background image with the standard gray toolbar color. - canvas->FillRectInt(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), - 0, 0, width(), background_image_->height()); + canvas->FillRect(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), + gfx::Rect(0, 0, width(), background_image_->height())); // The rest of the dialog background should be white. DCHECK(height() > background_image_->height()); - canvas->FillRectInt(SK_ColorWHITE, 0, background_image_->height(), width(), - height() - background_image_->height()); + canvas->FillRect(SK_ColorWHITE, + gfx::Rect(0, background_image_->height(), width(), + height() - background_image_->height())); } void FirstRunSearchEngineView::OnTemplateURLServiceChanged() { 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 d46e92d..668a157 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 @@ -340,18 +340,28 @@ void AppPanelBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { // Fill with the frame color first so we have a constant background for // areas not covered by the theme image. - canvas->FillRectInt(frame_color, 0, 0, width(), theme_frame->height()); - // Now fill down the sides. - canvas->FillRectInt(frame_color, 0, theme_frame->height(), left_edge->width(), - height() - theme_frame->height()); - canvas->FillRectInt(frame_color, width() - right_edge->width(), - theme_frame->height(), right_edge->width(), - height() - theme_frame->height()); - // Now fill the bottom area. - canvas->FillRectInt(frame_color, left_edge->width(), - height() - bottom_edge->height(), - width() - left_edge->width() - right_edge->width(), - bottom_edge->height()); + canvas->FillRect(frame_color, + gfx::Rect(0, 0, width(), theme_frame->height())); + + int remaining_height = height() - theme_frame->height(); + if (remaining_height > 0) { + // Now fill down the sides. + canvas->FillRect(frame_color, + gfx::Rect(0, theme_frame->height(), left_edge->width(), + remaining_height)); + canvas->FillRect(frame_color, + gfx::Rect(width() - right_edge->width(), + theme_frame->height(), right_edge->width(), + remaining_height)); + int center_width = width() - left_edge->width() - right_edge->width(); + if (center_width > 0) { + // Now fill the bottom area. + canvas->FillRect(frame_color, + gfx::Rect(left_edge->width(), + height() - bottom_edge->height(), + center_width, bottom_edge->height())); + } + } // Draw the theme frame. canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); diff --git a/chrome/browser/ui/views/frame/browser_frame_aura.cc b/chrome/browser/ui/views/frame/browser_frame_aura.cc index b4e0176..e49bcf1 100644 --- a/chrome/browser/ui/views/frame/browser_frame_aura.cc +++ b/chrome/browser/ui/views/frame/browser_frame_aura.cc @@ -74,9 +74,9 @@ void ToolbarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { h)); canvas->GetSkCanvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); - SkColor theme_toolbar_color = - tp->GetColor(ThemeService::COLOR_TOOLBAR); - canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); + SkColor theme_toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); + canvas->FillRect(theme_toolbar_color, + gfx::Rect(x, bottom_y, w, bottom_edge_height)); // Tile the toolbar image starting at the frame edge on the left and where the // horizontal tabstrip is (or would be) on the top. @@ -141,12 +141,13 @@ void ToolbarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { bottom_edge_height, false); // Draw the content/toolbar separator. - canvas->FillRectInt( + canvas->FillRect( ResourceBundle::toolbar_separator_color, - x + views::NonClientFrameView::kClientEdgeThickness, - toolbar_bounds.bottom() - views::NonClientFrameView::kClientEdgeThickness, - w - (2 * views::NonClientFrameView::kClientEdgeThickness), - views::NonClientFrameView::kClientEdgeThickness); + gfx::Rect( + x + views::NonClientFrameView::kClientEdgeThickness, + toolbar_bounds.bottom() - views::NonClientFrameView::kClientEdgeThickness, + w - (2 * views::NonClientFrameView::kClientEdgeThickness), + views::NonClientFrameView::kClientEdgeThickness)); } } // namespace diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc index a543f7e..b77b80c 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc @@ -77,7 +77,7 @@ class WindowControlButton : public views::CustomButton { // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { - canvas->FillRectInt(GetBackgroundColor(), 0, 0, width(), height()); + canvas->FillRect(GetBackgroundColor(), GetLocalBounds()); canvas->DrawBitmapInt(icon_, 0, 0); } virtual gfx::Size GetPreferredSize() OVERRIDE { 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 8187a6c..c92c7df 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -330,9 +330,11 @@ void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { right_x, y); // Draw the content/toolbar separator. - canvas->FillRectInt(ResourceBundle::toolbar_separator_color, - x + kClientEdgeThickness, toolbar_bounds.bottom() - kClientEdgeThickness, - w - (2 * kClientEdgeThickness), kClientEdgeThickness); + canvas->FillRect(ResourceBundle::toolbar_separator_color, + gfx::Rect(x + kClientEdgeThickness, + toolbar_bounds.bottom() - kClientEdgeThickness, + w - (2 * kClientEdgeThickness), + kClientEdgeThickness)); } void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { @@ -372,15 +374,16 @@ void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { // images because the images are meant to alpha-blend atop the frame whereas // these rects are meant to be fully opaque, without anything overlaid. SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); - canvas->FillRectInt(toolbar_color, - client_area_bounds.x() - kClientEdgeThickness, client_area_top, - kClientEdgeThickness, - client_area_bottom + kClientEdgeThickness - client_area_top); - canvas->FillRectInt(toolbar_color, client_area_bounds.x(), client_area_bottom, - client_area_bounds.width(), kClientEdgeThickness); - canvas->FillRectInt(toolbar_color, client_area_bounds.right(), - client_area_top, kClientEdgeThickness, - client_area_bottom + kClientEdgeThickness - client_area_top); + canvas->FillRect(toolbar_color, + gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, client_area_top, + kClientEdgeThickness, + client_area_bottom + kClientEdgeThickness - client_area_top)); + canvas->FillRect(toolbar_color, + gfx::Rect(client_area_bounds.x(), client_area_bottom, + client_area_bounds.width(), kClientEdgeThickness)); + canvas->FillRect(toolbar_color, gfx::Rect(client_area_bounds.right(), + client_area_top, kClientEdgeThickness, + client_area_bottom + kClientEdgeThickness - client_area_top)); } void GlassBrowserFrameView::LayoutAvatar() { 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 a306850..95ab6cd 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -610,19 +610,27 @@ void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { GetBoundsForTabStrip(browser_view_->tabstrip()).bottom()); } SkColor frame_color = GetFrameColor(); - canvas->FillRectInt(frame_color, 0, 0, width(), top_area_height); - - // Now fill down the sides. - canvas->FillRectInt(frame_color, 0, top_area_height, left_edge->width(), - height() - top_area_height); - canvas->FillRectInt(frame_color, width() - right_edge->width(), - top_area_height, right_edge->width(), - height() - top_area_height); - // Now fill the bottom area. - canvas->FillRectInt(frame_color, left_edge->width(), - height() - bottom_edge->height(), - width() - left_edge->width() - right_edge->width(), - bottom_edge->height()); + canvas->FillRect(frame_color, gfx::Rect(0, 0, width(), top_area_height)); + + int remaining_height = height() - top_area_height; + if (remaining_height > 0) { + // Now fill down the sides. + canvas->FillRect(frame_color, + gfx::Rect(0, top_area_height, left_edge->width(), + remaining_height)); + canvas->FillRect(frame_color, + gfx::Rect(width() - right_edge->width(), + top_area_height, right_edge->width(), + remaining_height)); + int center_width = width() - left_edge->width() - right_edge->width(); + if (center_width > 0) { + // Now fill the bottom area. + canvas->FillRect(frame_color, + gfx::Rect(left_edge->width(), + height() - bottom_edge->height(), + center_width, bottom_edge->height())); + } + } // Draw the theme frame. canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); @@ -691,7 +699,7 @@ void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); if (top_area_height > theme_frame_bottom) { SkColor frame_color = GetFrameColor(); - canvas->FillRectInt(frame_color, 0, 0, width(), top_area_height); + canvas->FillRect(frame_color, gfx::Rect(0, 0, width(), top_area_height)); } // Draw the theme frame. It must be aligned with the tabstrip as if we were @@ -787,9 +795,9 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { h)); canvas->GetSkCanvas()->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); - SkColor theme_toolbar_color = - tp->GetColor(ThemeService::COLOR_TOOLBAR); - canvas->FillRectInt(theme_toolbar_color, x, bottom_y, w, bottom_edge_height); + SkColor theme_toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); + canvas->FillRect(theme_toolbar_color, + gfx::Rect(x, bottom_y, w, bottom_edge_height)); // Tile the toolbar image starting at the frame edge on the left and where the // horizontal tabstrip is (or would be) on the top. @@ -854,9 +862,11 @@ void OpaqueBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { bottom_edge_height, false); // Draw the content/toolbar separator. - canvas->FillRectInt(ResourceBundle::toolbar_separator_color, - x + kClientEdgeThickness, toolbar_bounds.bottom() - kClientEdgeThickness, - w - (2 * kClientEdgeThickness), kClientEdgeThickness); + canvas->FillRect(ResourceBundle::toolbar_separator_color, + gfx::Rect(x + kClientEdgeThickness, + toolbar_bounds.bottom() - kClientEdgeThickness, + w - (2 * kClientEdgeThickness), + kClientEdgeThickness)); } void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { @@ -895,11 +905,12 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { top_right->width(), height, false); // Draw the toolbar color across the top edge. - canvas->FillRectInt(toolbar_color, - client_area_bounds.x() - kClientEdgeThickness, - client_area_top - kClientEdgeThickness, - client_area_bounds.width() + (2 * kClientEdgeThickness), - kClientEdgeThickness); + canvas->FillRect( + toolbar_color, + gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, + client_area_top - kClientEdgeThickness, + client_area_bounds.width() + (2 * kClientEdgeThickness), + kClientEdgeThickness)); } int client_area_bottom = @@ -930,15 +941,21 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { // where not covered by the toolbar image. NOTE: We do this after drawing the // images because the images are meant to alpha-blend atop the frame whereas // these rects are meant to be fully opaque, without anything overlaid. - canvas->FillRectInt(toolbar_color, - client_area_bounds.x() - kClientEdgeThickness, client_area_top, - kClientEdgeThickness, - client_area_bottom + kClientEdgeThickness - client_area_top); - canvas->FillRectInt(toolbar_color, client_area_bounds.x(), client_area_bottom, - client_area_bounds.width(), kClientEdgeThickness); - canvas->FillRectInt(toolbar_color, client_area_bounds.right(), - client_area_top, kClientEdgeThickness, - client_area_bottom + kClientEdgeThickness - client_area_top); + canvas->FillRect( + toolbar_color, + gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, + client_area_top, + kClientEdgeThickness, + client_area_bottom + kClientEdgeThickness - client_area_top)); + canvas->FillRect(toolbar_color, + gfx::Rect(client_area_bounds.x(), client_area_bottom, + client_area_bounds.width(), kClientEdgeThickness)); + canvas->FillRect( + toolbar_color, + gfx::Rect(client_area_bounds.right(), + client_area_top, + kClientEdgeThickness, + client_area_bottom + kClientEdgeThickness - client_area_top)); } SkBitmap* OpaqueBrowserFrameView::GetFrameBitmap() const { diff --git a/chrome/browser/ui/views/infobars/infobar_background.cc b/chrome/browser/ui/views/infobars/infobar_background.cc index 151c519..d345fa5 100644 --- a/chrome/browser/ui/views/infobars/infobar_background.cc +++ b/chrome/browser/ui/views/infobars/infobar_background.cc @@ -6,10 +6,10 @@ #include "chrome/browser/infobars/infobar.h" #include "chrome/browser/ui/views/infobars/infobar_view.h" +#include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/gfx/canvas.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/color_utils.h" -#include "third_party/skia/include/effects/SkGradientShader.h" #include "views/view.h" InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) @@ -57,7 +57,7 @@ void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const { paint.setAntiAlias(false); // Now draw the separator at the bottom. - canvas->FillRectInt(separator_color_, 0, - view->height() - InfoBar::kSeparatorLineHeight, - view->width(), InfoBar::kSeparatorLineHeight); + canvas->FillRect(separator_color_, + gfx::Rect(0, view->height() - InfoBar::kSeparatorLineHeight, + view->width(), InfoBar::kSeparatorLineHeight)); } diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index e0c2d6b..30814ed 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -751,8 +751,7 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { canvas->GetSkCanvas()->drawRoundRect(gfx::RectToSkRect(bounds), radius, radius, paint); } else { - canvas->FillRectInt(color, bounds.x(), bounds.y(), bounds.width(), - bounds.height()); + canvas->FillRect(color, bounds); } if (show_focus_rect_ && HasFocus()) { diff --git a/chrome/browser/ui/views/location_bar/suggested_text_view.cc b/chrome/browser/ui/views/location_bar/suggested_text_view.cc index a122a99..1d69473 100644 --- a/chrome/browser/ui/views/location_bar/suggested_text_view.cc +++ b/chrome/browser/ui/views/location_bar/suggested_text_view.cc @@ -47,7 +47,7 @@ void SuggestedTextView::OnPaintBackground(gfx::Canvas* canvas) { return; // TODO(sky): these numbers need to come from the edit. - canvas->FillRectInt(bg_color_, 0, 2, width(), height() - 5); + canvas->FillRect(bg_color_, gfx::Rect(0, 2, width(), height() - 5)); } void SuggestedTextView::AnimationEnded(const ui::Animation* animation) { diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 15487e1..64ddc93 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -491,8 +491,8 @@ void BalloonViewImpl::OnPaint(gfx::Canvas* canvas) { // Draw a 1-pixel gray line between the content and the menu bar. int line_width = GetTotalWidth() - kLeftMargin - kRightMargin; - canvas->FillRectInt(kControlBarSeparatorLineColor, - kLeftMargin, 1 + GetShelfHeight(), line_width, 1); + canvas->FillRect(kControlBarSeparatorLineColor, + gfx::Rect(kLeftMargin, 1 + GetShelfHeight(), line_width, 1)); View::OnPaint(canvas); OnPaintBorder(canvas); diff --git a/chrome/browser/ui/views/tabs/dragged_tab_view.cc b/chrome/browser/ui/views/tabs/dragged_tab_view.cc index ce196a5..70a1a6a 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_view.cc @@ -141,17 +141,15 @@ void DraggedTabView::PaintDetachedView(gfx::Canvas* canvas) { bitmap_device.eraseARGB(0, 0, 0, 0); int tab_height = renderer_bounds_.back().height(); - scale_canvas.FillRectInt(kDraggedTabBorderColor, 0, - tab_height - kDragFrameBorderSize, - ps.width(), ps.height() - tab_height); - int image_x = kDragFrameBorderSize; - int image_y = tab_height; - int image_w = ps.width() - kTwiceDragFrameBorderSize; - int image_h = contents_size_.height(); - scale_canvas.FillRectInt(SK_ColorBLACK, image_x, image_y, image_w, image_h); - photobooth_->PaintScreenshotIntoCanvas( - &scale_canvas, - gfx::Rect(image_x, image_y, image_w, image_h)); + scale_canvas.FillRect(kDraggedTabBorderColor, + gfx::Rect(0, tab_height - kDragFrameBorderSize, + ps.width(), ps.height() - tab_height)); + gfx::Rect image_rect(kDragFrameBorderSize, + tab_height, + ps.width() - kTwiceDragFrameBorderSize, + contents_size_.height()); + scale_canvas.FillRect(SK_ColorBLACK, image_rect); + photobooth_->PaintScreenshotIntoCanvas(&scale_canvas, image_rect); for (size_t i = 0; i < renderers_.size(); ++i) renderers_[i]->Paint(&scale_canvas); diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 74875d1..c792bb1f 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -594,7 +594,7 @@ void ToolbarView::OnPaint(gfx::Canvas* canvas) { // toolbar background below the location bar for us. // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()! if (GetWidget()->ShouldUseNativeFrame()) - canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1); + canvas->FillRect(SK_ColorBLACK, gfx::Rect(0, height() - 1, width(), 1)); } // Note this method is ignored on Windows, but needs to be implemented for diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index ec77ab0..e3fbcfa 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -143,46 +143,49 @@ class MenuButtonBackground : public views::Background { int h = view->height(); switch (TypeAdjustedForRTL()) { case LEFT_BUTTON: - canvas->FillRectInt(background_color(state), 1, 1, w, h - 2); - canvas->FillRectInt(border_color(state), 2, 0, w, 1); - canvas->FillRectInt(border_color(state), 1, 1, 1, 1); - canvas->FillRectInt(border_color(state), 0, 2, 1, h - 4); - canvas->FillRectInt(border_color(state), 1, h - 2, 1, 1); - canvas->FillRectInt(border_color(state), 2, h - 1, w, 1); + canvas->FillRect(background_color(state), gfx::Rect(1, 1, w, h - 2)); + canvas->FillRect(border_color(state), gfx::Rect(2, 0, w, 1)); + canvas->FillRect(border_color(state), gfx::Rect(1, 1, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(0, 2, 1, h - 4)); + canvas->FillRect(border_color(state), gfx::Rect(1, h - 2, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(2, h - 1, w, 1)); break; case CENTER_BUTTON: { - canvas->FillRectInt(background_color(state), 1, 1, w - 2, h - 2); + canvas->FillRect(background_color(state), + gfx::Rect(1, 1, w - 2, h - 2)); SkColor left_color = state != CustomButton::BS_NORMAL ? border_color(state) : border_color(left_button_->state()); - canvas->FillRectInt(left_color, 0, 0, 1, h); - canvas->FillRectInt(border_color(state), 1, 0, w - 2, 1); - canvas->FillRectInt(border_color(state), 1, h - 1, w - 2, 1); + canvas->FillRect(left_color, gfx::Rect(0, 0, 1, h)); + canvas->FillRect(border_color(state), gfx::Rect(1, 0, w - 2, 1)); + canvas->FillRect(border_color(state), gfx::Rect(1, h - 1, w - 2, 1)); SkColor right_color = state != CustomButton::BS_NORMAL ? border_color(state) : border_color(right_button_->state()); - canvas->FillRectInt(right_color, w - 1, 0, 1, h); + canvas->FillRect(right_color, gfx::Rect(w - 1, 0, 1, h)); break; } case RIGHT_BUTTON: - canvas->FillRectInt(background_color(state), 0, 1, w - 1, h - 2); - canvas->FillRectInt(border_color(state), 0, 0, w - 2, 1); - canvas->FillRectInt(border_color(state), w - 2, 1, 1, 1); - canvas->FillRectInt(border_color(state), w - 1, 2, 1, h - 4); - canvas->FillRectInt(border_color(state), w - 2, h - 2, 1, 1); - canvas->FillRectInt(border_color(state), 0, h - 1, w - 2, 1); + canvas->FillRect(background_color(state), + gfx::Rect(0, 1, w - 1, h - 2)); + canvas->FillRect(border_color(state), gfx::Rect(0, 0, w - 2, 1)); + canvas->FillRect(border_color(state), gfx::Rect(w - 2, 1, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(w - 1, 2, 1, h - 4)); + canvas->FillRect(border_color(state), gfx::Rect(w - 2, h - 2, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(0, h - 1, w - 2, 1)); break; case SINGLE_BUTTON: - canvas->FillRectInt(background_color(state), 1, 1, w - 2, h - 2); - canvas->FillRectInt(border_color(state), 2, 0, w - 4, 1); - canvas->FillRectInt(border_color(state), 1, 1, 1, 1); - canvas->FillRectInt(border_color(state), 0, 2, 1, h - 4); - canvas->FillRectInt(border_color(state), 1, h - 2, 1, 1); - canvas->FillRectInt(border_color(state), 2, h - 1, w - 4, 1); - canvas->FillRectInt(border_color(state), w - 2, 1, 1, 1); - canvas->FillRectInt(border_color(state), w - 1, 2, 1, h - 4); - canvas->FillRectInt(border_color(state), w - 2, h - 2, 1, 1); + canvas->FillRect(background_color(state), + gfx::Rect(1, 1, w - 2, h - 2)); + canvas->FillRect(border_color(state), gfx::Rect(2, 0, w - 4, 1)); + canvas->FillRect(border_color(state), gfx::Rect(1, 1, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(0, 2, 1, h - 4)); + canvas->FillRect(border_color(state), gfx::Rect(1, h - 2, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(2, h - 1, w - 4, 1)); + canvas->FillRect(border_color(state), gfx::Rect(w - 2, 1, 1, 1)); + canvas->FillRect(border_color(state), gfx::Rect(w - 1, 2, 1, h - 4)); + canvas->FillRect(border_color(state), gfx::Rect(w - 2, h - 2, 1, 1)); break; default: |