aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/images/SkImageEncoder.h
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-23 18:13:47 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-23 18:13:47 +0000
commitec51cb863409e238b40c5beef458669d9a824481 (patch)
tree224efaf870e226bf8f95612ab3dda9bc03284ae8 /include/images/SkImageEncoder.h
parent34f10260adb55301572d4e67414b747c83ee015a (diff)
Improved codec link-forcing system by adding Encoder/Decoder creation entry points
Diffstat (limited to 'include/images/SkImageEncoder.h')
-rw-r--r--include/images/SkImageEncoder.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/images/SkImageEncoder.h b/include/images/SkImageEncoder.h
index b2f8cb67cc..907e28b9de 100644
--- a/include/images/SkImageEncoder.h
+++ b/include/images/SkImageEncoder.h
@@ -40,4 +40,21 @@ protected:
virtual bool onEncode(SkWStream*, const SkBitmap&, int quality) = 0;
};
+// This macro declares a global (i.e., non-class owned) creation entry point
+// for each encoder (e.g., CreateJPEGImageEncoder)
+#define DECLARE_ENCODER_CREATOR(codec) \
+ SkImageEncoder *Create ## codec ();
+
+// This macro defines the global creation entry point for each encoder. Each
+// encoder implementation that registers with the encoder factory must call it.
+#define DEFINE_ENCODER_CREATOR(codec) \
+ SkImageEncoder *Create ## codec () { \
+ return SkNEW( Sk ## codec ); \
+ }
+
+// All the encoders known by Skia. Note that, depending on the compiler settings,
+// not all of these will be available
+DECLARE_ENCODER_CREATOR(JPEGImageEncoder);
+DECLARE_ENCODER_CREATOR(PNGImageEncoder);
+
#endif