Index: src/core/SkPicturePlayback.cpp |
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp |
index b546d397c04617570c7534c1ed338f451abc0af0..a8279ca089efdfa2d564c78f01c1e87c6db6083a 100644 |
--- a/src/core/SkPicturePlayback.cpp |
+++ b/src/core/SkPicturePlayback.cpp |
@@ -707,7 +707,8 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) |
#endif |
#ifdef SPEW_CLIP_SKIPPING |
- SkipClipRec skipRect, skipRRect, skipRegion, skipPath; |
+ SkipClipRec skipRect, skipRRect, skipRegion, skipPath, skipCull; |
+ int opCount = 0; |
#endif |
#ifdef SK_BUILD_FOR_ANDROID |
@@ -772,6 +773,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) |
} |
#endif |
+#ifdef SPEW_CLIP_SKIPPING |
+ opCount++; |
+#endif |
+ |
size_t curOffset = reader.offset(); |
uint32_t size; |
DrawType op = read_op_and_size(&reader, &size); |
@@ -867,6 +872,21 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) |
reader.setOffset(offsetToRestore); |
} |
} break; |
+ case PUSH_CULL: { |
+ const SkRect& cullRect = reader.skipT<SkRect>(); |
+ size_t offsetToRestore = reader.readInt(); |
+ if (offsetToRestore && canvas.quickReject(cullRect)) { |
+#ifdef SPEW_CLIP_SKIPPING |
+ skipCull.recordSkip(offsetToRestore - reader.offset()); |
+#endif |
+ reader.setOffset(offsetToRestore); |
+ } else { |
+ canvas.pushCull(cullRect); |
+ } |
+ } break; |
+ case POP_CULL: |
+ canvas.popCull(); |
+ break; |
case CONCAT: { |
SkMatrix matrix; |
this->getMatrix(reader, &matrix); |
@@ -1124,10 +1144,12 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) |
#ifdef SPEW_CLIP_SKIPPING |
{ |
- size_t size = skipRect.fSize + skipRRect.fSize + skipPath.fSize + skipRegion.fSize; |
- SkDebugf("--- Clip skips %d%% rect:%d rrect:%d path:%d rgn:%d\n", |
+ size_t size = skipRect.fSize + skipRRect.fSize + skipPath.fSize + skipRegion.fSize + |
+ skipCull.fSize; |
+ SkDebugf("--- Clip skips %d%% rect:%d rrect:%d path:%d rgn:%d cull:%d\n", |
size * 100 / reader.offset(), skipRect.fCount, skipRRect.fCount, |
- skipPath.fCount, skipRegion.fCount); |
+ skipPath.fCount, skipRegion.fCount, skipCull.fCount); |
+ SkDebugf("--- Total ops: %d\n", opCount); |
} |
#endif |
// this->dumpSize(); |