| 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 SkAndroidCodec_DEFINED | 8 #ifndef SkAndroidCodec_DEFINED |
| 9 #define SkAndroidCodec_DEFINED | 9 #define SkAndroidCodec_DEFINED |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 * If this data represents an encoded image that we know how to decode, | 35 * If this data represents an encoded image that we know how to decode, |
| 36 * return an SkAndroidCodec that can decode it. Otherwise return NULL. | 36 * return an SkAndroidCodec that can decode it. Otherwise return NULL. |
| 37 * | 37 * |
| 38 * The SkPngChunkReader handles unknown chunks in PNGs. | 38 * The SkPngChunkReader handles unknown chunks in PNGs. |
| 39 * See SkCodec.h for more details. | 39 * See SkCodec.h for more details. |
| 40 * | 40 * |
| 41 * Will take a ref if it returns a codec, else will not affect the data. | 41 * Will take a ref if it returns a codec, else will not affect the data. |
| 42 */ | 42 */ |
| 43 static SkAndroidCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 43 static SkAndroidCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); |
| 44 | 44 |
| 45 /** |
| 46 * @param requestedColorType Color type requested by the client |
| 47 * @param suggestedColorType Color type suggested by SkAndroidCodec |
| 48 * @param suggestedAlphaType Alpha type suggested by SkAndroidCodec |
| 49 * |
| 50 * @return If it is possible to decode to requestedColorType, this returns |
| 51 * requestedColorType. Otherwise, this returns kN32_SkColorType. |
| 52 */ |
| 53 static SkColorType FixRequestedColorType(SkColorType requestedColorType, |
| 54 SkColorType suggestedColorType, SkAlphaType suggestedAlphaType); |
| 55 |
| 56 /** |
| 57 * @param requestedUnpremul Indicates if the client requested |
| 58 * unpremultiplied output |
| 59 * @param suggestedAlphaType Alpha type suggested by SkAndroidCodec |
| 60 * |
| 61 * @return Returns the appropriate alpha type to decode to. If the image |
| 62 * has alpha, the value of requestedUnpremul will be honored. |
| 63 */ |
| 64 static SkAlphaType FixRequestedAlphaType(bool requestedUnpremul, |
| 65 SkAlphaType suggestedAlphaType); |
| 66 |
| 45 virtual ~SkAndroidCodec() {} | 67 virtual ~SkAndroidCodec() {} |
| 46 | 68 |
| 47 | 69 |
| 48 const SkImageInfo& getInfo() const { return fInfo; } | 70 const SkImageInfo& getInfo() const { return fInfo; } |
| 49 | 71 |
| 50 /** | 72 /** |
| 51 * Format of the encoded data. | 73 * Format of the encoded data. |
| 52 */ | 74 */ |
| 53 SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat()
; } | 75 SkEncodedFormat getEncodedFormat() const { return this->onGetEncodedFormat()
; } |
| 54 | 76 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, | 243 virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pi
xels, |
| 222 size_t rowBytes, const AndroidOptions& options) = 0; | 244 size_t rowBytes, const AndroidOptions& options) = 0; |
| 223 | 245 |
| 224 private: | 246 private: |
| 225 | 247 |
| 226 // This will always be a reference to the info that is contained by the | 248 // This will always be a reference to the info that is contained by the |
| 227 // embedded SkCodec. | 249 // embedded SkCodec. |
| 228 const SkImageInfo& fInfo; | 250 const SkImageInfo& fInfo; |
| 229 }; | 251 }; |
| 230 #endif // SkAndroidCodec_DEFINED | 252 #endif // SkAndroidCodec_DEFINED |
| OLD | NEW |