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 "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkScaledBitmapSampler.h" | 10 #include "SkScaledBitmapSampler.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 unsigned char* buf = (unsigned char*)autoMal.get(); | 42 unsigned char* buf = (unsigned char*)autoMal.get(); |
43 | 43 |
44 // Make sure original PKM header is there... | 44 // Make sure original PKM header is there... |
45 SkASSERT(etc1_pkm_is_valid(buf)); | 45 SkASSERT(etc1_pkm_is_valid(buf)); |
46 | 46 |
47 const unsigned short width = etc1_pkm_get_width(buf); | 47 const unsigned short width = etc1_pkm_get_width(buf); |
48 const unsigned short height = etc1_pkm_get_height(buf); | 48 const unsigned short height = etc1_pkm_get_height(buf); |
49 | 49 |
50 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CHOOSER | |
51 // should we allow the Chooser (if present) to pick a config for us??? | |
52 if (!this->chooseFromOneChoice(kN32_SkColorType, width, height)) { | |
53 return kFailure; | |
54 } | |
55 #endif | |
56 | |
57 // Setup the sampler... | 50 // Setup the sampler... |
58 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); | 51 SkScaledBitmapSampler sampler(width, height, this->getSampleSize()); |
59 | 52 |
60 // Set the config... | 53 // Set the config... |
61 bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight
(), | 54 bm->setInfo(SkImageInfo::MakeN32(sampler.scaledWidth(), sampler.scaledHeight
(), |
62 kOpaque_SkAlphaType)); | 55 kOpaque_SkAlphaType)); |
63 if (SkImageDecoder::kDecodeBounds_Mode == mode) { | 56 if (SkImageDecoder::kDecodeBounds_Mode == mode) { |
64 return kSuccess; | 57 return kSuccess; |
65 } | 58 } |
66 | 59 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); | 119 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); |
127 | 120 |
128 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { | 121 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { |
129 if (is_pkm(stream)) { | 122 if (is_pkm(stream)) { |
130 return SkImageDecoder::kPKM_Format; | 123 return SkImageDecoder::kPKM_Format; |
131 } | 124 } |
132 return SkImageDecoder::kUnknown_Format; | 125 return SkImageDecoder::kUnknown_Format; |
133 } | 126 } |
134 | 127 |
135 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); | 128 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); |
OLD | NEW |