diff options
author | 2014-01-03 16:32:45 +0000 | |
---|---|---|
committer | 2014-01-03 16:32:45 +0000 | |
commit | 27f890219b09e4774da75e6a11ec82849eadae5a (patch) | |
tree | c3b4cf408291039b44e7b4fb5e5c0ea77a0bf04b /src/core/SkScaledImageCache.cpp | |
parent | f1ce05288a8fee6e691c3dff5db9dcd47818060f (diff) |
Reason for revert: SkImageRef_ashmem doesn't compile
R=halcanary@google.com, scroggo@google.com
TBR=halcanary@google.com, scroggo@google.com
NOTREECHECKS=true
NOTRY=true
BUG=
Author: reed@google.com
Review URL: https://codereview.chromium.org/119753009
git-svn-id: http://skia.googlecode.com/svn/trunk@12884 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkScaledImageCache.cpp')
-rw-r--r-- | src/core/SkScaledImageCache.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp index 5a772a7cd5..45a5684638 100644 --- a/src/core/SkScaledImageCache.cpp +++ b/src/core/SkScaledImageCache.cpp @@ -199,11 +199,13 @@ public: SK_DECLARE_UNFLATTENABLE_OBJECT() protected: - virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; + virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; virtual void onUnlockPixels() SK_OVERRIDE; virtual size_t getAllocatedSizeInBytes() const SK_OVERRIDE; private: + SkImageInfo fInfo; // remove when SkPixelRef gets this in baseclass + SkDiscardableMemory* fDM; size_t fRB; bool fFirstTime; @@ -218,6 +220,8 @@ SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in , fDM(dm) , fRB(rowBytes) { + fInfo = info; // remove this redundant field when SkPixelRef has info + SkASSERT(dm->data()); fFirstTime = true; } @@ -226,31 +230,26 @@ SkOneShotDiscardablePixelRef::~SkOneShotDiscardablePixelRef() { SkDELETE(fDM); } -bool SkOneShotDiscardablePixelRef::onNewLockPixels(LockRec* rec) { +void* SkOneShotDiscardablePixelRef::onLockPixels(SkColorTable** ctable) { if (fFirstTime) { // we're already locked SkASSERT(fDM->data()); fFirstTime = false; - goto SUCCESS; + return fDM->data(); } // A previous call to onUnlock may have deleted our DM, so check for that if (NULL == fDM) { - return false; + return NULL; } if (!fDM->lock()) { // since it failed, we delete it now, to free-up the resource delete fDM; fDM = NULL; - return false; + return NULL; } - -SUCCESS: - rec->fPixels = fDM->data(); - rec->fColorTable = NULL; - rec->fRowBytes = fRB; - return true; + return fDM->data(); } void SkOneShotDiscardablePixelRef::onUnlockPixels() { @@ -259,7 +258,7 @@ void SkOneShotDiscardablePixelRef::onUnlockPixels() { } size_t SkOneShotDiscardablePixelRef::getAllocatedSizeInBytes() const { - return this->info().getSafeSize(fRB); + return fInfo.fHeight * fRB; } class SkScaledImageCacheDiscardableAllocator : public SkBitmap::Allocator { |