Chromium Code Reviews| Index: src/core/SkPixelRef.cpp |
| diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp |
| index 972474ccc3357f301bda62da187def8f8b7c5db9..8ff1122b3f33e9fb224873cb6a469b757fdd1147 100644 |
| --- a/src/core/SkPixelRef.cpp |
| +++ b/src/core/SkPixelRef.cpp |
| @@ -89,6 +89,7 @@ SkPixelRef::SkPixelRef(SkBaseMutex* mutex) { |
| this->setMutex(mutex); |
| fPixels = NULL; |
| fColorTable = NULL; // we do not track ownership of this |
| + fRowBytes = 0; |
| fLockCount = 0; |
| this->needsNewGenID(); |
| fIsImmutable = false; |
| @@ -100,6 +101,7 @@ SkPixelRef::SkPixelRef(SkFlattenableReadBuffer& buffer, SkBaseMutex* mutex) |
| this->setMutex(mutex); |
| fPixels = NULL; |
| fColorTable = NULL; // we do not track ownership of this |
| + fRowBytes = 0; |
| fLockCount = 0; |
| fIsImmutable = buffer.readBool(); |
| fGenerationID = buffer.readUInt(); |
| @@ -123,12 +125,13 @@ void SkPixelRef::cloneGenID(const SkPixelRef& that) { |
| that.fUniqueGenerationID = false; |
| } |
| -void SkPixelRef::setPreLocked(void* pixels, SkColorTable* ctable) { |
| +void SkPixelRef::setPreLocked(void* pixels, size_t rowBytes, SkColorTable* ctable) { |
| #ifndef SK_IGNORE_PIXELREF_SETPRELOCKED |
| // only call me in your constructor, otherwise fLockCount tracking can get |
| // out of sync. |
| fPixels = pixels; |
| fColorTable = ctable; |
| + fRowBytes = rowBytes; |
| fLockCount = SKPIXELREF_PRELOCKED_LOCKCOUNT; |
| fPreLocked = true; |
| #endif |
| @@ -157,7 +160,8 @@ void SkPixelRef::lockPixels() { |
| SkAutoMutexAcquire ac(*fMutex); |
| if (1 == ++fLockCount) { |
| - fPixels = this->onLockPixels(&fColorTable); |
| + SkImageInfo info; |
|
scroggo
2013/11/19 18:17:09
Shouldn't lockPixels take an SkImageInfo* and a si
reed1
2013/11/20 20:56:56
good idea
|
| + fPixels = this->onLockPixels(&info, &fRowBytes, &fColorTable); |
| } |
| } |
| } |
| @@ -173,6 +177,7 @@ void SkPixelRef::unlockPixels() { |
| this->onUnlockPixels(); |
| fPixels = NULL; |
| fColorTable = NULL; |
| + fRowBytes = 0; |
| } |
| } |
| } |