Index: src/core/SkPathRef.cpp |
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp |
index aeef227d70ef0258db02c422badfe4c826a3e0f4..f635c2a3e5806abda5501e9da850518604b8b4b2 100644 |
--- a/src/core/SkPathRef.cpp |
+++ b/src/core/SkPathRef.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "SkBuffer.h" |
+#include "SkOnce.h" |
#include "SkPath.h" |
#include "SkPathRef.h" |
@@ -36,6 +37,18 @@ SkPoint* SkPathRef::Editor::growForConic(SkScalar w) { |
} |
////////////////////////////////////////////////////////////////////////////// |
+void SkPathRef::CreateEmptyImpl(SkPathRef** empty) { |
+ *empty = SkNEW(SkPathRef); |
+ (*empty)->computeBounds(); // Preemptively avoid a race to clear fBoundsIsDirty. |
+} |
+ |
+SkPathRef* SkPathRef::CreateEmpty() { |
+ static SkPathRef* gEmptyPathRef; |
+ SK_DECLARE_STATIC_ONCE(once); |
+ SkOnce(&once, SkPathRef::CreateEmptyImpl, &gEmptyPathRef); |
+ return SkRef(gEmptyPathRef); |
+} |
+ |
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, |
const SkPathRef& src, |
const SkMatrix& matrix) { |