summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/views/background.cc5
-rw-r--r--ui/views/border.cc3
-rw-r--r--ui/views/painter.cc14
-rw-r--r--ui/views/painter.h8
4 files changed, 15 insertions, 15 deletions
diff --git a/ui/views/background.cc b/ui/views/background.cc
index d48c423..92fa387 100644
--- a/ui/views/background.cc
+++ b/ui/views/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.
@@ -46,8 +46,7 @@ class BackgroundPainter : public Background {
void Paint(gfx::Canvas* canvas, View* view) const {
- Painter::PaintPainterAt(0, 0, view->width(), view->height(), canvas,
- painter_);
+ Painter::PaintPainterAt(canvas, painter_, view->GetLocalBounds());
}
private:
diff --git a/ui/views/border.cc b/ui/views/border.cc
index dc62676..7c6a981 100644
--- a/ui/views/border.cc
+++ b/ui/views/border.cc
@@ -85,8 +85,7 @@ class BorderPainter : public Border {
}
void Paint(const View& view, gfx::Canvas* canvas) const {
- Painter::PaintPainterAt(0, 0, view.width(), view.height(), canvas,
- painter_);
+ Painter::PaintPainterAt(canvas, painter_, view.GetLocalBounds());
}
virtual void GetInsets(gfx::Insets* insets) const {
diff --git a/ui/views/painter.cc b/ui/views/painter.cc
index ef5cfbf..6b23c37 100644
--- a/ui/views/painter.cc
+++ b/ui/views/painter.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.
@@ -12,6 +12,7 @@
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/point.h"
+#include "ui/gfx/rect.h"
namespace views {
@@ -144,14 +145,13 @@ class ImagePainter : public Painter {
} // namespace
// static
-void Painter::PaintPainterAt(int x, int y, int w, int h,
- gfx::Canvas* canvas, Painter* painter) {
+void Painter::PaintPainterAt(gfx::Canvas* canvas,
+ Painter* painter,
+ const gfx::Rect& rect) {
DCHECK(canvas && painter);
- if (w < 0 || h < 0)
- return;
canvas->Save();
- canvas->Translate(gfx::Point(x, y));
- painter->Paint(w, h, canvas);
+ canvas->Translate(rect.origin());
+ painter->Paint(rect.width(), rect.height(), canvas);
canvas->Restore();
}
diff --git a/ui/views/painter.h b/ui/views/painter.h
index 575eae9..c782425 100644
--- a/ui/views/painter.h
+++ b/ui/views/painter.h
@@ -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.
@@ -14,6 +14,7 @@
namespace gfx {
class Canvas;
class Insets;
+class Rect;
}
class SkBitmap;
@@ -26,8 +27,9 @@ class VIEWS_EXPORT Painter {
public:
// A convenience method for painting a Painter in a particular region.
// This translates the canvas to x/y and paints the painter.
- static void PaintPainterAt(int x, int y, int w, int h,
- gfx::Canvas* canvas, Painter* painter);
+ static void PaintPainterAt(gfx::Canvas* canvas,
+ Painter* painter,
+ const gfx::Rect& rect);
// Creates a painter that draws a gradient between the two colors.
static Painter* CreateHorizontalGradient(SkColor c1, SkColor c2);