OLD | NEW |
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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 return true; | 642 return true; |
643 | 643 |
644 gfx::Rect original_rect = *op_rect; | 644 gfx::Rect original_rect = *op_rect; |
645 // Take the enclosing rectangle after scaling so a rectangle scaled down then | 645 // Take the enclosing rectangle after scaling so a rectangle scaled down then |
646 // scaled back up by the inverse scale would fully contain the entire area | 646 // scaled back up by the inverse scale would fully contain the entire area |
647 // affected by the original rectangle. | 647 // affected by the original rectangle. |
648 *op_rect = gfx::ToEnclosingRect(gfx::ScaleRect(*op_rect, scale)); | 648 *op_rect = gfx::ToEnclosingRect(gfx::ScaleRect(*op_rect, scale)); |
649 if (delta) { | 649 if (delta) { |
650 gfx::Point original_delta = *delta; | 650 gfx::Point original_delta = *delta; |
651 float inverse_scale = 1.0f / scale; | 651 float inverse_scale = 1.0f / scale; |
652 *delta = gfx::ToFlooredPoint(delta->Scale(scale)); | 652 *delta = gfx::ToFlooredPoint(gfx::ScalePoint(*delta, scale)); |
653 | 653 |
654 gfx::Rect inverse_scaled_rect = | 654 gfx::Rect inverse_scaled_rect = |
655 gfx::ToEnclosingRect(gfx::ScaleRect(*op_rect, inverse_scale)); | 655 gfx::ToEnclosingRect(gfx::ScaleRect(*op_rect, inverse_scale)); |
656 if (original_rect != inverse_scaled_rect) | 656 if (original_rect != inverse_scaled_rect) |
657 return false; | 657 return false; |
658 gfx::Point inverse_scaled_point = | 658 gfx::Point inverse_scaled_point = |
659 gfx::ToFlooredPoint(delta->Scale(inverse_scale)); | 659 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); |
660 if (original_delta != inverse_scaled_point) | 660 if (original_delta != inverse_scaled_point) |
661 return false; | 661 return false; |
662 } | 662 } |
663 | 663 |
664 return true; | 664 return true; |
665 } | 665 } |
666 | 666 |
667 void PPB_Graphics2D_Impl::ExecutePaintImageData(PPB_ImageData_Impl* image, | 667 void PPB_Graphics2D_Impl::ExecutePaintImageData(PPB_ImageData_Impl* image, |
668 int x, int y, | 668 int x, int y, |
669 const gfx::Rect& src_rect, | 669 const gfx::Rect& src_rect, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 757 } |
758 | 758 |
759 bool PPB_Graphics2D_Impl::HasPendingFlush() const { | 759 bool PPB_Graphics2D_Impl::HasPendingFlush() const { |
760 return !unpainted_flush_callback_.is_null() || | 760 return !unpainted_flush_callback_.is_null() || |
761 !painted_flush_callback_.is_null() || | 761 !painted_flush_callback_.is_null() || |
762 offscreen_flush_pending_; | 762 offscreen_flush_pending_; |
763 } | 763 } |
764 | 764 |
765 } // namespace ppapi | 765 } // namespace ppapi |
766 } // namespace webkit | 766 } // namespace webkit |
OLD | NEW |