| 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/browser_plugin/browser_plugin_backing_store.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_backing_store.h" |
| 6 | 6 |
| 7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
| 8 #include "ui/gfx/rect.h" | 8 #include "ui/gfx/rect.h" |
| 9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
| 10 #include "ui/gfx/size_conversions.h" | 10 #include "ui/gfx/size_conversions.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 void BrowserPluginBackingStore::PaintToBackingStore( | 33 void BrowserPluginBackingStore::PaintToBackingStore( |
| 34 const gfx::Rect& bitmap_rect, | 34 const gfx::Rect& bitmap_rect, |
| 35 const std::vector<gfx::Rect>& copy_rects, | 35 const std::vector<gfx::Rect>& copy_rects, |
| 36 TransportDIB* dib) { | 36 TransportDIB* dib) { |
| 37 if (bitmap_rect.IsEmpty()) | 37 if (bitmap_rect.IsEmpty()) |
| 38 return; | 38 return; |
| 39 | 39 |
| 40 gfx::RectF scaled_bitmap_rect = bitmap_rect; | 40 gfx::RectF scaled_bitmap_rect = bitmap_rect; |
| 41 scaled_bitmap_rect.Scale(scale_factor_); | 41 scaled_bitmap_rect.Scale(scale_factor_); |
| 42 gfx::Rect pixel_bitmap_rect = gfx::ToEnclosingRect(scaled_bitmap_rect); | 42 gfx::Rect pixel_bitmap_rect = |
| 43 gfx::ToFlooredRectDeprecated(scaled_bitmap_rect); |
| 43 | 44 |
| 44 const int width = pixel_bitmap_rect.width(); | 45 const int width = pixel_bitmap_rect.width(); |
| 45 const int height = pixel_bitmap_rect.height(); | 46 const int height = pixel_bitmap_rect.height(); |
| 46 | 47 |
| 47 if (width <= 0 || width > kMaxSize || | 48 if (width <= 0 || width > kMaxSize || |
| 48 height <= 0 || height > kMaxSize) | 49 height <= 0 || height > kMaxSize) |
| 49 return; | 50 return; |
| 50 | 51 |
| 51 if (!dib) | 52 if (!dib) |
| 52 return; | 53 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 int x = std::min(pixel_rect.x(), pixel_rect.x() - pixel_dx); | 91 int x = std::min(pixel_rect.x(), pixel_rect.x() - pixel_dx); |
| 91 int y = std::min(pixel_rect.y(), pixel_rect.y() - pixel_dy); | 92 int y = std::min(pixel_rect.y(), pixel_rect.y() - pixel_dy); |
| 92 int w = pixel_rect.width() + abs(pixel_dx); | 93 int w = pixel_rect.width() + abs(pixel_dx); |
| 93 int h = pixel_rect.height() + abs(pixel_dy); | 94 int h = pixel_rect.height() + abs(pixel_dy); |
| 94 SkIRect rect = SkIRect::MakeXYWH(x, y, w, h); | 95 SkIRect rect = SkIRect::MakeXYWH(x, y, w, h); |
| 95 bitmap_.scrollRect(&rect, pixel_dx, pixel_dy); | 96 bitmap_.scrollRect(&rect, pixel_dx, pixel_dy); |
| 96 } | 97 } |
| 97 | 98 |
| 98 } // namespace content | 99 } // namespace content |
| OLD | NEW |