| Index: src/core/SkPixelRef.cpp
|
| diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
|
| index 20a8b34f067ff7eafc35759cb96b1b94de475a56..ec692fb1e44732b553c01d98eeeaba7833a350a8 100644
|
| --- a/src/core/SkPixelRef.cpp
|
| +++ b/src/core/SkPixelRef.cpp
|
| @@ -199,6 +199,26 @@ void SkPixelRef::unlockPixels() {
|
| }
|
| }
|
|
|
| +bool SkPixelRef::requestLock(const LockRequest& request, LockResult* result) {
|
| + SkASSERT(result);
|
| + if (request.fSize.isEmpty()) {
|
| + return false;
|
| + }
|
| +
|
| + if (fPreLocked) {
|
| + result->fUnlockProc = NULL;
|
| + result->fUnlockContext = NULL;
|
| + result->fCTable = fRec.fColorTable;
|
| + result->fPixels = fRec.fPixels;
|
| + result->fRowBytes = fRec.fRowBytes;
|
| + result->fSize.set(fInfo.width(), fInfo.height());
|
| + return true;
|
| + } else {
|
| + SkAutoMutexAcquire ac(*fMutex);
|
| + return this->onRequestLock(request, result);
|
| + }
|
| +}
|
| +
|
| bool SkPixelRef::lockPixelsAreWritable() const {
|
| return this->onLockPixelsAreWritable();
|
| }
|
| @@ -271,6 +291,8 @@ bool SkPixelRef::readPixels(SkBitmap* dst, const SkIRect* subset) {
|
| return this->onReadPixels(dst, subset);
|
| }
|
|
|
| +///////////////////////////////////////////////////////////////////////////////////////////////////
|
| +
|
| bool SkPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {
|
| return false;
|
| }
|
| @@ -288,3 +310,22 @@ size_t SkPixelRef::getAllocatedSizeInBytes() const {
|
| return 0;
|
| }
|
|
|
| +static void unlock_legacy_result(void* ctx) {
|
| + SkPixelRef* pr = (SkPixelRef*)ctx;
|
| + pr->unlockPixels();
|
| +}
|
| +
|
| +bool SkPixelRef::onRequestLock(const LockRequest& request, LockResult* result) {
|
| + LockRec rec;
|
| + if (!this->onNewLockPixels(&rec)) {
|
| + return false;
|
| + }
|
| +
|
| + result->fUnlockProc = unlock_legacy_result;
|
| + result->fUnlockContext = SkRef(this);
|
| + result->fCTable = rec.fColorTable;
|
| + result->fPixels = rec.fPixels;
|
| + result->fRowBytes = rec.fRowBytes;
|
| + result->fSize.set(fInfo.width(), fInfo.height());
|
| + return true;
|
| +}
|
|
|