| 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 switch (format) { | 48 switch (format) { |
| 49 case SkImageDecoder::kPNG_Format: | 49 case SkImageDecoder::kPNG_Format: |
| 50 case SkImageDecoder::kWEBP_Format: | 50 case SkImageDecoder::kWEBP_Format: |
| 51 return false; | 51 return false; |
| 52 // Skip unknown since it will not be decoded anyway. | 52 // Skip unknown since it will not be decoded anyway. |
| 53 case SkImageDecoder::kUnknown_Format: | 53 case SkImageDecoder::kUnknown_Format: |
| 54 // Technically ICO and BMP supports alpha channels, but our image | 54 // Technically ICO and BMP supports alpha channels, but our image |
| 55 // decoders do not, so skip them as well. | 55 // decoders do not, so skip them as well. |
| 56 case SkImageDecoder::kICO_Format: | 56 case SkImageDecoder::kICO_Format: |
| 57 case SkImageDecoder::kBMP_Format: | 57 case SkImageDecoder::kBMP_Format: |
| 58 // KTX and ASTC are texture formats so it's not particularly clear how t
o | 58 // KTX is a Texture format so it's not particularly clear how to |
| 59 // decode the alpha from them. | 59 // decode the alpha from it. |
| 60 case SkImageDecoder::kKTX_Format: | 60 case SkImageDecoder::kKTX_Format: |
| 61 case SkImageDecoder::kASTC_Format: | |
| 62 // The rest of these are opaque. | 61 // The rest of these are opaque. |
| 63 case SkImageDecoder::kPKM_Format: | 62 case SkImageDecoder::kPKM_Format: |
| 64 case SkImageDecoder::kWBMP_Format: | 63 case SkImageDecoder::kWBMP_Format: |
| 65 case SkImageDecoder::kGIF_Format: | 64 case SkImageDecoder::kGIF_Format: |
| 66 case SkImageDecoder::kJPEG_Format: | 65 case SkImageDecoder::kJPEG_Format: |
| 67 return true; | 66 return true; |
| 68 } | 67 } |
| 69 SkASSERT(false); | 68 SkASSERT(false); |
| 70 return true; | 69 return true; |
| 71 } | 70 } |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); | 809 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); |
| 811 decoder->setAllocator(allocator); | 810 decoder->setAllocator(allocator); |
| 812 decoder->setSampleSize(2); | 811 decoder->setSampleSize(2); |
| 813 SkBitmap bitmap; | 812 SkBitmap bitmap; |
| 814 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, | 813 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, |
| 815 SkImageDecoder::kDecodePixels_Mode); | 814 SkImageDecoder::kDecodePixels_Mode); |
| 816 REPORTER_ASSERT(r, success); | 815 REPORTER_ASSERT(r, success); |
| 817 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory | 816 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory |
| 818 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); | 817 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); |
| 819 } | 818 } |
| OLD | NEW |