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 <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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 PPB_ImageData_Impl* dest_image, | 99 PPB_ImageData_Impl* dest_image, |
100 const SkRect& dest_rect) { | 100 const SkRect& dest_rect) { |
101 ImageDataAutoMapper auto_mapper(src_image); | 101 ImageDataAutoMapper auto_mapper(src_image); |
102 | 102 |
103 DCHECK(src_image->format() != dest_image->format()); | 103 DCHECK(src_image->format() != dest_image->format()); |
104 DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(src_image->format())); | 104 DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(src_image->format())); |
105 DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(dest_image->format())); | 105 DCHECK(PPB_ImageData_Impl::IsImageDataFormatSupported(dest_image->format())); |
106 | 106 |
107 SkBitmap src_bitmap(src_image->GetMappedBitmap()); | 107 SkBitmap src_bitmap(src_image->GetMappedBitmap()); |
108 SkBitmap dest_bitmap(dest_image->GetMappedBitmap()); | 108 SkBitmap dest_bitmap(dest_image->GetMappedBitmap()); |
109 SkAutoLockPixels src_lock(src_bitmap); | |
110 SkAutoLockPixels dest_lock(dest_bitmap); | |
111 if (src_rect.width() == src_image->width() && | 109 if (src_rect.width() == src_image->width() && |
112 dest_rect.width() == dest_image->width()) { | 110 dest_rect.width() == dest_image->width()) { |
113 // Fast path if the full frame can be converted at once. | 111 // Fast path if the full frame can be converted at once. |
114 SkSwapRB( | 112 SkSwapRB( |
115 dest_bitmap.getAddr32(static_cast<int>(dest_rect.fLeft), | 113 dest_bitmap.getAddr32(static_cast<int>(dest_rect.fLeft), |
116 static_cast<int>(dest_rect.fTop)), | 114 static_cast<int>(dest_rect.fTop)), |
117 src_bitmap.getAddr32(static_cast<int>(src_rect.fLeft), | 115 src_bitmap.getAddr32(static_cast<int>(src_rect.fLeft), |
118 static_cast<int>(src_rect.fTop)), | 116 static_cast<int>(src_rect.fTop)), |
119 src_rect.width() * src_rect.height()); | 117 src_rect.width() * src_rect.height()); |
120 } else { | 118 } else { |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 gfx::Point inverse_scaled_point = | 828 gfx::Point inverse_scaled_point = |
831 gfx::ScaleToFlooredPoint(*delta, inverse_scale); | 829 gfx::ScaleToFlooredPoint(*delta, inverse_scale); |
832 if (original_delta != inverse_scaled_point) | 830 if (original_delta != inverse_scaled_point) |
833 return false; | 831 return false; |
834 } | 832 } |
835 | 833 |
836 return true; | 834 return true; |
837 } | 835 } |
838 | 836 |
839 } // namespace content | 837 } // namespace content |
OLD | NEW |