OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkDecodingImageGenerator.h" | 9 #include "SkDecodingImageGenerator.h" |
10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return NULL; | 235 return NULL; |
236 } | 236 } |
237 | 237 |
238 SkImageInfo info = bitmap.info(); | 238 SkImageInfo info = bitmap.info(); |
239 | 239 |
240 if (!opts.fUseRequestedColorType) { | 240 if (!opts.fUseRequestedColorType) { |
241 // Use default | 241 // Use default |
242 if (kIndex_8_SkColorType == bitmap.colorType()) { | 242 if (kIndex_8_SkColorType == bitmap.colorType()) { |
243 // We don't support kIndex8 because we don't support | 243 // We don't support kIndex8 because we don't support |
244 // colortables in this workflow. | 244 // colortables in this workflow. |
245 info.fColorType = kN32_SkColorType; | 245 info.fColorType = kPMColor_SkColorType; |
246 } | 246 } |
247 } else { | 247 } else { |
248 if (!bitmap.canCopyTo(opts.fRequestedColorType)) { | 248 if (!bitmap.canCopyTo(opts.fRequestedColorType)) { |
249 SkASSERT(bitmap.colorType() != opts.fRequestedColorType); | 249 SkASSERT(bitmap.colorType() != opts.fRequestedColorType); |
250 return NULL; // Can not translate to needed config. | 250 return NULL; // Can not translate to needed config. |
251 } | 251 } |
252 info.fColorType = opts.fRequestedColorType; | 252 info.fColorType = opts.fRequestedColorType; |
253 } | 253 } |
254 | 254 |
255 if (opts.fRequireUnpremul && info.fAlphaType != kOpaque_SkAlphaType) { | 255 if (opts.fRequireUnpremul && info.fAlphaType != kOpaque_SkAlphaType) { |
(...skipping 25 matching lines...) Expand all Loading... |
281 SkStreamRewindable* stream, | 281 SkStreamRewindable* stream, |
282 const SkDecodingImageGenerator::Options& opts) { | 282 const SkDecodingImageGenerator::Options& opts) { |
283 SkASSERT(stream != NULL); | 283 SkASSERT(stream != NULL); |
284 SkASSERT(stream->unique()); | 284 SkASSERT(stream->unique()); |
285 if ((stream == NULL) || !stream->unique()) { | 285 if ((stream == NULL) || !stream->unique()) { |
286 SkSafeUnref(stream); | 286 SkSafeUnref(stream); |
287 return NULL; | 287 return NULL; |
288 } | 288 } |
289 return CreateDecodingImageGenerator(NULL, stream, opts); | 289 return CreateDecodingImageGenerator(NULL, stream, opts); |
290 } | 290 } |
OLD | NEW |