Index: chrome/browser/renderer_host/backing_store_mac.cc |
=================================================================== |
--- chrome/browser/renderer_host/backing_store_mac.cc (revision 17347) |
+++ chrome/browser/renderer_host/backing_store_mac.cc (working copy) |
@@ -21,14 +21,24 @@ |
void BackingStore::PaintRect(base::ProcessHandle process, |
TransportDIB* bitmap, |
- const gfx::Rect& bitmap_rect) { |
+ const gfx::Rect& bitmap_rect, |
+ const gfx::Rect& paint_rect) { |
+ DCHECK(bitmap_rect.Contains(paint_rect) && |
+ paint_rect.x() < kMaxBitmapLengthAllowed && |
+ paint_rect.y() < kMaxBitmapLengthAllowed); |
SkBitmap skbitmap; |
skbitmap.setConfig(SkBitmap::kARGB_8888_Config, bitmap_rect.width(), |
bitmap_rect.height(), 4 * bitmap_rect.width()); |
skbitmap.setPixels(bitmap->memory()); |
- |
- canvas_.drawBitmap(skbitmap, bitmap_rect.x(), bitmap_rect.y()); |
+ SkIRect src_rect; |
+ src_rect.set(paint_rect.x(), paint_rect.y(), |
+ paint_rect.right(), paint_rect.bottom()); |
+ src_rect.offset(-bitmap_rect.x(), -bitmap_rect.y()); |
+ SkRect dst_rect; |
+ dst_rect.iset(paint_rect.x(), paint_rect.y(), |
+ paint_rect.right(), paint_rect.bottom()); |
+ canvas_.drawBitmapRect(skbitmap, &src_rect, dst_rect); |
} |
void BackingStore::ScrollRect(base::ProcessHandle process, |
@@ -117,6 +127,6 @@ |
} |
// Now paint the new bitmap data. |
- PaintRect(process, bitmap, bitmap_rect); |
+ PaintRect(process, bitmap, bitmap_rect, bitmap_rect); |
return; |
} |