Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: cc/playback/drawing_display_item.cc

Issue 1158553004: cc: Cull DrawingDisplayItems outside of the raster playback rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cull: . Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/playback/filter_display_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « cc/playback/drawing_display_item.h ('k') | cc/playback/filter_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698