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

Unified Diff: include/core/SkClipStack.h

Issue 48593003: Avoid re-rendering stencil clip for every draw with reducable clip stack (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 2 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 | « no previous file | src/core/SkClipStack.cpp » ('j') | src/core/SkClipStack.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkClipStack.h
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 145552dc13aca12b5cc1fd19404896379eb0f6b2..d29cb2677562e88117654c0a79d2936994b0cb0f 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -58,6 +58,12 @@ public:
this->initPath(0, path, op, doAA);
}
+ //<! Constructor for elements that are not stored in the clip stack.
+ Element(const SkRect& rect, SkRegion::Op op, bool doAA, int32_t genID) {
+ this->initRect(0, rect, op, doAA);
+ fGenID = genID;
+ }
+
bool operator== (const Element& element) const {
if (this == &element) {
return true;
@@ -109,7 +115,7 @@ public:
stack not to the element itself. That is the same clip path in different stacks will
have a different ID since the elements produce different clip result in the context of
their stacks. */
- int32_t getGenID() const { return fGenID; }
+ int32_t getGenID() const { SkASSERT(kInvalidGenID != fGenID); return fGenID; }
/**
* Gets the bounds of the clip element, either the rect or path bounds. (Whether the shape
@@ -316,25 +322,12 @@ public:
bool isWideOpen() const;
/**
- * Add a callback function that will be called whenever a clip state
- * is no longer viable. This will occur whenever restore
- * is called or when a clipDevRect or clipDevPath call updates the
- * clip within an existing save/restore state. Each clip state is
- * represented by a unique generation ID.
- */
- typedef void (*PFPurgeClipCB)(int genID, void* data);
- void addPurgeClipCallback(PFPurgeClipCB callback, void* data) const;
-
- /**
- * Remove a callback added earlier via addPurgeClipCallback
- */
- void removePurgeClipCallback(PFPurgeClipCB callback, void* data) const;
-
- /**
* The generation ID has three reserved values to indicate special
* (potentially ignorable) cases
*/
- static const int32_t kInvalidGenID = 0;
+ static const int32_t kInvalidGenID = 0; //!< Invalid id that is never returned by
+ //!< SkClipStack. Useful when caching clips
+ //!< based on GenID.
static const int32_t kEmptyGenID = 1; // no pixels writeable
static const int32_t kWideOpenGenID = 2; // all pixels writeable
@@ -440,29 +433,12 @@ private:
// invalid ID.
static int32_t gGenID;
- struct ClipCallbackData {
- PFPurgeClipCB fCallback;
- void* fData;
-
- friend bool operator==(const ClipCallbackData& a,
- const ClipCallbackData& b) {
- return a.fCallback == b.fCallback && a.fData == b.fData;
- }
- };
-
- mutable SkTDArray<ClipCallbackData> fCallbackData;
-
/**
* Restore the stack back to the specified save count.
*/
void restoreTo(int saveCount);
/**
- * Invoke all the purge callbacks passing in element's generation ID.
- */
- void purgeClip(Element* element);
-
- /**
* Return the next unique generation ID.
*/
static int32_t GetNextGenID();
« no previous file with comments | « no previous file | src/core/SkClipStack.cpp » ('j') | src/core/SkClipStack.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698