Index: src/core/SkImageGenerator.cpp |
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp |
index 7da4d40b0ce1da0cb84671b33b78311f0c6982d6..8c9ff6a03515a455b1130f4c76a6a92c7a7fed7b 100644 |
--- a/src/core/SkImageGenerator.cpp |
+++ b/src/core/SkImageGenerator.cpp |
@@ -135,22 +135,22 @@ bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb |
#include "SkGraphics.h" |
-static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFactory; |
- |
-SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEncodedFactory() { |
- return gImageGeneratorFromEncodedFactory; |
-} |
- |
-void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory) { |
- gImageGeneratorFromEncodedFactory = factory; |
+static SkGraphics::ImageGeneratorFromEncodedFactory gFactory; |
+ |
+SkGraphics::ImageGeneratorFromEncodedFactory |
+SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory) |
+{ |
+ ImageGeneratorFromEncodedFactory prev = gFactory; |
+ gFactory = factory; |
+ return prev; |
} |
SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) { |
if (NULL == data) { |
return NULL; |
} |
- if (gImageGeneratorFromEncodedFactory) { |
- if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data)) { |
+ if (gFactory) { |
+ if (SkImageGenerator* generator = gFactory(data)) { |
return generator; |
} |
} |