| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #ifndef SkImageEncoder_DEFINED | 8 #ifndef SkImageEncoder_DEFINED |
| 9 #define SkImageEncoder_DEFINED | 9 #define SkImageEncoder_DEFINED |
| 10 | 10 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 #include "SkTRegistry.h" | 12 #include "SkTRegistry.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkData; | 15 class SkData; |
| 16 class SkWStream; | 16 class SkWStream; |
| 17 | 17 |
| 18 class SkImageEncoder { | 18 class SkImageEncoder { |
| 19 public: | 19 public: |
| 20 enum Type { | 20 enum Type { |
| 21 kUnknown_Type, | 21 kUnknown_Type, |
| 22 kBMP_Type, | 22 kBMP_Type, |
| 23 kGIF_Type, | 23 kGIF_Type, |
| 24 kICO_Type, | 24 kICO_Type, |
| 25 kJPEG_Type, | 25 kJPEG_Type, |
| 26 kPNG_Type, | 26 kPNG_Type, |
| 27 kWBMP_Type, | 27 kWBMP_Type, |
| 28 kWEBP_Type, | 28 kWEBP_Type, |
| 29 kKTX_Type, |
| 29 }; | 30 }; |
| 30 static SkImageEncoder* Create(Type); | 31 static SkImageEncoder* Create(Type); |
| 31 | 32 |
| 32 virtual ~SkImageEncoder(); | 33 virtual ~SkImageEncoder(); |
| 33 | 34 |
| 34 /* Quality ranges from 0..100 */ | 35 /* Quality ranges from 0..100 */ |
| 35 enum { | 36 enum { |
| 36 kDefaultQuality = 80 | 37 kDefaultQuality = 80 |
| 37 }; | 38 }; |
| 38 | 39 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 // All the encoders known by Skia. Note that, depending on the compiler settings
, | 91 // All the encoders known by Skia. Note that, depending on the compiler settings
, |
| 91 // not all of these will be available | 92 // not all of these will be available |
| 92 /** An ARGBImageEncoder will always write out | 93 /** An ARGBImageEncoder will always write out |
| 93 * bitmap.width() * bitmap.height() * 4 | 94 * bitmap.width() * bitmap.height() * 4 |
| 94 * bytes. | 95 * bytes. |
| 95 */ | 96 */ |
| 96 DECLARE_ENCODER_CREATOR(ARGBImageEncoder); | 97 DECLARE_ENCODER_CREATOR(ARGBImageEncoder); |
| 97 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); | 98 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); |
| 98 DECLARE_ENCODER_CREATOR(PNGImageEncoder); | 99 DECLARE_ENCODER_CREATOR(PNGImageEncoder); |
| 100 DECLARE_ENCODER_CREATOR(KTXImageEncoder); |
| 99 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); | 101 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); |
| 100 | 102 |
| 101 // Typedef to make registering encoder callback easier | 103 // Typedef to make registering encoder callback easier |
| 102 // This has to be defined outside SkImageEncoder. :( | 104 // This has to be defined outside SkImageEncoder. :( |
| 103 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; | 105 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc
odeReg; |
| 104 #endif | 106 #endif |
| OLD | NEW |