Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/codec/SkIcoCodec.cpp

Issue 1820073002: Add SkEncodedInfo to report properties of encoded image data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Response to comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/codec/SkIcoCodec.h ('k') | src/codec/SkJpegCodec.h » ('j') | src/codec/SkJpegCodec.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698