Index: src/core/SkMiniRecorder.cpp |
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp |
index 378f4304b392d682038362cede3babc698d04b3f..2d5b0943e58eb646e767d782017bcc431d67449f 100644 |
--- a/src/core/SkMiniRecorder.cpp |
+++ b/src/core/SkMiniRecorder.cpp |
@@ -8,7 +8,7 @@ |
#include "SkCanvas.h" |
#include "SkTLazy.h" |
#include "SkMiniRecorder.h" |
-#include "SkOnce.h" |
+#include "SkOncePtr.h" |
#include "SkPicture.h" |
#include "SkPictureCommon.h" |
#include "SkRecordDraw.h" |
@@ -27,6 +27,7 @@ |
int numSlowPaths() const override { return 0; } |
bool willPlayBackBitmaps() const override { return false; } |
}; |
+SK_DECLARE_STATIC_ONCE_PTR(SkEmptyPicture, gEmptyPicture); |
template <typename T> |
class SkMiniPicture final : public SkPicture { |
@@ -106,13 +107,8 @@ |
fState = State::kEmpty; \ |
return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBuffer.get())) |
- static SkOnce once; |
- static SkPicture* empty; |
- |
switch (fState) { |
- case State::kEmpty: |
- once([]{ empty = new SkEmptyPicture; }); |
- return sk_ref_sp(empty); |
+ case State::kEmpty: return sk_ref_sp(gEmptyPicture.get([]{ return new SkEmptyPicture; })); |
CASE(DrawBitmapRectFixedSize); |
CASE(DrawPath); |
CASE(DrawRect); |