| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "SkEndian.h" | 8 #include "SkEndian.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const int depth = read_24bit(buf + 6); | 110 const int depth = read_24bit(buf + 6); |
| 111 | 111 |
| 112 if (1 != depth) { | 112 if (1 != depth) { |
| 113 // We don't support decoding 3D. | 113 // We don't support decoding 3D. |
| 114 return kFailure; | 114 return kFailure; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Advance the buffer past the image dimensions | 117 // Advance the buffer past the image dimensions |
| 118 buf += 9; | 118 buf += 9; |
| 119 | 119 |
| 120 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER | |
| 121 // should we allow the Chooser (if present) to pick a config for us??? | |
| 122 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) { | |
| 123 return kFailure; | |
| 124 } | |
| 125 #endif | |
| 126 | |
| 127 // Setup the sampler... | 120 // Setup the sampler... |
| 128 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); | 121 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); |
| 129 | 122 |
| 130 // Determine the alpha of the bitmap... | 123 // Determine the alpha of the bitmap... |
| 131 SkAlphaType alphaType = kOpaque_SkAlphaType; | 124 SkAlphaType alphaType = kOpaque_SkAlphaType; |
| 132 if (this->getRequireUnpremultipliedColors()) { | 125 if (this->getRequireUnpremultipliedColors()) { |
| 133 alphaType = kUnpremul_SkAlphaType; | 126 alphaType = kUnpremul_SkAlphaType; |
| 134 } else { | 127 } else { |
| 135 alphaType = kPremul_SkAlphaType; | 128 alphaType = kPremul_SkAlphaType; |
| 136 } | 129 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory); | 194 static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory); |
| 202 | 195 |
| 203 static SkImageDecoder::Format get_format_astc(SkStreamRewindable* stream) { | 196 static SkImageDecoder::Format get_format_astc(SkStreamRewindable* stream) { |
| 204 if (is_astc(stream)) { | 197 if (is_astc(stream)) { |
| 205 return SkImageDecoder::kASTC_Format; | 198 return SkImageDecoder::kASTC_Format; |
| 206 } | 199 } |
| 207 return SkImageDecoder::kUnknown_Format; | 200 return SkImageDecoder::kUnknown_Format; |
| 208 } | 201 } |
| 209 | 202 |
| 210 static SkImageDecoder_FormatReg gFormatReg(get_format_astc); | 203 static SkImageDecoder_FormatReg gFormatReg(get_format_astc); |
| OLD | NEW |