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

Unified Diff: src/core/SkPixelRef.cpp

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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
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;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698