diff options
author | reed <reed@google.com> | 2015-07-09 11:47:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-09 11:47:36 -0700 |
commit | 1c84634454aa78fb26f23875b86a243aa4596c59 (patch) | |
tree | ced1b33e730a196a7ad6fb9721543af9b62f3565 /include | |
parent | 3547505278f5f9fe9602ec767c20d461f7a5dab6 (diff) |
add runtime option to provide data->imagegenerator factory
BUG=skia:
Review URL: https://codereview.chromium.org/1229933003
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkGraphics.h | 13 | ||||
-rw-r--r-- | include/core/SkImageGenerator.h | 4 |
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 |