summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-31 00:11:05 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-31 00:11:05 +0000
commite728d1dbb22389af68d1adad7b18b985cde3bba1 (patch)
treeb760162eea5504ac6fe637e2cc6d9a0f62b07432 /views
parent6b1ac06375f8f41be58938a5e94bcf5af0086ee2 (diff)
downloadchromium_src-e728d1dbb22389af68d1adad7b18b985cde3bba1.zip
chromium_src-e728d1dbb22389af68d1adad7b18b985cde3bba1.tar.gz
chromium_src-e728d1dbb22389af68d1adad7b18b985cde3bba1.tar.bz2
ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect.
BUG=100898 R=pkasting@chromium.org Review URL: http://codereview.chromium.org/8405002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107907 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/aura_desktop/aura_desktop_main.cc4
-rw-r--r--views/border.cc14
-rw-r--r--views/controls/menu/menu_scroll_view_container.cc2
-rw-r--r--views/controls/menu/submenu_view.cc3
-rw-r--r--views/controls/native/native_view_host.cc2
-rw-r--r--views/controls/separator.cc2
-rw-r--r--views/desktop/desktop_background.cc2
-rw-r--r--views/desktop/desktop_window_view.cc2
-rw-r--r--views/examples/native_theme_button_example.cc4
-rw-r--r--views/examples/native_widget_views_example.cc4
-rw-r--r--views/touchui/touch_selection_controller_impl.cc22
-rw-r--r--views/window/custom_frame_view.cc34
-rw-r--r--views/window/dialog_client_view.cc9
13 files changed, 56 insertions, 48 deletions
diff --git a/views/aura_desktop/aura_desktop_main.cc b/views/aura_desktop/aura_desktop_main.cc
index d2a37b7..cb59e0b 100644
--- a/views/aura_desktop/aura_desktop_main.cc
+++ b/views/aura_desktop/aura_desktop_main.cc
@@ -82,7 +82,7 @@ class TestView : public views::View {
private:
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) {
- canvas->FillRectInt(color_, 0, 0, width(), height());
+ canvas->FillRect(color_, GetLocalBounds());
}
virtual bool OnMousePressed(const views::MouseEvent& event) {
color_shifting_ = true;
@@ -114,7 +114,7 @@ class TestWindowContents : public views::WidgetDelegateView {
private:
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->FillRectInt(SK_ColorGRAY, 0, 0, width(), height());
+ canvas->FillRect(SK_ColorGRAY, GetLocalBounds());
}
// Overridden from views::WidgetDelegateView:
diff --git a/views/border.cc b/views/border.cc
index a05d51c..3f90159 100644
--- a/views/border.cc
+++ b/views/border.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 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.
@@ -35,15 +35,15 @@ SolidBorder::SolidBorder(int thickness, SkColor color)
void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const {
// Top border.
- canvas->FillRectInt(color_, 0, 0, view.width(), insets_.top());
+ canvas->FillRect(color_, gfx::Rect(0, 0, view.width(), insets_.top()));
// Left border.
- canvas->FillRectInt(color_, 0, 0, insets_.left(), view.height());
+ canvas->FillRect(color_, gfx::Rect(0, 0, insets_.left(), view.height()));
// Bottom border.
- canvas->FillRectInt(color_, 0, view.height() - insets_.bottom(),
- view.width(), insets_.bottom());
+ canvas->FillRect(color_, gfx::Rect(0, view.height() - insets_.bottom(),
+ view.width(), insets_.bottom()));
// Right border.
- canvas->FillRectInt(color_, view.width() - insets_.right(), 0,
- insets_.right(), view.height());
+ canvas->FillRect(color_, gfx::Rect(view.width() - insets_.right(), 0,
+ insets_.right(), view.height()));
}
void SolidBorder::GetInsets(gfx::Insets* insets) const {
diff --git a/views/controls/menu/menu_scroll_view_container.cc b/views/controls/menu/menu_scroll_view_container.cc
index 6080167..49b4be5 100644
--- a/views/controls/menu/menu_scroll_view_container.cc
+++ b/views/controls/menu/menu_scroll_view_container.cc
@@ -99,7 +99,7 @@ class MenuScrollButton : public View {
y += config.scroll_arrow_height;
}
for (int i = 0; i < config.scroll_arrow_height; ++i, --x, y += delta_y)
- canvas->FillRectInt(arrow_color, x, y, (i * 2) + 1, 1);
+ canvas->FillRect(arrow_color, gfx::Rect(x, y, (i * 2) + 1, 1));
}
private:
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index a68568d..50cb440 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -357,8 +357,7 @@ void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas,
return;
gfx::Rect bounds = CalculateDropIndicatorBounds(item, position);
- canvas->FillRectInt(kDropIndicatorColor, bounds.x(), bounds.y(),
- bounds.width(), bounds.height());
+ canvas->FillRect(kDropIndicatorColor, bounds);
}
void SubmenuView::SchedulePaintForDropIndicator(
diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc
index 728f70c..626b45d 100644
--- a/views/controls/native/native_view_host.cc
+++ b/views/controls/native/native_view_host.cc
@@ -141,7 +141,7 @@ void NativeViewHost::OnPaint(gfx::Canvas* canvas) {
// It would be nice if this used some approximation of the page's
// current background color.
if (native_wrapper_->HasInstalledClip())
- canvas->FillRectInt(SK_ColorWHITE, 0, 0, width(), height());
+ canvas->FillRect(SK_ColorWHITE, GetLocalBounds());
}
void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) {
diff --git a/views/controls/separator.cc b/views/controls/separator.cc
index 8dd0312..7d3d99d 100644
--- a/views/controls/separator.cc
+++ b/views/controls/separator.cc
@@ -37,7 +37,7 @@ void Separator::GetAccessibleState(ui::AccessibleViewState* state) {
}
void Separator::Paint(gfx::Canvas* canvas) {
- canvas->FillRectInt(kDefaultColor, x(), y(), width(), height());
+ canvas->FillRect(kDefaultColor, bounds());
}
std::string Separator::GetClassName() const {
diff --git a/views/desktop/desktop_background.cc b/views/desktop/desktop_background.cc
index 89399e1..e09abe5 100644
--- a/views/desktop/desktop_background.cc
+++ b/views/desktop/desktop_background.cc
@@ -19,7 +19,7 @@ DesktopBackground::~DesktopBackground() {
void DesktopBackground::Paint(gfx::Canvas* canvas, View* view) const {
// Paint the sky.
- canvas->FillRectInt(SK_ColorCYAN, 0, 0, view->width(), view->width());
+ canvas->FillRect(SK_ColorCYAN, view->GetLocalBounds());
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/views/desktop/desktop_window_view.cc b/views/desktop/desktop_window_view.cc
index 65d4801..94fda7d 100644
--- a/views/desktop/desktop_window_view.cc
+++ b/views/desktop/desktop_window_view.cc
@@ -73,7 +73,7 @@ class TestWindowContentView : public WidgetDelegateView {
private:
// Overridden from View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
- canvas->FillRectInt(color_, 0, 0, width(), height());
+ canvas->FillRect(color_, GetLocalBounds());
}
// Overridden from WindowDelegate:
diff --git a/views/examples/native_theme_button_example.cc b/views/examples/native_theme_button_example.cc
index f9b8a48..33b5b7d 100644
--- a/views/examples/native_theme_button_example.cc
+++ b/views/examples/native_theme_button_example.cc
@@ -12,8 +12,8 @@
#include "ui/base/animation/throb_animation.h"
#include "ui/base/models/combobox_model.h"
#include "ui/gfx/canvas.h"
-#include "views/examples/example_combobox_model.h"
#include "views/controls/label.h"
+#include "views/examples/example_combobox_model.h"
#include "views/layout/grid_layout.h"
#include "views/native_theme_painter.h"
@@ -191,7 +191,7 @@ gfx::Size ExampleNativeThemeButton::GetPreferredSize() {
void ExampleNativeThemeButton::OnPaintBackground(gfx::Canvas* canvas) {
// Fill the background with a known colour so that we know where the bounds
// of the View are.
- canvas->FillRectInt(SkColorSetRGB(255, 128, 128), 0, 0, width(), height());
+ canvas->FillRect(SkColorSetRGB(255, 128, 128), GetLocalBounds());
CustomButton::OnPaintBackground(canvas);
}
diff --git a/views/examples/native_widget_views_example.cc b/views/examples/native_widget_views_example.cc
index 9569645..11a2f2f 100644
--- a/views/examples/native_widget_views_example.cc
+++ b/views/examples/native_widget_views_example.cc
@@ -10,8 +10,8 @@
#include "views/examples/example_base.h"
#include "views/test/test_views_delegate.h"
#include "views/view.h"
-#include "views/widget/widget.h"
#include "views/widget/native_widget_views.h"
+#include "views/widget/widget.h"
namespace examples {
@@ -33,7 +33,7 @@ class TestContentView : public views::View,
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
SkColor color = click_count_ % 2 == 0 ? SK_ColorGREEN : SK_ColorBLUE;
- canvas->FillRectInt(color, 0, 0, width(), height());
+ canvas->FillRect(color, GetLocalBounds());
}
virtual void Layout() OVERRIDE {
button_->SetBounds(10, 10, width() - 20, height() - 20);
diff --git a/views/touchui/touch_selection_controller_impl.cc b/views/touchui/touch_selection_controller_impl.cc
index 6ce527e..e590216 100644
--- a/views/touchui/touch_selection_controller_impl.cc
+++ b/views/touchui/touch_selection_controller_impl.cc
@@ -4,8 +4,8 @@
#include "views/touchui/touch_selection_controller_impl.h"
-#include "base/utf_string_conversions.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "grit/ui_strings.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/base/l10n/l10n_util.h"
@@ -21,8 +21,8 @@
#include "views/controls/button/button.h"
#include "views/controls/button/custom_button.h"
#include "views/controls/button/text_button.h"
-#include "views/controls/menu/menu_config.h"
#include "views/controls/label.h"
+#include "views/controls/menu/menu_config.h"
#include "views/layout/box_layout.h"
#include "views/widget/widget.h"
@@ -191,15 +191,15 @@ class ContextMenuButtonBackground : public Background {
}
int w = view->width();
int h = view->height();
- canvas->FillRectInt(background_color, 1, 1, w - 2, h - 2);
- canvas->FillRectInt(border_color, 2, 0, w - 4, 1);
- canvas->FillRectInt(border_color, 1, 1, 1, 1);
- canvas->FillRectInt(border_color, 0, 2, 1, h - 4);
- canvas->FillRectInt(border_color, 1, h - 2, 1, 1);
- canvas->FillRectInt(border_color, 2, h - 1, w - 4, 1);
- canvas->FillRectInt(border_color, w - 2, 1, 1, 1);
- canvas->FillRectInt(border_color, w - 1, 2, 1, h - 4);
- canvas->FillRectInt(border_color, w - 2, h - 2, 1, 1);
+ canvas->FillRect(background_color, gfx::Rect(1, 1, w - 2, h - 2));
+ canvas->FillRect(border_color, gfx::Rect(2, 0, w - 4, 1));
+ canvas->FillRect(border_color, gfx::Rect(1, 1, 1, 1));
+ canvas->FillRect(border_color, gfx::Rect(0, 2, 1, h - 4));
+ canvas->FillRect(border_color, gfx::Rect(1, h - 2, 1, 1));
+ canvas->FillRect(border_color, gfx::Rect(2, h - 1, w - 4, 1));
+ canvas->FillRect(border_color, gfx::Rect(w - 2, 1, 1, 1));
+ canvas->FillRect(border_color, gfx::Rect(w - 1, 2, 1, h - 4));
+ canvas->FillRect(border_color, gfx::Rect(w - 2, h - 2, 1, 1));
}
private:
diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc
index 504a087..1b23eed 100644
--- a/views/window/custom_frame_view.cc
+++ b/views/window/custom_frame_view.cc
@@ -345,18 +345,28 @@ void CustomFrameView::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(), frame_image->height());
- // Now fill down the sides.
- canvas->FillRectInt(frame_color, 0, frame_image->height(), left_edge->width(),
- height() - frame_image->height());
- canvas->FillRectInt(frame_color, width() - right_edge->width(),
- frame_image->height(), right_edge->width(),
- height() - frame_image->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(), frame_image->height()));
+
+ int remaining_height = height() - frame_image->height();
+ if (remaining_height > 0) {
+ // Now fill down the sides.
+ canvas->FillRect(frame_color,
+ gfx::Rect(0, frame_image->height(), left_edge->width(),
+ remaining_height));
+ canvas->FillRect(frame_color,
+ gfx::Rect(width() - right_edge->width(),
+ frame_image->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(*frame_image, 0, 0, width(), frame_image->height());
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc
index 9a75fe2..4320308 100644
--- a/views/window/dialog_client_view.cc
+++ b/views/window/dialog_client_view.cc
@@ -56,7 +56,7 @@ void UpdateButtonHelper(NativeTextButton* button_view,
void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) {
SkColor sk_color =
SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color));
- canvas->FillRectInt(sk_color, 0, 0, view->width(), view->height());
+ canvas->FillRect(sk_color, view->GetLocalBounds());
}
#endif
@@ -317,14 +317,13 @@ void DialogClientView::OnPaint(gfx::Canvas* canvas) {
FillViewWithSysColor(canvas, this, GetSysColor(COLOR_3DFACE));
#elif defined(USE_WAYLAND) || defined(USE_AURA)
SkColor sk_color = SkColorSetARGB(200, 255, 255, 255);
- canvas->FillRectInt(sk_color, 0, 0, width(), height());
+ canvas->FillRect(sk_color, GetLocalBounds());
#else
GtkWidget* widget = GetWidget()->GetNativeView();
if (GTK_IS_WINDOW(widget)) {
GtkStyle* window_style = gtk_widget_get_style(widget);
- canvas->FillRectInt(gfx::GdkColorToSkColor(
- window_style->bg[GTK_STATE_NORMAL]),
- 0, 0, width(), height());
+ canvas->FillRect(gfx::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]),
+ GetLocalBounds());
}
#endif
}