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

Side by Side Diff: content/renderer/pepper/pepper_graphics_2d_host.cc

Issue 2444973002: Specify the rect invalidated by SetLayerTransform. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.h ('k') | 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 "content/renderer/pepper/pepper_graphics_2d_host.h" 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data) { 603 int32_t PepperGraphics2DHost::Flush(PP_Resource* old_image_data) {
604 bool done_replace_contents = false; 604 bool done_replace_contents = false;
605 bool no_update_visible = true; 605 bool no_update_visible = true;
606 bool is_plugin_visible = true; 606 bool is_plugin_visible = true;
607 607
608 for (size_t i = 0; i < queued_operations_.size(); i++) { 608 for (size_t i = 0; i < queued_operations_.size(); i++) {
609 QueuedOperation& operation = queued_operations_[i]; 609 QueuedOperation& operation = queued_operations_[i];
610 gfx::Rect op_rect; 610 gfx::Rect op_rect;
611 switch (operation.type) { 611 switch (operation.type) {
612 case QueuedOperation::TRANSFORM: 612 case QueuedOperation::TRANSFORM:
613 ExecuteTransform(operation.scale, operation.translation); 613 ExecuteTransform(operation.scale, operation.translation, &op_rect);
614 no_update_visible = false;
615 break; 614 break;
616 case QueuedOperation::PAINT: 615 case QueuedOperation::PAINT:
617 ExecutePaintImageData(operation.paint_image.get(), 616 ExecutePaintImageData(operation.paint_image.get(),
618 operation.paint_x, 617 operation.paint_x,
619 operation.paint_y, 618 operation.paint_y,
620 operation.paint_src_rect, 619 operation.paint_src_rect,
621 &op_rect); 620 &op_rect);
622 break; 621 break;
623 case QueuedOperation::SCROLL: 622 case QueuedOperation::SCROLL:
624 ExecuteScroll(operation.scroll_clip_rect, 623 ExecuteScroll(operation.scroll_clip_rect,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 695
697 if (bound_instance_ && bound_instance_->throttler() && 696 if (bound_instance_ && bound_instance_->throttler() &&
698 bound_instance_->throttler()->needs_representative_keyframe()) { 697 bound_instance_->throttler()->needs_representative_keyframe()) {
699 bound_instance_->throttler()->OnImageFlush(image_data_->GetMappedBitmap()); 698 bound_instance_->throttler()->OnImageFlush(image_data_->GetMappedBitmap());
700 } 699 }
701 700
702 return PP_OK_COMPLETIONPENDING; 701 return PP_OK_COMPLETIONPENDING;
703 } 702 }
704 703
705 void PepperGraphics2DHost::ExecuteTransform(const float& scale, 704 void PepperGraphics2DHost::ExecuteTransform(const float& scale,
706 const gfx::PointF& translate) { 705 const gfx::PointF& translate,
706 gfx::Rect* invalidated_rect) {
707 bound_instance_->SetGraphics2DTransform(scale, translate); 707 bound_instance_->SetGraphics2DTransform(scale, translate);
708 *invalidated_rect = PP_ToGfxRect(bound_instance_->view_data().clip_rect);
708 } 709 }
709 710
710 void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image, 711 void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image,
711 int x, 712 int x,
712 int y, 713 int y,
713 const gfx::Rect& src_rect, 714 const gfx::Rect& src_rect,
714 gfx::Rect* invalidated_rect) { 715 gfx::Rect* invalidated_rect) {
715 // Ensure the source image is mapped to read from it. 716 // Ensure the source image is mapped to read from it.
716 ImageDataAutoMapper auto_mapper(image); 717 ImageDataAutoMapper auto_mapper(image);
717 if (!auto_mapper.is_valid()) 718 if (!auto_mapper.is_valid())
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 gfx::Point inverse_scaled_point = 829 gfx::Point inverse_scaled_point =
829 gfx::ScaleToFlooredPoint(*delta, inverse_scale); 830 gfx::ScaleToFlooredPoint(*delta, inverse_scale);
830 if (original_delta != inverse_scaled_point) 831 if (original_delta != inverse_scaled_point)
831 return false; 832 return false;
832 } 833 }
833 834
834 return true; 835 return true;
835 } 836 }
836 837
837 } // namespace content 838 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_graphics_2d_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698