| 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 "content/renderer/pepper/pepper_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 return true; | 798 return true; |
| 799 | 799 |
| 800 gfx::Rect original_rect = *op_rect; | 800 gfx::Rect original_rect = *op_rect; |
| 801 // Take the enclosing rectangle after scaling so a rectangle scaled down then | 801 // Take the enclosing rectangle after scaling so a rectangle scaled down then |
| 802 // scaled back up by the inverse scale would fully contain the entire area | 802 // scaled back up by the inverse scale would fully contain the entire area |
| 803 // affected by the original rectangle. | 803 // affected by the original rectangle. |
| 804 *op_rect = gfx::ScaleToEnclosingRect(*op_rect, scale); | 804 *op_rect = gfx::ScaleToEnclosingRect(*op_rect, scale); |
| 805 if (delta) { | 805 if (delta) { |
| 806 gfx::Point original_delta = *delta; | 806 gfx::Point original_delta = *delta; |
| 807 float inverse_scale = 1.0f / scale; | 807 float inverse_scale = 1.0f / scale; |
| 808 *delta = gfx::ToFlooredPoint(gfx::ScalePoint(*delta, scale)); | 808 *delta = gfx::ScaleToFlooredPoint(*delta, scale); |
| 809 | 809 |
| 810 gfx::Rect inverse_scaled_rect = | 810 gfx::Rect inverse_scaled_rect = |
| 811 gfx::ScaleToEnclosingRect(*op_rect, inverse_scale); | 811 gfx::ScaleToEnclosingRect(*op_rect, inverse_scale); |
| 812 if (original_rect != inverse_scaled_rect) | 812 if (original_rect != inverse_scaled_rect) |
| 813 return false; | 813 return false; |
| 814 gfx::Point inverse_scaled_point = | 814 gfx::Point inverse_scaled_point = |
| 815 gfx::ToFlooredPoint(gfx::ScalePoint(*delta, inverse_scale)); | 815 gfx::ScaleToFlooredPoint(*delta, inverse_scale); |
| 816 if (original_delta != inverse_scaled_point) | 816 if (original_delta != inverse_scaled_point) |
| 817 return false; | 817 return false; |
| 818 } | 818 } |
| 819 | 819 |
| 820 return true; | 820 return true; |
| 821 } | 821 } |
| 822 | 822 |
| 823 } // namespace content | 823 } // namespace content |
| OLD | NEW |