Index: src/pdf/SkPDFShader.cpp |
diff --git a/src/pdf/SkPDFShader.cpp b/src/pdf/SkPDFShader.cpp |
index fe6e47c1db0f049307969097919a9426c72788c8..645091dad2fe33b3d82a84fe8a728d37232989c4 100644 |
--- a/src/pdf/SkPDFShader.cpp |
+++ b/src/pdf/SkPDFShader.cpp |
@@ -10,7 +10,6 @@ |
#include "SkPDFShader.h" |
#include "SkData.h" |
-#include "SkOncePtr.h" |
#include "SkPDFCanon.h" |
#include "SkPDFDevice.h" |
#include "SkPDFFormXObject.h" |
@@ -678,7 +677,8 @@ |
return true; |
} |
-static SkPDFObject* create_range_object() { |
+namespace { |
+SkPDFObject* create_range_object() { |
SkPDFArray* range = new SkPDFArray; |
range->reserve(6); |
range->appendInt(0); |
@@ -689,7 +689,12 @@ |
range->appendInt(1); |
return range; |
} |
-SK_DECLARE_STATIC_ONCE_PTR(SkPDFObject, rangeObject); |
+ |
+template <typename T> void unref(T* ptr) { ptr->unref();} |
+} // namespace |
+ |
+SK_DECLARE_STATIC_LAZY_PTR(SkPDFObject, rangeObject, |
+ create_range_object, unref<SkPDFObject>); |
static SkPDFStream* make_ps_function(const SkString& psCode, |
SkPDFArray* domain) { |
@@ -698,7 +703,7 @@ |
SkPDFStream* result = new SkPDFStream(funcData.get()); |
result->insertInt("FunctionType", 4); |
result->insertObject("Domain", SkRef(domain)); |
- result->insertObject("Range", SkRef(rangeObject.get(create_range_object))); |
+ result->insertObject("Range", SkRef(rangeObject.get())); |
return result; |
} |