OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 */ | 102 */ |
103 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | 103 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
104 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { | 104 bool onGetInfo(SkImageInfo* info) SK_OVERRIDE { |
105 *info = fInfo; | 105 *info = fInfo; |
106 return true; | 106 return true; |
107 } | 107 } |
108 #endif | 108 #endif |
109 | 109 |
110 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { | 110 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { |
111 // By default, scaling is not supported. | 111 // By default, scaling is not supported. |
| 112 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
112 return fInfo.dimensions(); | 113 return fInfo.dimensions(); |
| 114 #else |
| 115 return this->getInfo().dimensions(); |
| 116 #endif |
113 } | 117 } |
114 | 118 |
115 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 119 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
116 | 120 |
117 /** | 121 /** |
118 * Override if your codec supports scanline decoding. | 122 * Override if your codec supports scanline decoding. |
119 * | 123 * |
120 * No need to call rewindIfNeeded(), which will have already been called | 124 * No need to call rewindIfNeeded(), which will have already been called |
121 * by the base class. | 125 * by the base class. |
122 * | 126 * |
(...skipping 26 matching lines...) Expand all Loading... |
149 /* | 153 /* |
150 * | 154 * |
151 * Get method for the input stream | 155 * Get method for the input stream |
152 * | 156 * |
153 */ | 157 */ |
154 SkStream* stream() { | 158 SkStream* stream() { |
155 return fStream.get(); | 159 return fStream.get(); |
156 } | 160 } |
157 | 161 |
158 private: | 162 private: |
| 163 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
159 const SkImageInfo fInfo; | 164 const SkImageInfo fInfo; |
| 165 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO |
160 SkAutoTDelete<SkStream> fStream; | 166 SkAutoTDelete<SkStream> fStream; |
161 bool fNeedsRewind; | 167 bool fNeedsRewind; |
162 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 168 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; |
163 | 169 |
164 typedef SkImageGenerator INHERITED; | 170 typedef SkImageGenerator INHERITED; |
165 }; | 171 }; |
166 #endif // SkCodec_DEFINED | 172 #endif // SkCodec_DEFINED |
OLD | NEW |