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

Unified Diff: ui/gfx/canvas_skia.cc

Issue 8383028: ui/gfx: Convert Canvas::ClipRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: ui/gfx/canvas_skia.cc
diff --git a/ui/gfx/canvas_skia.cc b/ui/gfx/canvas_skia.cc
index 4e481ef43be1ba4b992551d97c2dc93861b7e013..1ef7f3494f7c6f4e270ce0e73578e9e64d62d9d6 100644
--- a/ui/gfx/canvas_skia.cc
+++ b/ui/gfx/canvas_skia.cc
@@ -109,10 +109,12 @@ void CanvasSkia::Restore() {
canvas_->restore();
}
-bool CanvasSkia::ClipRectInt(int x, int y, int w, int h) {
+bool CanvasSkia::ClipRectInt(const gfx::Rect& rect) {
SkRect new_clip;
Peter Kasting 2011/10/25 20:24:47 Nit: Simpler: return canvas_->clipRect(gfx::RectT
tfarina 2011/10/25 23:52:41 Done.
- new_clip.set(SkIntToScalar(x), SkIntToScalar(y),
- SkIntToScalar(x + w), SkIntToScalar(y + h));
+ new_clip.set(SkIntToScalar(rect.x()),
+ SkIntToScalar(rect.y()),
+ SkIntToScalar(rect.x() + rect.width()),
+ SkIntToScalar(rect.y() + rect.height()));
return canvas_->clipRect(new_clip);
}
@@ -336,7 +338,7 @@ void CanvasSkia::TileImageInt(const SkBitmap& bitmap,
canvas_->save();
canvas_->translate(SkIntToScalar(dest_x - src_x),
SkIntToScalar(dest_y - src_y));
- ClipRectInt(src_x, src_y, w, h);
+ ClipRectInt(gfx::Rect(src_x, src_y, w, h));
canvas_->drawPaint(paint);
canvas_->restore();
}

Powered by Google App Engine
This is Rietveld 408576698