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

Unified Diff: ui/gfx/canvas_direct2d.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_direct2d.cc
diff --git a/ui/gfx/canvas_direct2d.cc b/ui/gfx/canvas_direct2d.cc
index 53cd6a1874842724b84871d0fa8b862e944b6151..b179df88ebc1895c1f3e823e97d3061a8e5bf188 100644
--- a/ui/gfx/canvas_direct2d.cc
+++ b/ui/gfx/canvas_direct2d.cc
@@ -173,13 +173,14 @@ void CanvasDirect2D::Restore() {
rt_->RestoreDrawingState(drawing_state_block_);
}
-bool CanvasDirect2D::ClipRectInt(int x, int y, int w, int h) {
- rt_->PushAxisAlignedClip(RectToRectF(x, y, w, h),
- D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
+bool CanvasDirect2D::ClipRectInt(const gfx::Rect& rect) {
+ rt_->PushAxisAlignedClip(
+ RectToRectF(rect.x(), rect.y(), rect.width(), rect.height()),
Peter Kasting 2011/10/25 20:24:47 Nit: Just RectToRectF(rect) should work.
tfarina 2011/10/25 23:52:41 Done.
+ D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
// Increment the clip count so the call to PushAxisAlignedClip() can be
// balanced with a call to PopAxisAlignedClip in the next Restore().
++state_.top().clip_count;
- return w > 0 && h > 0;
+ return rect.width() > 0 && rect.height() > 0;
Peter Kasting 2011/10/25 20:24:47 Nit: Simpler: return !rect.IsEmpty();
tfarina 2011/10/25 23:52:41 Done.
}
void CanvasDirect2D::TranslateInt(int x, int y) {

Powered by Google App Engine
This is Rietveld 408576698