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

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

Issue 302053002: Revert of setConfig -> setInfo (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/lazy/SkCachingPixelRef.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 /* 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 14 matching lines...) Expand all
25 SkASSERT(stream); 25 SkASSERT(stream);
26 stream->ref(); 26 stream->ref();
27 fStream = stream; 27 fStream = stream;
28 fSampleSize = sampleSize; 28 fSampleSize = sampleSize;
29 fDoDither = true; 29 fDoDither = true;
30 fPrev = fNext = NULL; 30 fPrev = fNext = NULL;
31 fFactory = NULL; 31 fFactory = NULL;
32 32
33 // This sets the colortype/alphatype to exactly match our info, so that this 33 // This sets the colortype/alphatype to exactly match our info, so that this
34 // can get communicated down to the codec. 34 // can get communicated down to the codec.
35 fBitmap.setInfo(info); 35 fBitmap.setConfig(info);
36 36
37 #ifdef DUMP_IMAGEREF_LIFECYCLE 37 #ifdef DUMP_IMAGEREF_LIFECYCLE
38 SkDebugf("add ImageRef %p [%d] data=%d\n", 38 SkDebugf("add ImageRef %p [%d] data=%d\n",
39 this, this->info().fColorType, (int)stream->getLength()); 39 this, this->info().fColorType, (int)stream->getLength());
40 #endif 40 #endif
41 } 41 }
42 42
43 SkImageRef::~SkImageRef() { 43 SkImageRef::~SkImageRef() {
44 44
45 #ifdef DUMP_IMAGEREF_LIFECYCLE 45 #ifdef DUMP_IMAGEREF_LIFECYCLE
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 buffer.readByteArray((void*)fStream->getMemoryBase(), length); 183 buffer.readByteArray((void*)fStream->getMemoryBase(), length);
184 } else { 184 } else {
185 fStream = NULL; 185 fStream = NULL;
186 } 186 }
187 187
188 fPrev = fNext = NULL; 188 fPrev = fNext = NULL;
189 fFactory = NULL; 189 fFactory = NULL;
190 190
191 // This sets the colortype/alphatype to exactly match our info, so that this 191 // This sets the colortype/alphatype to exactly match our info, so that this
192 // can get communicated down to the codec. 192 // can get communicated down to the codec.
193 fBitmap.setInfo(this->info()); 193 fBitmap.setConfig(this->info());
194 } 194 }
195 195
196 void SkImageRef::flatten(SkWriteBuffer& buffer) const { 196 void SkImageRef::flatten(SkWriteBuffer& buffer) const {
197 this->INHERITED::flatten(buffer); 197 this->INHERITED::flatten(buffer);
198 198
199 buffer.writeInt(fSampleSize); 199 buffer.writeInt(fSampleSize);
200 buffer.writeBool(fDoDither); 200 buffer.writeBool(fDoDither);
201 // FIXME: Consider moving this logic should go into writeStream itself. 201 // FIXME: Consider moving this logic should go into writeStream itself.
202 // writeStream currently has no other callers, so this may be fine for 202 // writeStream currently has no other callers, so this may be fine for
203 // now. 203 // now.
204 if (!fStream->rewind()) { 204 if (!fStream->rewind()) {
205 SkDEBUGF(("Failed to rewind SkImageRef stream!")); 205 SkDEBUGF(("Failed to rewind SkImageRef stream!"));
206 buffer.write32(0); 206 buffer.write32(0);
207 } else { 207 } else {
208 // FIXME: Handle getLength properly here. Perhaps this class should 208 // FIXME: Handle getLength properly here. Perhaps this class should
209 // take an SkStreamAsset. 209 // take an SkStreamAsset.
210 buffer.writeStream(fStream, fStream->getLength()); 210 buffer.writeStream(fStream, fStream->getLength());
211 } 211 }
212 } 212 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libwebp.cpp ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698