Simplify font-chaining (fallbacks) to have fonthost just return the next
logical fontID.
Extend ImageRef to accept an imagedecoder factory, to replace calling the std
one.
git-svn-id: http://skia.googlecode.com/svn/trunk@125 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/images/SkImageDecoder.h b/include/images/SkImageDecoder.h
index 3ea6198..c85a7cd 100644
--- a/include/images/SkImageDecoder.h
+++ b/include/images/SkImageDecoder.h
@@ -147,7 +147,7 @@
If none is found, the method returns NULL.
*/
static SkImageDecoder* Factory(SkStream*);
-
+
/** Decode the image stored in the specified file, and store the result
in bitmap. Return true for success or false on failure.
@@ -260,4 +260,24 @@
SkImageDecoder& operator=(const SkImageDecoder&);
};
+/** Calling newDecoder with a stream returns a new matching imagedecoder
+ instance, or NULL if none can be found. The caller must manage its ownership
+ of the stream as usual, calling unref() when it is done, as the returned
+ decoder may have called ref() (and if so, the decoder is responsible for
+ balancing its ownership when it is destroyed).
+ */
+class SkImageDecoderFactory : public SkRefCnt {
+public:
+ virtual SkImageDecoder* newDecoder(SkStream*) = 0;
+};
+
+class SkDefaultImageDecoderFactory : SkImageDecoderFactory {
+public:
+ // calls SkImageDecoder::Factory(stream)
+ virtual SkImageDecoder* newDecoder(SkStream* stream) {
+ return SkImageDecoder::Factory(stream);
+ }
+};
+
+
#endif