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

Unified Diff: ui/gfx/canvas_skia.cc

Issue 8476019: ui/gfx: Convert Canvas::DrawRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reland - WHAT HERE could have broken media_unittests???? Created 9 years, 1 month 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') | ui/gfx/canvas_skia_win.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 4a7c7fc6b8f8bbd22a35ea96a21e360d388dc553..d7c0c0aa507c735c007398fe059132975a44e87c 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -133,7 +133,7 @@ void CanvasSkia::FillRect(const SkColor& color,
paint.setColor(color);
paint.setStyle(SkPaint::kFill_Style);
paint.setXfermodeMode(mode);
- DrawRectInt(rect.x(), rect.y(), rect.width(), rect.height(), paint);
+ DrawRect(rect, paint);
}
void CanvasSkia::FillRect(const gfx::Brush* brush, const gfx::Rect& rect) {
@@ -141,16 +141,16 @@ void CanvasSkia::FillRect(const gfx::Brush* brush, const gfx::Rect& rect) {
SkPaint paint;
paint.setShader(shader->shader());
// TODO(beng): set shader transform to match canvas transform.
- DrawRectInt(rect.x(), rect.y(), rect.width(), rect.height(), paint);
+ DrawRect(rect, paint);
}
-void CanvasSkia::DrawRectInt(const SkColor& color, int x, int y, int w, int h) {
- DrawRectInt(color, x, y, w, h, SkXfermode::kSrcOver_Mode);
+void CanvasSkia::DrawRect(const gfx::Rect& rect, const SkColor& color) {
+ DrawRect(rect, color, SkXfermode::kSrcOver_Mode);
}
-void CanvasSkia::DrawRectInt(const SkColor& color,
- int x, int y, int w, int h,
- SkXfermode::Mode mode) {
+void CanvasSkia::DrawRect(const gfx::Rect& rect,
+ const SkColor& color,
+ SkXfermode::Mode mode) {
SkPaint paint;
paint.setColor(color);
paint.setStyle(SkPaint::kStroke_Style);
@@ -160,12 +160,11 @@ void CanvasSkia::DrawRectInt(const SkColor& color,
paint.setStrokeWidth(SkIntToScalar(0));
paint.setXfermodeMode(mode);
- DrawRectInt(x, y, w, h, paint);
+ DrawRect(rect, paint);
}
-void CanvasSkia::DrawRectInt(int x, int y, int w, int h, const SkPaint& paint) {
- SkIRect rc = { x, y, x + w, y + h };
- canvas_->drawIRect(rc, paint);
+void CanvasSkia::DrawRect(const gfx::Rect& rect, const SkPaint& paint) {
+ canvas_->drawIRect(RectToSkIRect(rect), paint);
}
void CanvasSkia::DrawLineInt(const SkColor& color,
@@ -214,10 +213,12 @@ void CanvasSkia::DrawFocusRect(const gfx::Rect& rect) {
paint.setShader(shader);
shader->unref();
- 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);
+ DrawRect(gfx::Rect(rect.x(), rect.y(), rect.width(), 1), paint);
+ DrawRect(gfx::Rect(rect.x(), rect.y() + rect.height() - 1, rect.width(), 1),
+ paint);
+ DrawRect(gfx::Rect(rect.x(), rect.y(), 1, rect.height()), paint);
+ DrawRect(gfx::Rect(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') | ui/gfx/canvas_skia_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698