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

Unified Diff: src/core/SkImageGenerator.cpp

Issue 1229933003: add runtime option to provide data->imagegenerator factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: src/core/SkImageGenerator.cpp
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index b4a3fc21c8ae835a7adfc77854e7d65ead5bcd38..7da4d40b0ce1da0cb84671b33b78311f0c6982d6 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -130,3 +130,29 @@ bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
return false;
}
#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "SkGraphics.h"
+
+static SkGraphics::ImageGeneratorFromEncodedFactory gImageGeneratorFromEncodedFactory;
+
+SkGraphics::ImageGeneratorFromEncodedFactory SkGraphics::GetImageGeneratorFromEncodedFactory() {
+ return gImageGeneratorFromEncodedFactory;
+}
+
+void SkGraphics::SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory factory) {
+ gImageGeneratorFromEncodedFactory = factory;
+}
+
+SkImageGenerator* SkImageGenerator::NewFromEncoded(SkData* data) {
+ if (NULL == data) {
+ return NULL;
+ }
+ if (gImageGeneratorFromEncodedFactory) {
+ if (SkImageGenerator* generator = gImageGeneratorFromEncodedFactory(data)) {
+ return generator;
+ }
+ }
+ return SkImageGenerator::NewFromEncodedImpl(data);
+}

Powered by Google App Engine
This is Rietveld 408576698