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

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

Issue 1895383002: Revert of Add SkEncodedInfo to report properties of encoded image data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « src/codec/SkIcoCodec.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 int width = codecs->operator[](maxIndex)->getInfo().width(); 171 SkImageInfo info = codecs->operator[](maxIndex)->getInfo();
172 int height = codecs->operator[](maxIndex)->getInfo().height();
173 SkEncodedInfo info = codecs->operator[](maxIndex)->getEncodedInfo();
174 172
175 // 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
176 // direct access to the stream. 174 // direct access to the stream.
177 return new SkIcoCodec(width, height, info, codecs.release()); 175 return new SkIcoCodec(info, codecs.release());
178 } 176 }
179 177
180 /* 178 /*
181 * Creates an instance of the decoder 179 * Creates an instance of the decoder
182 * Called only by NewFromStream 180 * Called only by NewFromStream
183 */ 181 */
184 SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info, 182 SkIcoCodec::SkIcoCodec(const SkImageInfo& info,
185 SkTArray<SkAutoTDelete<SkCodec>, true>* codecs) 183 SkTArray<SkAutoTDelete<SkCodec>, true>* codecs)
186 : INHERITED(width, height, info, nullptr) 184 : INHERITED(info, nullptr)
187 , fEmbeddedCodecs(codecs) 185 , fEmbeddedCodecs(codecs)
188 , fCurrScanlineCodec(nullptr) 186 , fCurrScanlineCodec(nullptr)
189 {} 187 {}
190 188
191 /* 189 /*
192 * Chooses the best dimensions given the desired scale 190 * Chooses the best dimensions given the desired scale
193 */ 191 */
194 SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const { 192 SkISize SkIcoCodec::onGetScaledDimensions(float desiredScale) const {
195 // We set the dimensions to the largest candidate image by default. 193 // We set the dimensions to the largest candidate image by default.
196 // Regardless of the scale request, this is the largest image that we 194 // Regardless of the scale request, this is the largest image that we
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const { 310 SkCodec::SkScanlineOrder SkIcoCodec::onGetScanlineOrder() const {
313 // 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
314 // before startScanlineDecode(). 312 // before startScanlineDecode().
315 return fCurrScanlineCodec ? fCurrScanlineCodec->getScanlineOrder() : 313 return fCurrScanlineCodec ? fCurrScanlineCodec->getScanlineOrder() :
316 INHERITED::onGetScanlineOrder(); 314 INHERITED::onGetScanlineOrder();
317 } 315 }
318 316
319 SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) { 317 SkSampler* SkIcoCodec::getSampler(bool createIfNecessary) {
320 return fCurrScanlineCodec ? fCurrScanlineCodec->getSampler(createIfNecessary ) : nullptr; 318 return fCurrScanlineCodec ? fCurrScanlineCodec->getSampler(createIfNecessary ) : nullptr;
321 } 319 }
OLDNEW
« no previous file with comments | « src/codec/SkIcoCodec.h ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698