Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index e639212e384b0f58dda00b3e8086cbe03a059688..bceedba3f3a9a59dbac1239a6bc0ac08494c139c 100644 |
--- a/include/core/SkCanvas.h |
+++ b/include/core/SkCanvas.h |
@@ -935,7 +935,26 @@ public: |
// do nothing. Subclasses may do something |
} |
+ /** |
+ * This call asserts that subsequent draw operations (up to the matching popCull() call) |
+ * are fully contained within the given bounding box. The assertion is not enforced, |
+ * but the information might be used to quick-reject command blocks, so an incorrect |
+ * bounding box may result in incomplete rendering. |
+ */ |
+ void pushCull(const SkRect& cullRect) { |
robertphillips
2014/02/25 15:58:41
++fCullCount?
|
+ fCullCount += 1; |
+ this->onPushCull(cullRect); |
+ } |
+ /** |
+ * Terminates the current culling block, and restores the previous one (if any). |
+ */ |
+ void popCull() { |
robertphillips
2014/02/25 15:58:41
Maybe and "SkASSERT(fCullCount > 0);" to assist de
|
+ if (fCullCount > 0) { |
robertphillips
2014/02/25 15:58:41
--fCullCount?
|
+ fCullCount -= 1; |
+ this->onPopCull(); |
+ } |
+ } |
////////////////////////////////////////////////////////////////////////// |
/** Get the current bounder object. |
@@ -1101,6 +1120,9 @@ protected: |
// can perform copy-on-write or invalidate any cached images |
void predrawNotify(); |
+ virtual void onPushCull(const SkRect& cullRect); |
+ virtual void onPopCull(); |
+ |
private: |
class MCRec; |
@@ -1113,6 +1135,7 @@ private: |
SkBounder* fBounder; |
int fSaveLayerCount; // number of successful saveLayer calls |
+ int fCullCount; // number of active culls |
SkMetaData* fMetaData; |