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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #define DECLARE_ENCODER_CREATOR(codec) \ | 93 #define DECLARE_ENCODER_CREATOR(codec) \ |
94 SkImageEncoder *Create ## codec (); | 94 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 /** An ARGBImageEncoder will always write out | |
104 * bitmap.width() * bitmap.height() * 4 | |
105 * bytes. | |
106 */ | |
107 DECLARE_ENCODER_CREATOR(ARGBImageEncoder); | |
108 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); | 103 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); |
109 DECLARE_ENCODER_CREATOR(PNGImageEncoder); | 104 DECLARE_ENCODER_CREATOR(PNGImageEncoder); |
110 DECLARE_ENCODER_CREATOR(KTXImageEncoder); | 105 DECLARE_ENCODER_CREATOR(KTXImageEncoder); |
111 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); | 106 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); |
112 | 107 |
113 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 108 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
114 DECLARE_ENCODER_CREATOR(PNGImageEncoder_CG); | 109 DECLARE_ENCODER_CREATOR(PNGImageEncoder_CG); |
115 #endif | 110 #endif |
116 | 111 |
117 #if defined(SK_BUILD_FOR_WIN) | 112 #if defined(SK_BUILD_FOR_WIN) |
118 DECLARE_ENCODER_CREATOR(ImageEncoder_WIC); | 113 DECLARE_ENCODER_CREATOR(ImageEncoder_WIC); |
119 #endif | 114 #endif |
120 | 115 |
121 // Typedef to make registering encoder callback easier | 116 // Typedef to make registering encoder callback easier |
122 // This has to be defined outside SkImageEncoder. :( | 117 // This has to be defined outside SkImageEncoder. :( |
123 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; | 118 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; |
124 #endif | 119 #endif |
OLD | NEW |