OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 uint32_t maxSize = 0; | 161 uint32_t maxSize = 0; |
162 uint32_t maxIndex = 0; | 162 uint32_t maxIndex = 0; |
163 for (int32_t i = 0; i < codecs->count(); i++) { | 163 for (int32_t i = 0; i < codecs->count(); i++) { |
164 SkImageInfo info = codecs->operator[](i)->getInfo(); | 164 SkImageInfo info = codecs->operator[](i)->getInfo(); |
165 uint32_t size = info.width() * info.height(); | 165 uint32_t size = info.width() * info.height(); |
166 if (size > maxSize) { | 166 if (size > maxSize) { |
167 maxSize = size; | 167 maxSize = size; |
168 maxIndex = i; | 168 maxIndex = i; |
169 } | 169 } |
170 } | 170 } |
171 SkImageInfo info = codecs->operator[](maxIndex)->getInfo(); | 171 SkEncodedInfo info = codecs->operator[](maxIndex)->getEncodedInfo(); |
172 | 172 |
173 // Note that stream is owned by the embedded codec, the ico does not need | 173 // Note that stream is owned by the embedded codec, the ico does not need |
174 // direct access to the stream. | 174 // direct access to the stream. |
175 return new SkIcoCodec(info, codecs.release()); | 175 return new SkIcoCodec(info, codecs.release()); |
176 } | 176 } |
177 | 177 |
178 /* | 178 /* |
179 * Creates an instance of the decoder | 179 * Creates an instance of the decoder |
180 * Called only by NewFromStream | 180 * Called only by NewFromStream |
181 */ | 181 */ |
182 SkIcoCodec::SkIcoCodec(const SkImageInfo& info, | 182 SkIcoCodec::SkIcoCodec(const SkEncodedInfo& info, |
183 SkTArray<SkAutoTDelete<SkCodec>, true>* codecs) | 183 SkTArray<SkAutoTDelete<SkCodec>, true>* codecs) |
184 : INHERITED(info, nullptr) | 184 : INHERITED(info, nullptr) |
185 , fEmbeddedCodecs(codecs) | 185 , fEmbeddedCodecs(codecs) |
186 , fCurrScanlineCodec(nullptr) | 186 , fCurrScanlineCodec(nullptr) |
187 {} | 187 {} |
188 | 188 |
189 /* | 189 /* |
190 * Chooses the best dimensions given the desired scale | 190 * Chooses the best dimensions given the desired scale |
191 */ | 191 */ |
192 SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const { | 192 SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const { | 310 SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const { |
311 // FIXME: This function will possibly return the wrong value if it is called | 311 // FIXME: This function will possibly return the wrong value if it is called |
312 // before startScanlineDecode(). | 312 // before startScanlineDecode(). |
313 return fCurrScanlineCodec ? fCurrScanlineCodec->getScanlineOrder() : | 313 return fCurrScanlineCodec ? fCurrScanlineCodec->getScanlineOrder() : |
314 INHERITED::onGetScanlineOrder(); | 314 INHERITED::onGetScanlineOrder(); |
315 } | 315 } |
316 | 316 |
317 SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) { | 317 SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) { |
318 return fCurrScanlineCodec ? fCurrScanlineCodec->getSampler(createIfNecessary
) : nullptr; | 318 return fCurrScanlineCodec ? fCurrScanlineCodec->getSampler(createIfNecessary
) : nullptr; |
319 } | 319 } |
OLD | NEW |