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

Unified Diff: src/images/SkImageRef.cpp

Issue 100723005: Update all callsites to use info for pixelrefs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | src/images/SkImageRef_GlobalPool.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageRef.cpp
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index 1a8284bdd4a6e730da950ce244355867295cb0de..716519f080d0ab8e2f9d2dc964b73eb80224406b 100644
--- a/src/images/SkImageRef.cpp
+++ b/src/images/SkImageRef.cpp
@@ -18,13 +18,12 @@
///////////////////////////////////////////////////////////////////////////////
-SkImageRef::SkImageRef(SkStreamRewindable* stream, SkBitmap::Config config,
+SkImageRef::SkImageRef(const SkImageInfo& info, SkStreamRewindable* stream,
int sampleSize, SkBaseMutex* mutex)
- : SkPixelRef(mutex), fErrorInDecoding(false) {
+ : SkPixelRef(info, mutex), fErrorInDecoding(false) {
SkASSERT(stream);
stream->ref();
fStream = stream;
- fConfig = config;
fSampleSize = sampleSize;
fDoDither = true;
fPrev = fNext = NULL;
@@ -32,7 +31,7 @@ SkImageRef::SkImageRef(SkStreamRewindable* stream, SkBitmap::Config config,
#ifdef DUMP_IMAGEREF_LIFECYCLE
SkDebugf("add ImageRef %p [%d] data=%d\n",
- this, config, (int)stream->getLength());
+ this, this->info().fColorType, (int)stream->getLength());
#endif
}
@@ -92,14 +91,6 @@ bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) {
return false;
}
- /* As soon as we really know our config, we record it, so that on
- subsequent calls to the codec, we are sure we will always get the same
- result.
- */
- if (SkBitmap::kNo_Config != fBitmap.config()) {
- fConfig = fBitmap.config();
- }
-
if (NULL != fBitmap.getPixels() ||
(SkBitmap::kNo_Config != fBitmap.config() &&
SkImageDecoder::kDecodeBounds_Mode == mode)) {
@@ -125,7 +116,7 @@ bool SkImageRef::prepareBitmap(SkImageDecoder::Mode mode) {
codec->setSampleSize(fSampleSize);
codec->setDitherImage(fDoDither);
- if (this->onDecode(codec, fStream, &fBitmap, fConfig, mode)) {
+ if (this->onDecode(codec, fStream, &fBitmap, fBitmap.config(), mode)) {
return true;
}
}
@@ -170,7 +161,6 @@ size_t SkImageRef::ramUsed() const {
SkImageRef::SkImageRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
: INHERITED(buffer, mutex), fErrorInDecoding(false) {
- fConfig = (SkBitmap::Config)buffer.readUInt();
fSampleSize = buffer.readInt();
fDoDither = buffer.readBool();
@@ -185,7 +175,6 @@ SkImageRef::SkImageRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex)
void SkImageRef::flatten(SkFlattenableWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
- buffer.writeUInt(fConfig);
buffer.writeInt(fSampleSize);
buffer.writeBool(fDoDither);
// FIXME: Consider moving this logic should go into writeStream itself.
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | src/images/SkImageRef_GlobalPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698