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

Side by Side Diff: webkit/plugins/ppapi/ppb_graphics_2d_impl.cc

Issue 10223009: ppapi Graphics2d should invalidate all changes without clipping to visible area. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed subtle logic error Created 8 years, 7 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 case QueuedOperation::SCROLL: 337 case QueuedOperation::SCROLL:
338 ExecuteScroll(operation.scroll_clip_rect, 338 ExecuteScroll(operation.scroll_clip_rect,
339 operation.scroll_dx, operation.scroll_dy, 339 operation.scroll_dx, operation.scroll_dy,
340 &op_rect); 340 &op_rect);
341 break; 341 break;
342 case QueuedOperation::REPLACE: 342 case QueuedOperation::REPLACE:
343 ExecuteReplaceContents(operation.replace_image, &op_rect); 343 ExecuteReplaceContents(operation.replace_image, &op_rect);
344 break; 344 break;
345 } 345 }
346 346
347 // We need the rect to be in terms of the current clip rect of the plugin 347 // For correctness with accelerated compositing, we must issue an invalidate
348 // since that's what will actually be painted. If we issue an invalidate 348 // on the full op_rect even if it is partially or completely off-screen.
349 // for a clipped-out region, WebKit will do nothing and we won't get any 349 // However, if we issue an invalidate for a clipped-out region, WebKit will
350 // ViewWillInitiatePaint/ViewFlushedPaint calls, leaving our callback 350 // do nothing and we won't get any ViewWillInitiatePaint/ViewFlushedPaint
351 // stranded. 351 // calls, leaving our callback stranded. So we still need to check whether
352 gfx::Rect visible_changed_rect; 352 // the repainted area is visible to determine how to deal with the callback.
353 if (bound_instance_ && !op_rect.IsEmpty()) 353 if (bound_instance_ && !op_rect.IsEmpty()) {
354 visible_changed_rect =PP_ToGfxRect(bound_instance_->view_data().clip_rect) .
355 Intersect(op_rect);
356 354
357 if (bound_instance_ && !visible_changed_rect.IsEmpty()) { 355 // Set |nothing_visible| to false if the change overlaps the visible area.
356 gfx::Rect visible_changed_rect =
357 PP_ToGfxRect(bound_instance_->view_data().clip_rect).
brettw 2012/05/01 17:54:18 Indent 4 spaces (maybe "Intersect" will fit then?)
358 Intersect(op_rect);
359 if (!visible_changed_rect.IsEmpty())
360 nothing_visible = false;
361
362 // Notify the plugin of the entire change (op_rect), even if it is
363 // partially or completely off-screen.
358 if (operation.type == QueuedOperation::SCROLL) { 364 if (operation.type == QueuedOperation::SCROLL) {
359 bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy, 365 bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy,
360 visible_changed_rect); 366 op_rect);
361 } else { 367 } else {
362 bound_instance_->InvalidateRect(visible_changed_rect); 368 bound_instance_->InvalidateRect(op_rect);
363 } 369 }
364 nothing_visible = false;
365 } 370 }
366 } 371 }
367 queued_operations_.clear(); 372 queued_operations_.clear();
368 373
369 if (nothing_visible) { 374 if (nothing_visible) {
370 // There's nothing visible to invalidate so just schedule the callback to 375 // There's nothing visible to invalidate so just schedule the callback to
371 // execute in the next round of the message loop. 376 // execute in the next round of the message loop.
372 ScheduleOffscreenCallback(FlushCallbackData( 377 ScheduleOffscreenCallback(FlushCallbackData(
373 scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback)))); 378 scoped_refptr<TrackedCallback>(new TrackedCallback(this, callback))));
374 } else { 379 } else {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 685 }
681 686
682 bool PPB_Graphics2D_Impl::HasPendingFlush() const { 687 bool PPB_Graphics2D_Impl::HasPendingFlush() const {
683 return !unpainted_flush_callback_.is_null() || 688 return !unpainted_flush_callback_.is_null() ||
684 !painted_flush_callback_.is_null() || 689 !painted_flush_callback_.is_null() ||
685 offscreen_flush_pending_; 690 offscreen_flush_pending_;
686 } 691 }
687 692
688 } // namespace ppapi 693 } // namespace ppapi
689 } // namespace webkit 694 } // 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