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

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

Issue 172873003: Fix bug in deferred decoding where we don't properly pass the unpremul option to the codec. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkImageRef.h" 8 #include "SkImageRef.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 codec = fFactory->newDecoder(fStream); 114 codec = fFactory->newDecoder(fStream);
115 } else { 115 } else {
116 codec = SkImageDecoder::Factory(fStream); 116 codec = SkImageDecoder::Factory(fStream);
117 } 117 }
118 118
119 if (codec) { 119 if (codec) {
120 SkAutoTDelete<SkImageDecoder> ad(codec); 120 SkAutoTDelete<SkImageDecoder> ad(codec);
121 121
122 codec->setSampleSize(fSampleSize); 122 codec->setSampleSize(fSampleSize);
123 codec->setDitherImage(fDoDither); 123 codec->setDitherImage(fDoDither);
124 codec->setRequireUnpremultipliedColors(this->info().fAlphaType == kUnpre mul_SkAlphaType);
124 if (this->onDecode(codec, fStream, &fBitmap, fBitmap.config(), mode)) { 125 if (this->onDecode(codec, fStream, &fBitmap, fBitmap.config(), mode)) {
125 if (kOpaque_SkAlphaType == fBitmap.alphaType()) { 126 if (kOpaque_SkAlphaType == fBitmap.alphaType()) {
126 this->changeAlphaType(kOpaque_SkAlphaType); 127 this->changeAlphaType(kOpaque_SkAlphaType);
127 } 128 }
128 SkASSERT(this->info().fColorType == fBitmap.colorType()); 129 SkASSERT(this->info() == fBitmap.info());
129 SkASSERT(this->info().fWidth == fBitmap.width());
130 SkASSERT(this->info().fHeight == fBitmap.height());
131 return true; 130 return true;
132 } 131 }
133 } 132 }
134 133
135 #ifdef DUMP_IMAGEREF_LIFECYCLE 134 #ifdef DUMP_IMAGEREF_LIFECYCLE
136 if (NULL == codec) { 135 if (NULL == codec) {
137 SkDebugf("--- ImageRef: <%s> failed to find codec\n", this->getURI()); 136 SkDebugf("--- ImageRef: <%s> failed to find codec\n", this->getURI());
138 } else { 137 } else {
139 SkDebugf("--- ImageRef: <%s> failed in codec for %d mode\n", 138 SkDebugf("--- ImageRef: <%s> failed in codec for %d mode\n",
140 this->getURI(), mode); 139 this->getURI(), mode);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // now. 203 // now.
205 if (!fStream->rewind()) { 204 if (!fStream->rewind()) {
206 SkDEBUGF(("Failed to rewind SkImageRef stream!")); 205 SkDEBUGF(("Failed to rewind SkImageRef stream!"));
207 buffer.write32(0); 206 buffer.write32(0);
208 } else { 207 } else {
209 // FIXME: Handle getLength properly here. Perhaps this class should 208 // FIXME: Handle getLength properly here. Perhaps this class should
210 // take an SkStreamAsset. 209 // take an SkStreamAsset.
211 buffer.writeStream(fStream, fStream->getLength()); 210 buffer.writeStream(fStream, fStream->getLength());
212 } 211 }
213 } 212 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698