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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" 5 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 break; 343 break;
344 } 344 }
345 345
346 // For correctness with accelerated compositing, we must issue an invalidate 346 // For correctness with accelerated compositing, we must issue an invalidate
347 // on the full op_rect even if it is partially or completely off-screen. 347 // on the full op_rect even if it is partially or completely off-screen.
348 // However, if we issue an invalidate for a clipped-out region, WebKit will 348 // However, if we issue an invalidate for a clipped-out region, WebKit will
349 // do nothing and we won't get any ViewWillInitiatePaint/ViewFlushedPaint 349 // do nothing and we won't get any ViewWillInitiatePaint/ViewFlushedPaint
350 // calls, leaving our callback stranded. So we still need to check whether 350 // calls, leaving our callback stranded. So we still need to check whether
351 // the repainted area is visible to determine how to deal with the callback. 351 // the repainted area is visible to determine how to deal with the callback.
352 if (bound_instance_ && !op_rect.IsEmpty()) { 352 if (bound_instance_ && !op_rect.IsEmpty()) {
353 // 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.
354 int left, top, right, bottom;
355 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
356 top = floor(op_rect.y() * scale_);
357 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
358 bottom = ceil((op_rect.y() + op_rect.height()) * scale_);
359 gfx::Rect dip_op_rect(left, top, right - left, bottom - top);
353 360
354 // Set |nothing_visible| to false if the change overlaps the visible area.
355 gfx::Rect visible_changed_rect = 361 gfx::Rect visible_changed_rect =
356 PP_ToGfxRect(bound_instance_->view_data().clip_rect). 362 PP_ToGfxRect(bound_instance_->view_data().clip_rect).
357 Intersect(op_rect); 363 Intersect(dip_op_rect);
358 if (!visible_changed_rect.IsEmpty()) 364 if (!visible_changed_rect.IsEmpty())
359 nothing_visible = false; 365 nothing_visible = false;
360 366
361 // Notify the plugin of the entire change (op_rect), even if it is 367 // Notify the plugin of the entire change (op_rect), even if it is
362 // partially or completely off-screen. 368 // partially or completely off-screen.
363 if (operation.type == QueuedOperation::SCROLL) { 369 if (operation.type == QueuedOperation::SCROLL) {
364 bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy, 370 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
365 op_rect); 371 dip_op_rect);
366 } else { 372 } else {
367 bound_instance_->InvalidateRect(op_rect); 373 bound_instance_->InvalidateRect(dip_op_rect);
368 } 374 }
369 } 375 }
370 } 376 }
371 queued_operations_.clear(); 377 queued_operations_.clear();
372 378
373 if (nothing_visible) { 379 if (nothing_visible) {
374 // There's nothing visible to invalidate so just schedule the callback to 380 // There's nothing visible to invalidate so just schedule the callback to
375 // execute in the next round of the message loop. 381 // execute in the next round of the message loop.
376 ScheduleOffscreenCallback(FlushCallbackData(callback)); 382 ScheduleOffscreenCallback(FlushCallbackData(callback));
377 } else { 383 } else {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 } 706 }
701 707
702 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 708 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
703 return !unpainted_flush_callback_.is_null() || 709 return !unpainted_flush_callback_.is_null() ||
704 !painted_flush_callback_.is_null() || 710 !painted_flush_callback_.is_null() ||
705 offscreen_flush_pending_; 711 offscreen_flush_pending_;
706 } 712 }
707 713
708 } // namespace ppapi 714 } // namespace ppapi
709 } // namespace webkit 715 } // namespace webkit
OLDNEW
« 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