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

Unified Diff: src/core/SkImageGenerator.cpp

Issue 1223413002: remove getter for imagegenerator factory, update test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: document that SkData will never be null Created 5 years, 5 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 | « include/core/SkImageGenerator.h ('k') | tests/ImageGeneratorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | tests/ImageGeneratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698