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 | 12 |
13 class SkBitmap; | 13 class SkBitmap; |
14 class SkWStream; | 14 class SkWStream; |
15 | 15 |
16 class SkImageEncoder { | 16 class SkImageEncoder { |
17 public: | 17 public: |
18 enum Type { | 18 enum Type { |
19 kJPEG_Type, | 19 kJPEG_Type, |
20 kPNG_Type | 20 kPNG_Type, |
| 21 kWEBP_Type |
21 }; | 22 }; |
22 static SkImageEncoder* Create(Type); | 23 static SkImageEncoder* Create(Type); |
23 | 24 |
24 virtual ~SkImageEncoder(); | 25 virtual ~SkImageEncoder(); |
25 | 26 |
26 /* Quality ranges from 0..100 */ | 27 /* Quality ranges from 0..100 */ |
27 enum { | 28 enum { |
28 kDefaultQuality = 80 | 29 kDefaultQuality = 80 |
29 }; | 30 }; |
30 | 31 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // encoder implementation that registers with the encoder factory must call it. | 74 // encoder implementation that registers with the encoder factory must call it. |
74 #define DEFINE_ENCODER_CREATOR(codec) \ | 75 #define DEFINE_ENCODER_CREATOR(codec) \ |
75 SkImageEncoder *Create ## codec () { \ | 76 SkImageEncoder *Create ## codec () { \ |
76 return SkNEW( Sk ## codec ); \ | 77 return SkNEW( Sk ## codec ); \ |
77 } | 78 } |
78 | 79 |
79 // All the encoders known by Skia. Note that, depending on the compiler settings
, | 80 // All the encoders known by Skia. Note that, depending on the compiler settings
, |
80 // not all of these will be available | 81 // not all of these will be available |
81 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); | 82 DECLARE_ENCODER_CREATOR(JPEGImageEncoder); |
82 DECLARE_ENCODER_CREATOR(PNGImageEncoder); | 83 DECLARE_ENCODER_CREATOR(PNGImageEncoder); |
| 84 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); |
83 | 85 |
84 #endif | 86 #endif |
OLD | NEW |