| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 * is undefined. | 104 * is undefined. |
| 105 * FIXME: see skbug.com/3582. | 105 * FIXME: see skbug.com/3582. |
| 106 */ | 106 */ |
| 107 bool reallyHasAlpha() const { | 107 bool reallyHasAlpha() const { |
| 108 return this->onReallyHasAlpha(); | 108 return this->onReallyHasAlpha(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 protected: | 111 protected: |
| 112 SkCodec(const SkImageInfo&, SkStream*); | 112 SkCodec(const SkImageInfo&, SkStream*); |
| 113 | 113 |
| 114 /** | |
| 115 * The SkAlphaType is a conservative answer. i.e. it is possible that it | |
| 116 * initially returns a non-opaque answer, but completing the decode | |
| 117 * reveals that the image is actually opaque. | |
| 118 */ | |
| 119 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 120 bool onGetInfo(SkImageInfo* info) override { | |
| 121 *info = fInfo; | |
| 122 return true; | |
| 123 } | |
| 124 #endif | |
| 125 | |
| 126 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { | 114 virtual SkISize onGetScaledDimensions(float /* desiredScale */) const { |
| 127 // By default, scaling is not supported. | 115 // By default, scaling is not supported. |
| 128 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 129 return fInfo.dimensions(); | |
| 130 #else | |
| 131 return this->getInfo().dimensions(); | 116 return this->getInfo().dimensions(); |
| 132 #endif | |
| 133 } | 117 } |
| 134 | 118 |
| 135 virtual SkEncodedFormat onGetEncodedFormat() const = 0; | 119 virtual SkEncodedFormat onGetEncodedFormat() const = 0; |
| 136 | 120 |
| 137 /** | 121 /** |
| 138 * Override if your codec supports scanline decoding. | 122 * Override if your codec supports scanline decoding. |
| 139 * | 123 * |
| 140 * As in onGetPixels(), the implementation must call rewindIfNeeded() and | 124 * As in onGetPixels(), the implementation must call rewindIfNeeded() and |
| 141 * handle as appropriate. | 125 * handle as appropriate. |
| 142 * | 126 * |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 /* | 171 /* |
| 188 * | 172 * |
| 189 * Get method for the input stream | 173 * Get method for the input stream |
| 190 * | 174 * |
| 191 */ | 175 */ |
| 192 SkStream* stream() { | 176 SkStream* stream() { |
| 193 return fStream.get(); | 177 return fStream.get(); |
| 194 } | 178 } |
| 195 | 179 |
| 196 private: | 180 private: |
| 197 #ifdef SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 198 const SkImageInfo fInfo; | |
| 199 #endif // SK_SUPPORT_LEGACY_BOOL_ONGETINFO | |
| 200 SkAutoTDelete<SkStream> fStream; | 181 SkAutoTDelete<SkStream> fStream; |
| 201 bool fNeedsRewind; | 182 bool fNeedsRewind; |
| 202 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 183 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; |
| 203 | 184 |
| 204 typedef SkImageGenerator INHERITED; | 185 typedef SkImageGenerator INHERITED; |
| 205 }; | 186 }; |
| 206 #endif // SkCodec_DEFINED | 187 #endif // SkCodec_DEFINED |
| OLD | NEW |