Index: cc/playback/drawing_display_item.cc |
diff --git a/cc/playback/drawing_display_item.cc b/cc/playback/drawing_display_item.cc |
index 569030b9a118cd7db74d243ffb2002bcd7f80d3a..6cebed2ae005fd3767a7af3f4cfb576cd3b0abb2 100644 |
--- a/cc/playback/drawing_display_item.cc |
+++ b/cc/playback/drawing_display_item.cc |
@@ -13,6 +13,7 @@ |
#include "third_party/skia/include/core/SkMatrix.h" |
#include "third_party/skia/include/core/SkPicture.h" |
#include "third_party/skia/include/utils/SkPictureUtils.h" |
+#include "ui/gfx/skia_util.h" |
namespace cc { |
@@ -30,7 +31,18 @@ void DrawingDisplayItem::SetNew(skia::RefPtr<SkPicture> picture) { |
} |
void DrawingDisplayItem::Raster(SkCanvas* canvas, |
+ const gfx::Rect& canvas_target_playback_rect, |
SkPicture::AbortCallback* callback) const { |
+ // The canvas_playback_rect can be empty to signify no culling is desired. |
+ if (!canvas_target_playback_rect.IsEmpty()) { |
+ const SkMatrix& matrix = canvas->getTotalMatrix(); |
+ const SkRect& cull_rect = picture_->cullRect(); |
+ SkRect target_rect; |
+ matrix.mapRect(&target_rect, cull_rect); |
+ if (!target_rect.intersect(gfx::RectToSkRect(canvas_target_playback_rect))) |
+ return; |
+ } |
+ |
// SkPicture always does a wrapping save/restore on the canvas, so it is not |
// necessary here. |
if (callback) |