| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } else { | 268 } else { |
| 269 config = SkColorTypeToBitmapConfig(opts.fRequestedColorType); | 269 config = SkColorTypeToBitmapConfig(opts.fRequestedColorType); |
| 270 if (!bitmap.canCopyTo(config)) { | 270 if (!bitmap.canCopyTo(config)) { |
| 271 SkASSERT(bitmap.config() != config); | 271 SkASSERT(bitmap.config() != config); |
| 272 return NULL; // Can not translate to needed config. | 272 return NULL; // Can not translate to needed config. |
| 273 } | 273 } |
| 274 info.fWidth = bitmap.width(); | 274 info.fWidth = bitmap.width(); |
| 275 info.fHeight = bitmap.height(); | 275 info.fHeight = bitmap.height(); |
| 276 info.fColorType = opts.fRequestedColorType; | 276 info.fColorType = opts.fRequestedColorType; |
| 277 info.fAlphaType = bitmap.alphaType(); | 277 info.fAlphaType = bitmap.alphaType(); |
| 278 | |
| 279 // Sanity check. | |
| 280 SkDEBUGCODE(SkColorType tmp;) | |
| 281 SkASSERT(SkBitmapConfigToColorType(config, &tmp)); | |
| 282 SkASSERT(tmp == opts.fRequestedColorType); | |
| 283 } | 278 } |
| 284 return SkNEW_ARGS(SkDecodingImageGenerator, | 279 return SkNEW_ARGS(SkDecodingImageGenerator, |
| 285 (data, autoStream.detach(), info, | 280 (data, autoStream.detach(), info, |
| 286 opts.fSampleSize, opts.fDitherImage, config)); | 281 opts.fSampleSize, opts.fDitherImage, config)); |
| 287 } | 282 } |
| OLD | NEW |