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

Unified Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 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 | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_scrollbar_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index 85c27d96a47feca1589f15814fa79c80aa08a782..923b88d4af73f2d488f800ba278162d082ba5df5 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -376,7 +376,8 @@ int32_t PPB_Graphics2D_Impl::Flush(scoped_refptr<TrackedCallback> callback,
// Set |no_update_visible| to false if the change overlaps the visible
// area.
- gfx::Rect visible_changed_rect = clip.Intersect(op_rect);
+ gfx::Rect visible_changed_rect = clip;
+ visible_changed_rect.Intersect(op_rect);
if (!visible_changed_rect.IsEmpty())
no_update_visible = false;
@@ -560,7 +561,8 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
CGContextDrawImage(canvas, bitmap_rect, image);
#else
- gfx::Rect invalidate_rect = plugin_rect.Intersect(paint_rect);
+ gfx::Rect invalidate_rect = plugin_rect;
+ invalidate_rect.Intersect(paint_rect);
SkRect sk_invalidate_rect = gfx::RectToSkRect(invalidate_rect);
SkAutoCanvasRestore auto_restore(canvas, true);
canvas->clipRect(sk_invalidate_rect);
@@ -647,12 +649,17 @@ bool PPB_Graphics2D_Impl::ConvertToLogicalPixels(float scale,
// Take the enclosing rectangle after scaling so a rectangle scaled down then
// scaled back up by the inverse scale would fully contain the entire area
// affected by the original rectangle.
- *op_rect = gfx::ToEnclosingRect(op_rect->Scale(scale));
+ gfx::RectF scaled_rect = *op_rect;
+ scaled_rect.Scale(scale);
+ *op_rect = gfx::ToEnclosingRect(scaled_rect);
if (delta) {
gfx::Point original_delta = *delta;
float inverse_scale = 1.0f / scale;
*delta = gfx::ToFlooredPoint(delta->Scale(scale));
- if (original_rect != gfx::ToEnclosingRect(op_rect->Scale(inverse_scale)) ||
+
+ gfx::RectF inverse_scaled_rect = *op_rect;
+ inverse_scaled_rect.Scale(inverse_scale);
+ if (original_rect != gfx::ToEnclosingRect(inverse_scaled_rect) ||
original_delta != gfx::ToFlooredPoint(delta->Scale(inverse_scale))) {
return false;
}
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_scrollbar_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698