Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: ui/gfx/canvas_skia.cc

Issue 8359029: ui/gfx: Convert Canvas::DrawFocusRect() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address Peter's review Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/canvas_skia.h ('k') | views/controls/button/checkbox.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas_skia.cc
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
index c93dd09fd5676126be5391ddfe1c589bcd81021d..4e481ef43be1ba4b992551d97c2dc93861b7e013 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -181,7 +181,7 @@ void CanvasSkia::DrawLineInt(const SkColor& color,
SkIntToScalar(y2), paint);
}
-void CanvasSkia::DrawFocusRect(int x, int y, int width, int height) {
+void CanvasSkia::DrawFocusRect(const gfx::Rect& rect) {
// Create a 2D bitmap containing alternating on/off pixels - we do this
// so that you never get two pixels of the same color around the edges
// of the focus rect (this may mean that opposing edges of the rect may
@@ -206,8 +206,6 @@ void CanvasSkia::DrawFocusRect(int x, int y, int width, int height) {
}
}
- // First the horizontal lines.
-
// Make a shader for the bitmap with an origin of the box we'll draw. This
// shader is refcounted and will have an initial refcount of 1.
SkShader* shader = SkShader::CreateBitmapShader(
@@ -219,10 +217,10 @@ void CanvasSkia::DrawFocusRect(int x, int y, int width, int height) {
paint.setShader(shader);
shader->unref();
- DrawRectInt(x, y, width, 1, paint);
- DrawRectInt(x, y + height - 1, width, 1, paint);
- DrawRectInt(x, y, 1, height, paint);
- DrawRectInt(x + width - 1, y, 1, height, paint);
+ DrawRectInt(rect.x(), rect.y(), rect.width(), 1, paint);
+ DrawRectInt(rect.x(), rect.y() + rect.height() - 1, rect.width(), 1, paint);
+ DrawRectInt(rect.x(), rect.y(), 1, rect.height(), paint);
+ DrawRectInt(rect.x() + rect.width() - 1, rect.y(), 1, rect.height(), paint);
}
void CanvasSkia::DrawBitmapInt(const SkBitmap& bitmap, int x, int y) {
« no previous file with comments | « ui/gfx/canvas_skia.h ('k') | views/controls/button/checkbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698