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

Unified Diff: include/core/SkClipStack.h

Issue 178583002: Use SkTLazy to hold path in SkClipStack::Element (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add comment Created 6 years, 10 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 | include/core/SkTLazy.h » ('j') | no next file with comments »
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 5da53ae89434460e5f2ed1ab2a92440187265e43..028d5515606815c82de9d3c232edf8d97eb23e85 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -14,6 +14,7 @@
#include "SkRRect.h"
#include "SkRegion.h"
#include "SkTDArray.h"
+#include "SkTLazy.h"
// Because a single save/restore state can have multiple clips, this class
@@ -53,6 +54,8 @@ public:
this->setEmpty();
}
+ Element(const Element&);
+
Element(const SkRect& rect, SkRegion::Op op, bool doAA) {
this->initRect(0, rect, op, doAA);
}
@@ -72,7 +75,7 @@ public:
Type getType() const { return fType; }
//!< Call if getType() is kPath to get the path.
- const SkPath& getPath() const { SkASSERT(kPath_Type == fType); return fPath; }
+ const SkPath& getPath() const { SkASSERT(kPath_Type == fType); return *fPath.get(); }
//!< Call if getType() is kRRect to get the round-rect.
const SkRRect& getRRect() const { SkASSERT(kRRect_Type == fType); return fRRect; }
@@ -117,7 +120,7 @@ public:
case kRRect_Type:
return fRRect.getBounds();
case kPath_Type:
- return fPath.getBounds();
+ return fPath.get()->getBounds();
case kEmpty_Type:
return kEmpty;
default:
@@ -137,7 +140,7 @@ public:
case kRRect_Type:
return fRRect.contains(rect);
case kPath_Type:
- return fPath.conservativelyContainsRect(rect);
+ return fPath.get()->conservativelyContainsRect(rect);
case kEmpty_Type:
return false;
default:
@@ -150,13 +153,13 @@ public:
* Is the clip shape inverse filled.
*/
bool isInverseFilled() const {
- return kPath_Type == fType && fPath.isInverseFillType();
+ return kPath_Type == fType && fPath.get()->isInverseFillType();
}
private:
friend class SkClipStack;
- SkPath fPath;
+ SkTLazy<SkPath> fPath;
SkRRect fRRect;
int fSaveCount; // save count of stack when this element was added.
SkRegion::Op fOp;
« no previous file with comments | « no previous file | include/core/SkTLazy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698