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

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

Issue 10704198: Scale to DIPs in ppb_graphics2d_impl for proper invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | 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 79821bb55a0b06764cdc9dafe0eb6aced70006ef..a55251ec17e12e843c2a4b92b0772d45fdd48655 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -350,11 +350,17 @@ int32_t PPB_Graphics2D_Impl::Flush(scoped_refptr<TrackedCallback> callback) {
// calls, leaving our callback stranded. So we still need to check whether
// the repainted area is visible to determine how to deal with the callback.
if (bound_instance_ && !op_rect.IsEmpty()) {
-
// Set |nothing_visible| to false if the change overlaps the visible area.
Wez 2012/07/13 21:29:57 nit: This comment belongs with the if statement be
Josh Horwich 2012/07/13 22:01:23 Agree with the nit - will fix so comment stays wit
Josh Horwich 2012/07/16 23:26:52 Done.
+ int left, top, right, bottom;
+ left = floor(op_rect.x() * scale_);
Wez 2012/07/16 17:41:43 Do we need to consider the impact of introducing f
Josh Horwich 2012/07/16 23:26:52 Looking elsewhere (e.g. ui/gfx) I see lots of FP m
+ top = floor(op_rect.y() * scale_);
+ right = ceil((op_rect.x() + op_rect.width()) * scale_);
Wez 2012/07/17 17:10:16 Out of interest, why does Graphics2D even need an
+ bottom = ceil((op_rect.y() + op_rect.height()) * scale_);
+ gfx::Rect dip_op_rect(left, top, right - left, bottom - top);
+
gfx::Rect visible_changed_rect =
PP_ToGfxRect(bound_instance_->view_data().clip_rect).
- Intersect(op_rect);
+ Intersect(dip_op_rect);
if (!visible_changed_rect.IsEmpty())
nothing_visible = false;
@@ -362,9 +368,9 @@ int32_t PPB_Graphics2D_Impl::Flush(scoped_refptr<TrackedCallback> callback) {
// partially or completely off-screen.
if (operation.type == QueuedOperation::SCROLL) {
bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy,
Wez 2012/07/13 21:29:57 Do you need to scale the scroll dx & dy values as
Josh Horwich 2012/07/13 22:01:23 Likely I do actually - thank you for noticing this
Wez 2012/07/16 17:41:43 By the time we reach here we've already "executed"
Josh Horwich 2012/07/16 23:26:52 Actually, I believe we will hit this case reasonab
Wez 2012/07/17 17:10:16 True; you really need to fix the underlying implem
- op_rect);
+ dip_op_rect);
} else {
- bound_instance_->InvalidateRect(op_rect);
+ bound_instance_->InvalidateRect(dip_op_rect);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698