| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkImageEncoder_DEFINED | 8 #ifndef SkImageEncoder_DEFINED |
| 9 #define SkImageEncoder_DEFINED | 9 #define SkImageEncoder_DEFINED |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 * range 0-100). | 84 * range 0-100). |
| 85 * | 85 * |
| 86 * This must be overridden by each SkImageEncoder implementation. | 86 * This must be overridden by each SkImageEncoder implementation. |
| 87 */ | 87 */ |
| 88 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) =
0; | 88 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) =
0; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 // This macro declares a global (i.e., non-class owned) creation entry point | 91 // This macro declares a global (i.e., non-class owned) creation entry point |
| 92 // for each encoder (e.g., CreateJPEGImageEncoder) | 92 // for each encoder (e.g., CreateJPEGImageEncoder) |
| 93 #define DECLARE_ENCODER_CREATOR(codec) \ | 93 #define DECLARE_ENCODER_CREATOR(codec) \ |
| 94 SkImageEncoder *Create ## codec (); | 94 SK_API SkImageEncoder *Create ## codec (); |
| 95 | 95 |
| 96 // This macro defines the global creation entry point for each encoder. Each | 96 // This macro defines the global creation entry point for each encoder. Each |
| 97 // encoder implementation that registers with the encoder factory must call it. | 97 // encoder implementation that registers with the encoder factory must call it. |
| 98 #define DEFINE_ENCODER_CREATOR(codec) \ | 98 #define DEFINE_ENCODER_CREATOR(codec) \ |
| 99 SkImageEncoder* Create##codec() { return new Sk##codec; } | 99 SkImageEncoder* Create##codec() { return new Sk##codec; } |
| 100 | 100 |
| 101 // All the encoders known by Skia. Note that, depending on the compiler settings
, | 101 // All the encoders known by Skia. Note that, depending on the compiler settings
, |
| 102 // not all of these will be available | 102 // not all of these will be available |
| 103 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); | 103 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); |
| 104 DECLARE_ENCODER_CREATOR(PNGImageEncoder); | 104 DECLARE_ENCODER_CREATOR(PNGImageEncoder); |
| 105 DECLARE_ENCODER_CREATOR(KTXImageEncoder); | 105 DECLARE_ENCODER_CREATOR(KTXImageEncoder); |
| 106 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); | 106 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); |
| 107 | 107 |
| 108 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 108 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 109 SkImageEncoder* CreateImageEncoder_CG(SkImageEncoder::Type type); | 109 SkImageEncoder* CreateImageEncoder_CG(SkImageEncoder::Type type); |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 #if defined(SK_BUILD_FOR_WIN) | 112 #if defined(SK_BUILD_FOR_WIN) |
| 113 SkImageEncoder* CreateImageEncoder_WIC(SkImageEncoder::Type type); | 113 SkImageEncoder* CreateImageEncoder_WIC(SkImageEncoder::Type type); |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 // Typedef to make registering encoder callback easier | 116 // Typedef to make registering encoder callback easier |
| 117 // This has to be defined outside SkImageEncoder. :( | 117 // This has to be defined outside SkImageEncoder. :( |
| 118 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; | 118 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; |
| 119 #endif | 119 #endif |
| OLD | NEW |