aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-07-09 11:47:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-09 11:47:36 -0700
commit1c84634454aa78fb26f23875b86a243aa4596c59 (patch)
treeced1b33e730a196a7ad6fb9721543af9b62f3565 /include
parent3547505278f5f9fe9602ec767c20d461f7a5dab6 (diff)
add runtime option to provide data->imagegenerator factory
Diffstat (limited to 'include')
-rw-r--r--include/core/SkGraphics.h13
-rw-r--r--include/core/SkImageGenerator.h4
2 files changed, 16 insertions, 1 deletions
diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h
index ea74c586d2..e552633d5f 100644
--- a/include/core/SkGraphics.h
+++ b/include/core/SkGraphics.h
@@ -10,6 +10,9 @@
#include "SkTypes.h"
+class SkData;
+class SkImageGenerator;
+
class SK_API SkGraphics {
public:
/**
@@ -140,6 +143,16 @@ public:
* global font cache.
*/
static void SetTLSFontCacheLimit(size_t bytes);
+
+ typedef SkImageGenerator* (*ImageGeneratorFromEncodedFactory)(SkData*);
+
+ /**
+ * To instantiate images from encoded data, first looks at this runtime function-ptr. If it
+ * exists, it is called to create an SkImageGenerator from SkData. If there is no function-ptr
+ * or there is, but it returns NULL, then skia will call its internal default implementation.
+ */
+ static ImageGeneratorFromEncodedFactory GetImageGeneratorFromEncodedFactory();
+ static void SetImageGeneratorFromEncodedFactory(ImageGeneratorFromEncodedFactory);
};
class SkAutoGraphics {
diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h
index a398697e6b..46001c8537 100644
--- a/include/core/SkImageGenerator.h
+++ b/include/core/SkImageGenerator.h
@@ -199,7 +199,7 @@ public:
* this returns a new ImageGenerator for it. Otherwise this returns NULL. Either way
* the caller is still responsible for managing their ownership of the data.
*/
- static SkImageGenerator* NewFromData(SkData*);
+ static SkImageGenerator* NewFromEncoded(SkData*);
protected:
SkImageGenerator(const SkImageInfo& info) : fInfo(info) {}
@@ -220,6 +220,8 @@ protected:
private:
const SkImageInfo fInfo;
+
+ static SkImageGenerator* NewFromEncodedImpl(SkData*);
};
#endif // SkImageGenerator_DEFINED