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

Side by Side Diff: src/images/SkDecodingImageGenerator.cpp

Issue 334793002: hide Config in SkImageDecoder -- use SkColorType instead (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 6 years, 6 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/image/SkImage_Codec.cpp ('k') | src/images/SkImageDecoder.cpp » ('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 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkDecodingImageGenerator.h" 9 #include "SkDecodingImageGenerator.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return false; 166 return false;
167 } 167 }
168 decoder->setDitherImage(fDitherImage); 168 decoder->setDitherImage(fDitherImage);
169 decoder->setSampleSize(fSampleSize); 169 decoder->setSampleSize(fSampleSize);
170 decoder->setRequireUnpremultipliedColors( 170 decoder->setRequireUnpremultipliedColors(
171 info.fAlphaType == kUnpremul_SkAlphaType); 171 info.fAlphaType == kUnpremul_SkAlphaType);
172 172
173 SkBitmap bitmap; 173 SkBitmap bitmap;
174 TargetAllocator allocator(fInfo, pixels, rowBytes); 174 TargetAllocator allocator(fInfo, pixels, rowBytes);
175 decoder->setAllocator(&allocator); 175 decoder->setAllocator(&allocator);
176 // TODO: need to be able to pass colortype directly to decoder 176 bool success = decoder->decode(fStream, &bitmap, info.colorType(),
177 SkBitmap::Config legacyConfig = SkColorTypeToBitmapConfig(info.colorType());
178 bool success = decoder->decode(fStream, &bitmap, legacyConfig,
179 SkImageDecoder::kDecodePixels_Mode); 177 SkImageDecoder::kDecodePixels_Mode);
180 decoder->setAllocator(NULL); 178 decoder->setAllocator(NULL);
181 if (!success) { 179 if (!success) {
182 return false; 180 return false;
183 } 181 }
184 if (allocator.isReady()) { // Did not use pixels! 182 if (allocator.isReady()) { // Did not use pixels!
185 SkBitmap bm; 183 SkBitmap bm;
186 SkASSERT(bitmap.canCopyTo(info.colorType())); 184 SkASSERT(bitmap.canCopyTo(info.colorType()));
187 bool copySuccess = bitmap.copyTo(&bm, info.colorType(), &allocator); 185 bool copySuccess = bitmap.copyTo(&bm, info.colorType(), &allocator);
188 if (!copySuccess || allocator.isReady()) { 186 if (!copySuccess || allocator.isReady()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 SkStreamRewindable* stream, 272 SkStreamRewindable* stream,
275 const SkDecodingImageGenerator::Options& opts) { 273 const SkDecodingImageGenerator::Options& opts) {
276 SkASSERT(stream != NULL); 274 SkASSERT(stream != NULL);
277 SkASSERT(stream->unique()); 275 SkASSERT(stream->unique());
278 if ((stream == NULL) || !stream->unique()) { 276 if ((stream == NULL) || !stream->unique()) {
279 SkSafeUnref(stream); 277 SkSafeUnref(stream);
280 return NULL; 278 return NULL;
281 } 279 }
282 return CreateDecodingImageGenerator(NULL, stream, opts); 280 return CreateDecodingImageGenerator(NULL, stream, opts);
283 } 281 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Codec.cpp ('k') | src/images/SkImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698