summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 21:44:40 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 21:44:40 +0000
commitb8bdc427dc7802592bb2fea2b042f1db9667cd61 (patch)
tree9d1337b4b30ad85a14dd9307cedd0ce438c33f41 /ui
parent07407b6976668863b6ebff63674bfc90da89967f (diff)
downloadchromium_src-b8bdc427dc7802592bb2fea2b042f1db9667cd61.zip
chromium_src-b8bdc427dc7802592bb2fea2b042f1db9667cd61.tar.gz
chromium_src-b8bdc427dc7802592bb2fea2b042f1db9667cd61.tar.bz2
Pass const gfx::Rect& as the first parameter to FillRect.
BUG=100898 R=pkasting@chromium.org TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/9021046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/canvas.h16
-rw-r--r--ui/gfx/canvas_skia.cc10
-rw-r--r--ui/gfx/canvas_skia.h10
-rw-r--r--ui/gfx/canvas_skia_linux.cc2
-rw-r--r--ui/gfx/compositor/layer_unittest.cc4
-rw-r--r--ui/gfx/render_text.cc4
-rw-r--r--ui/views/border.cc12
-rw-r--r--ui/views/controls/menu/menu_scroll_view_container.cc4
-rw-r--r--ui/views/controls/menu/submenu_view.cc2
-rw-r--r--ui/views/controls/native/native_view_host.cc4
-rw-r--r--ui/views/controls/separator.cc4
-rw-r--r--ui/views/controls/table/table_view_views.cc2
-rw-r--r--ui/views/controls/tree/tree_view_views.cc13
-rw-r--r--ui/views/examples/native_theme_button_example.cc4
-rw-r--r--ui/views/touchui/touch_selection_controller_impl.cc20
-rw-r--r--ui/views/window/dialog_client_view.cc8
-rw-r--r--ui/views/window/frame_background.cc30
17 files changed, 72 insertions, 77 deletions
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h
index c3aa3b0..d774309 100644
--- a/ui/gfx/canvas.h
+++ b/ui/gfx/canvas.h
@@ -105,17 +105,17 @@ class UI_EXPORT Canvas {
virtual void Scale(int x_scale, int y_scale) = 0;
- // Fills the specified region with the specified color using a transfer
- // mode of SkXfermode::kSrcOver_Mode.
- virtual void FillRect(const SkColor& color, const gfx::Rect& rect) = 0;
+ // Fills |rect| with |color| using a transfer mode of
+ // SkXfermode::kSrcOver_Mode.
+ virtual void FillRect(const gfx::Rect& rect, const SkColor& color) = 0;
- // Fills the specified region with the specified color and mode.
- virtual void FillRect(const SkColor& color,
- const gfx::Rect& rect,
+ // Fills |rect| with the specified |color| and |mode|.
+ virtual void FillRect(const gfx::Rect& rect,
+ const SkColor& color,
SkXfermode::Mode mode) = 0;
- // Fills the specified region with the specified brush.
- virtual void FillRect(const gfx::Brush* brush, const gfx::Rect& rect) = 0;
+ // Fills |rect| with the specified |brush|.
+ virtual void FillRect(const gfx::Rect& rect, const gfx::Brush* brush) = 0;
// Draws a single pixel rect in the specified region with the specified
// color, using a transfer mode of SkXfermode::kSrcOver_Mode.
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
index 0520634..7410443 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -138,12 +138,12 @@ void CanvasSkia::Scale(int x_scale, int y_scale) {
canvas_->scale(SkIntToScalar(x_scale), SkIntToScalar(y_scale));
}
-void CanvasSkia::FillRect(const SkColor& color, const gfx::Rect& rect) {
- FillRect(color, rect, SkXfermode::kSrcOver_Mode);
+void CanvasSkia::FillRect(const gfx::Rect& rect, const SkColor& color) {
+ FillRect(rect, color, SkXfermode::kSrcOver_Mode);
}
-void CanvasSkia::FillRect(const SkColor& color,
- const gfx::Rect& rect,
+void CanvasSkia::FillRect(const gfx::Rect& rect,
+ const SkColor& color,
SkXfermode::Mode mode) {
SkPaint paint;
paint.setColor(color);
@@ -152,7 +152,7 @@ void CanvasSkia::FillRect(const SkColor& color,
DrawRect(rect, paint);
}
-void CanvasSkia::FillRect(const gfx::Brush* brush, const gfx::Rect& rect) {
+void CanvasSkia::FillRect(const gfx::Rect& rect, const gfx::Brush* brush) {
const SkiaShader* shader = static_cast<const SkiaShader*>(brush);
SkPaint paint;
paint.setShader(shader->shader());
diff --git a/ui/gfx/canvas_skia.h b/ui/gfx/canvas_skia.h
index a920c62..9ef4d1d 100644
--- a/ui/gfx/canvas_skia.h
+++ b/ui/gfx/canvas_skia.h
@@ -111,12 +111,12 @@ class UI_EXPORT CanvasSkia : public Canvas {
virtual bool ClipRect(const gfx::Rect& rect) OVERRIDE;
virtual void Translate(const gfx::Point& point) OVERRIDE;
virtual void Scale(int x_scale, int y_scale) OVERRIDE;
- virtual void FillRect(const SkColor& color, const gfx::Rect& rect) OVERRIDE;
- virtual void FillRect(const SkColor& color,
- const gfx::Rect& rect,
+ virtual void FillRect(const gfx::Rect& rect, const SkColor& color) OVERRIDE;
+ virtual void FillRect(const gfx::Rect& rect,
+ const SkColor& color,
SkXfermode::Mode mode) OVERRIDE;
- virtual void FillRect(const gfx::Brush* brush,
- const gfx::Rect& rect) OVERRIDE;
+ virtual void FillRect(const gfx::Rect& rect,
+ const gfx::Brush* brush) OVERRIDE;
virtual void DrawRect(const gfx::Rect& rect, const SkColor& color) OVERRIDE;
virtual void DrawRect(const gfx::Rect& rect,
const SkColor& color,
diff --git a/ui/gfx/canvas_skia_linux.cc b/ui/gfx/canvas_skia_linux.cc
index 7d95717..6525a2e 100644
--- a/ui/gfx/canvas_skia_linux.cc
+++ b/ui/gfx/canvas_skia_linux.cc
@@ -115,7 +115,7 @@ void DrawStringContext::DrawWithHalo(const SkColor& text_color,
const SkColor& halo_color) {
gfx::Size size(bounds_.width() + 2, bounds_.height() + 2);
gfx::CanvasSkia text_canvas(size, false);
- text_canvas.FillRect(static_cast<SkColor>(0), gfx::Rect(gfx::Point(), size));
+ text_canvas.FillRect(gfx::Rect(gfx::Point(), size), static_cast<SkColor>(0));
{
skia::ScopedPlatformPaint scoped_platform_paint(text_canvas.sk_canvas());
diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc
index 8accd0b..2eefea8 100644
--- a/ui/gfx/compositor/layer_unittest.cc
+++ b/ui/gfx/compositor/layer_unittest.cc
@@ -228,8 +228,8 @@ class TestLayerDelegate : public LayerDelegate {
virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE {
SkBitmap contents = canvas->AsCanvasSkia()->ExtractBitmap();
paint_size_ = gfx::Size(contents.width(), contents.height());
- canvas->FillRect(colors_[color_index_],
- gfx::Rect(gfx::Point(), paint_size_));
+ canvas->FillRect(gfx::Rect(gfx::Point(), paint_size_),
+ colors_[color_index_]);
color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size());
}
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 416e96d..5b9b8c4 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -843,7 +843,7 @@ void RenderText::DrawSelection(Canvas* canvas) {
NativeTheme::kColorId_TextfieldSelectionBackgroundUnfocused;
SkColor color = NativeTheme::instance()->GetSystemColor(color_id);
for (std::vector<Rect>::const_iterator i = sel.begin(); i < sel.end(); ++i)
- canvas->FillRect(color, *i);
+ canvas->FillRect(*i, color);
}
void RenderText::DrawCursor(Canvas* canvas) {
@@ -852,7 +852,7 @@ void RenderText::DrawCursor(Canvas* canvas) {
if (cursor_enabled() && cursor_visible() && focused()) {
const Rect& bounds = GetUpdatedCursorBounds();
if (bounds.width() != 0)
- canvas->FillRect(kCursorColor, bounds);
+ canvas->FillRect(bounds, kCursorColor);
else
canvas->DrawRect(bounds, kCursorColor);
}
diff --git a/ui/views/border.cc b/ui/views/border.cc
index f748452..dc62676 100644
--- a/ui/views/border.cc
+++ b/ui/views/border.cc
@@ -36,15 +36,15 @@ SolidBorder::SolidBorder(int thickness, SkColor color)
void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const {
// Top border.
- canvas->FillRect(color_, gfx::Rect(0, 0, view.width(), insets_.top()));
+ canvas->FillRect(gfx::Rect(0, 0, view.width(), insets_.top()), color_);
// Left border.
- canvas->FillRect(color_, gfx::Rect(0, 0, insets_.left(), view.height()));
+ canvas->FillRect(gfx::Rect(0, 0, insets_.left(), view.height()), color_);
// Bottom border.
- canvas->FillRect(color_, gfx::Rect(0, view.height() - insets_.bottom(),
- view.width(), insets_.bottom()));
+ canvas->FillRect(gfx::Rect(0, view.height() - insets_.bottom(), view.width(),
+ insets_.bottom()), color_);
// Right border.
- canvas->FillRect(color_, gfx::Rect(view.width() - insets_.right(), 0,
- insets_.right(), view.height()));
+ canvas->FillRect(gfx::Rect(view.width() - insets_.right(), 0, insets_.right(),
+ view.height()), color_);
}
void SolidBorder::GetInsets(gfx::Insets* insets) const {
diff --git a/ui/views/controls/menu/menu_scroll_view_container.cc b/ui/views/controls/menu/menu_scroll_view_container.cc
index b04a318..5e61f06 100644
--- a/ui/views/controls/menu/menu_scroll_view_container.cc
+++ b/ui/views/controls/menu/menu_scroll_view_container.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -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->FillRect(arrow_color, gfx::Rect(x, y, (i * 2) + 1, 1));
+ canvas->FillRect(gfx::Rect(x, y, (i * 2) + 1, 1), arrow_color);
}
private:
diff --git a/ui/views/controls/menu/submenu_view.cc b/ui/views/controls/menu/submenu_view.cc
index 3839ac7..b388073 100644
--- a/ui/views/controls/menu/submenu_view.cc
+++ b/ui/views/controls/menu/submenu_view.cc
@@ -382,7 +382,7 @@ void SubmenuView::PaintDropIndicator(gfx::Canvas* canvas,
return;
gfx::Rect bounds = CalculateDropIndicatorBounds(item, position);
- canvas->FillRect(kDropIndicatorColor, bounds);
+ canvas->FillRect(bounds, kDropIndicatorColor);
}
void SubmenuView::SchedulePaintForDropIndicator(
diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
index 63401e8..8a34c25 100644
--- a/ui/views/controls/native/native_view_host.cc
+++ b/ui/views/controls/native/native_view_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -125,7 +125,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->FillRect(SK_ColorWHITE, GetLocalBounds());
+ canvas->FillRect(GetLocalBounds(), SK_ColorWHITE);
}
void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) {
diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc
index 2842068..810e7d8 100644
--- a/ui/views/controls/separator.cc
+++ b/ui/views/controls/separator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -37,7 +37,7 @@ void Separator::GetAccessibleState(ui::AccessibleViewState* state) {
}
void Separator::Paint(gfx::Canvas* canvas) {
- canvas->FillRect(kDefaultColor, bounds());
+ canvas->FillRect(bounds(), kDefaultColor);
}
std::string Separator::GetClassName() const {
diff --git a/ui/views/controls/table/table_view_views.cc b/ui/views/controls/table/table_view_views.cc
index 2788931..187c0d6 100644
--- a/ui/views/controls/table/table_view_views.cc
+++ b/ui/views/controls/table/table_view_views.cc
@@ -242,7 +242,7 @@ void TableView::OnPaint(gfx::Canvas* canvas) {
for (int i = min_row; i < max_row; ++i) {
gfx::Rect row_bounds(GetRowBounds(i));
if (i == selected_row_) {
- canvas->FillRect(kSelectedBackgroundColor, row_bounds);
+ canvas->FillRect(row_bounds, kSelectedBackgroundColor);
if (HasFocus())
canvas->DrawFocusRect(row_bounds);
}
diff --git a/ui/views/controls/tree/tree_view_views.cc b/ui/views/controls/tree/tree_view_views.cc
index b736637..b2225c0 100644
--- a/ui/views/controls/tree/tree_view_views.cc
+++ b/ui/views/controls/tree/tree_view_views.cc
@@ -661,7 +661,7 @@ void TreeView::PaintRow(gfx::Canvas* canvas,
if (base::i18n::IsRTL())
text_bounds.set_x(bounds.x());
if (node == selected_node_) {
- canvas->FillRect(kSelectedBackgroundColor, text_bounds);
+ canvas->FillRect(text_bounds, kSelectedBackgroundColor);
if (HasFocus())
canvas->DrawFocusRect(text_bounds);
}
@@ -688,16 +688,15 @@ void TreeView::PaintExpandControl(gfx::Canvas* canvas,
if (!expanded) {
int delta = base::i18n::IsRTL() ? 1 : -1;
for (int i = 0; i < 4; ++i) {
- canvas->FillRect(kArrowColor,
- gfx::Rect(center_x + delta * (2 - i),
- center_y - (3 - i), 1, (3 - i) * 2 + 1));
+ canvas->FillRect(gfx::Rect(center_x + delta * (2 - i),
+ center_y - (3 - i), 1, (3 - i) * 2 + 1),
+ kArrowColor);
}
} else {
center_y -= 2;
for (int i = 0; i < 4; ++i) {
- canvas->FillRect(kArrowColor,
- gfx::Rect(center_x - (3 - i), center_y + i,
- (3 - i) * 2 + 1, 1));
+ canvas->FillRect(gfx::Rect(center_x - (3 - i), center_y + i,
+ (3 - i) * 2 + 1, 1), kArrowColor);
}
}
}
diff --git a/ui/views/examples/native_theme_button_example.cc b/ui/views/examples/native_theme_button_example.cc
index c37fc3e..7d73815 100644
--- a/ui/views/examples/native_theme_button_example.cc
+++ b/ui/views/examples/native_theme_button_example.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -193,7 +193,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->FillRect(SkColorSetRGB(255, 128, 128), GetLocalBounds());
+ canvas->FillRect(GetLocalBounds(), SkColorSetRGB(255, 128, 128));
CustomButton::OnPaintBackground(canvas);
}
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc
index 85f68ef..27943d3 100644
--- a/ui/views/touchui/touch_selection_controller_impl.cc
+++ b/ui/views/touchui/touch_selection_controller_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -191,15 +191,15 @@ class ContextMenuButtonBackground : public Background {
}
int w = view->width();
int h = view->height();
- 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));
+ canvas->FillRect(gfx::Rect(1, 1, w - 2, h - 2), background_color);
+ canvas->FillRect(gfx::Rect(2, 0, w - 4, 1), border_color);
+ canvas->FillRect(gfx::Rect(1, 1, 1, 1), border_color);
+ canvas->FillRect(gfx::Rect(0, 2, 1, h - 4), border_color);
+ canvas->FillRect(gfx::Rect(1, h - 2, 1, 1), border_color);
+ canvas->FillRect(gfx::Rect(2, h - 1, w - 4, 1), border_color);
+ canvas->FillRect(gfx::Rect(w - 2, 1, 1, 1), border_color);
+ canvas->FillRect(gfx::Rect(w - 1, 2, 1, h - 4), border_color);
+ canvas->FillRect(gfx::Rect(w - 2, h - 2, 1, 1), border_color);
}
private:
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index 0dd5ed2..28c5ff2 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -314,12 +314,12 @@ void DialogClientView::OnPaint(gfx::Canvas* canvas) {
if (!GTK_IS_WINDOW(widget))
return;
SkColor bg_color = gfx::GdkColorToSkColor(
- gtk_widget_get_style(widget)->bg[GTK_STATE_NORMAL]);
+ gtk_widget_get_style(widget)->bg[GTK_STATE_NORMAL]);
#else
SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor(
- gfx::NativeTheme::kColorId_DialogBackground);
+ gfx::NativeTheme::kColorId_DialogBackground);
#endif
- canvas->FillRect(bg_color, GetLocalBounds());
+ canvas->FillRect(GetLocalBounds(), bg_color);
}
void DialogClientView::PaintChildren(gfx::Canvas* canvas) {
diff --git a/ui/views/window/frame_background.cc b/ui/views/window/frame_background.cc
index 5ea51cc..553604f 100644
--- a/ui/views/window/frame_background.cc
+++ b/ui/views/window/frame_background.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -139,8 +139,8 @@ void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const {
// account for the top_offset, but this is how it worked before.
int theme_frame_bottom = maximized_top_offset_ + theme_bitmap_->height();
if (top_area_height_ > theme_frame_bottom) {
- canvas->FillRect(frame_color_,
- gfx::Rect(0, 0, view->width(), top_area_height_));
+ canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
+ frame_color_);
}
int left_offset = 0;
@@ -171,8 +171,8 @@ void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const {
void FrameBackground::PaintFrameColor(gfx::Canvas* canvas, View* view) const {
// Fill the top area.
- canvas->FillRect(frame_color_,
- gfx::Rect(0, 0, view->width(), top_area_height_));
+ canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
+ frame_color_);
// If the window is very short, we're done.
int remaining_height = view->height() - top_area_height_;
@@ -180,14 +180,11 @@ void FrameBackground::PaintFrameColor(gfx::Canvas* canvas, View* view) const {
return;
// 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(view->width() - right_edge_->width(),
- top_area_height_,
- right_edge_->width(),
- remaining_height));
+ canvas->FillRect(gfx::Rect(0, top_area_height_, left_edge_->width(),
+ remaining_height), frame_color_);
+ canvas->FillRect(gfx::Rect(view->width() - right_edge_->width(),
+ top_area_height_, right_edge_->width(),
+ remaining_height), frame_color_);
// If the window is very narrow, we're done.
int center_width =
@@ -196,11 +193,10 @@ void FrameBackground::PaintFrameColor(gfx::Canvas* canvas, View* view) const {
return;
// Fill the bottom area.
- canvas->FillRect(frame_color_,
- gfx::Rect(left_edge_->width(),
+ canvas->FillRect(gfx::Rect(left_edge_->width(),
view->height() - bottom_edge_->height(),
- center_width,
- bottom_edge_->height()));
+ center_width, bottom_edge_->height()),
+ frame_color_);
}
} // namespace views