aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-13 19:45:58 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-13 19:45:58 +0000
commitbf790232f6d94b54239dbc210d8beee7411ca458 (patch)
tree7944f60fbc7329035d186d0ff5645858c7df4781 /src/images
parent0efb21bd1cd359b732a59753f3c1da096aab561a (diff)
Update all callsites to use info for pixelrefs
#define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR in chrome to keep old API signature (for now) BUG= R=scroggo@google.com Review URL: https://codereview.chromium.org/100723005 git-svn-id: http://skia.googlecode.com/svn/trunk@12677 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageRef.cpp19
-rw-r--r--src/images/SkImageRef_GlobalPool.cpp6
-rw-r--r--src/images/SkImageRef_ashmem.cpp10
-rw-r--r--src/images/SkImageRef_ashmem.h2
4 files changed, 13 insertions, 24 deletions
diff --git a/src/images/SkImageRef.cpp b/src/images/SkImageRef.cpp
index 1a8284bdd4..716519f080 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.
diff --git a/src/images/SkImageRef_GlobalPool.cpp b/src/images/SkImageRef_GlobalPool.cpp
index 352dd42d9f..f91cebabbf 100644
--- a/src/images/SkImageRef_GlobalPool.cpp
+++ b/src/images/SkImageRef_GlobalPool.cpp
@@ -24,10 +24,10 @@ static SkImageRefPool* GetGlobalPool() {
return gPool;
}
-SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkStreamRewindable* stream,
- SkBitmap::Config config,
+SkImageRef_GlobalPool::SkImageRef_GlobalPool(const SkImageInfo& info,
+ SkStreamRewindable* stream,
int sampleSize)
- : SkImageRef(stream, config, sampleSize, &gGlobalPoolMutex) {
+ : SkImageRef(info, stream, sampleSize, &gGlobalPoolMutex) {
SkASSERT(&gGlobalPoolMutex == this->mutex());
SkAutoMutexAcquire ac(gGlobalPoolMutex);
GetGlobalPool()->addToHead(this);
diff --git a/src/images/SkImageRef_ashmem.cpp b/src/images/SkImageRef_ashmem.cpp
index 9933ca9b4b..269199faf8 100644
--- a/src/images/SkImageRef_ashmem.cpp
+++ b/src/images/SkImageRef_ashmem.cpp
@@ -31,11 +31,11 @@ static size_t roundToPageSize(size_t size) {
return newsize;
}
-SkImageRef_ashmem::SkImageRef_ashmem(SkStreamRewindable* stream,
- SkBitmap::Config config,
- int sampleSize)
- : SkImageRef(stream, config, sampleSize) {
-
+SkImageRef_ashmem::SkImageRef_ashmem(const SkImageInfo& info,
+ SkStreamRewindable* stream,
+ int sampleSize)
+ : SkImageRef(info, stream, sampleSize)
+{
fRec.fFD = -1;
fRec.fAddr = NULL;
fRec.fSize = 0;
diff --git a/src/images/SkImageRef_ashmem.h b/src/images/SkImageRef_ashmem.h
index efee5e759b..a2652fbc30 100644
--- a/src/images/SkImageRef_ashmem.h
+++ b/src/images/SkImageRef_ashmem.h
@@ -19,7 +19,7 @@ struct SkAshmemRec {
class SkImageRef_ashmem : public SkImageRef {
public:
- SkImageRef_ashmem(SkStreamRewindable*, SkBitmap::Config, int sampleSize = 1);
+ SkImageRef_ashmem(const SkImageInfo&, SkStreamRewindable*, int sampleSize = 1);
virtual ~SkImageRef_ashmem();
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageRef_ashmem)