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 is a Texture format so it's not particularly clear how to | 58 // KTX and ASTC are texture formats so it's not particularly clear how t
o |
59 // decode the alpha from it. | 59 // decode the alpha from them. |
60 case SkImageDecoder::kKTX_Format: | 60 case SkImageDecoder::kKTX_Format: |
| 61 case SkImageDecoder::kASTC_Format: |
61 // The rest of these are opaque. | 62 // The rest of these are opaque. |
62 case SkImageDecoder::kPKM_Format: | 63 case SkImageDecoder::kPKM_Format: |
63 case SkImageDecoder::kWBMP_Format: | 64 case SkImageDecoder::kWBMP_Format: |
64 case SkImageDecoder::kGIF_Format: | 65 case SkImageDecoder::kGIF_Format: |
65 case SkImageDecoder::kJPEG_Format: | 66 case SkImageDecoder::kJPEG_Format: |
66 return true; | 67 return true; |
67 } | 68 } |
68 SkASSERT(false); | 69 SkASSERT(false); |
69 return true; | 70 return true; |
70 } | 71 } |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); | 810 ((void*)pixels.get(), sizeof(uint16_t) * pixelCount))); |
810 decoder->setAllocator(allocator); | 811 decoder->setAllocator(allocator); |
811 decoder->setSampleSize(2); | 812 decoder->setSampleSize(2); |
812 SkBitmap bitmap; | 813 SkBitmap bitmap; |
813 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, | 814 bool success = decoder->decode(stream, &bitmap, kRGB_565_SkColorType, |
814 SkImageDecoder::kDecodePixels_Mode); | 815 SkImageDecoder::kDecodePixels_Mode); |
815 REPORTER_ASSERT(r, success); | 816 REPORTER_ASSERT(r, success); |
816 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory | 817 REPORTER_ASSERT(r, !allocator->ready()); // Decoder used correct memory |
817 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); | 818 REPORTER_ASSERT(r, sentinal == pixels[pixelCount]); |
818 } | 819 } |
OLD | NEW |