diff options
| author | 2015-05-07 20:28:56 +0000 | |
|---|---|---|
| committer | 2015-05-07 20:28:57 +0000 | |
| commit | d530a5e5ae26794556488ea09fc44219481c936b (patch) | |
| tree | f2614f18bddb8b1905bead618fab7884b1336e60 /libs/hwui/ResourceCache.cpp | |
| parent | 0dfb7ba4a81e3af2e93732942d314a55c02f6ac1 (diff) | |
| parent | e75ab4c26a4f661334845f7bc4132011694836a4 (diff) | |
Merge "Remove SkBitmap from ResourceCache" into mnc-dev
Diffstat (limited to 'libs/hwui/ResourceCache.cpp')
| -rw-r--r-- | libs/hwui/ResourceCache.cpp | 70 | 
1 files changed, 0 insertions, 70 deletions
| diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp index 454fedc2b179..75d81346d62a 100644 --- a/libs/hwui/ResourceCache.cpp +++ b/libs/hwui/ResourceCache.cpp @@ -59,21 +59,6 @@ void ResourceCache::unlock() {      mLock.unlock();  } -const SkBitmap* ResourceCache::insert(const SkBitmap& bitmapResource) { -    Mutex::Autolock _l(mLock); - -    BitmapKey bitmapKey(bitmapResource); -    ssize_t index = mBitmapCache.indexOfKey(bitmapKey); -    if (index == NAME_NOT_FOUND) { -        SkBitmap* cachedBitmap = new SkBitmap(bitmapResource); -        index = mBitmapCache.add(bitmapKey, cachedBitmap); -        return cachedBitmap; -    } - -    mBitmapCache.keyAt(index).mRefCount++; -    return mBitmapCache.valueAt(index); -} -  void ResourceCache::incrementRefcount(void* resource, ResourceType resourceType) {      Mutex::Autolock _l(mLock);      incrementRefcountLocked(resource, resourceType); @@ -98,11 +83,6 @@ void ResourceCache::decrementRefcount(void* resource) {      decrementRefcountLocked(resource);  } -void ResourceCache::decrementRefcount(const SkBitmap* bitmapResource) { -    Mutex::Autolock _l(mLock); -    decrementRefcountLocked(bitmapResource); -} -  void ResourceCache::decrementRefcount(const Res_png_9patch* patchResource) {      decrementRefcount((void*) patchResource);  } @@ -120,23 +100,6 @@ void ResourceCache::decrementRefcountLocked(void* resource) {      }  } -void ResourceCache::decrementRefcountLocked(const SkBitmap* bitmapResource) { -    BitmapKey bitmapKey(*bitmapResource); -    ssize_t index = mBitmapCache.indexOfKey(bitmapKey); - -    LOG_ALWAYS_FATAL_IF(index == NAME_NOT_FOUND, -                    "Decrementing the reference of an untracked Bitmap"); - -    const BitmapKey& cacheEntry = mBitmapCache.keyAt(index); -    if (cacheEntry.mRefCount == 1) { -        // delete the bitmap and remove it from the cache -        delete mBitmapCache.valueAt(index); -        mBitmapCache.removeItemsAt(index); -    } else { -        cacheEntry.mRefCount--; -    } -} -  void ResourceCache::decrementRefcountLocked(const Res_png_9patch* patchResource) {      decrementRefcountLocked((void*) patchResource);  } @@ -190,38 +153,5 @@ void ResourceCache::deleteResourceReferenceLocked(const void* resource, Resource      delete ref;  } -/////////////////////////////////////////////////////////////////////////////// -// Bitmap Key -/////////////////////////////////////////////////////////////////////////////// - -void BitmapKey::operator=(const BitmapKey& other) { -    this->mRefCount = other.mRefCount; -    this->mBitmapDimensions = other.mBitmapDimensions; -    this->mPixelRefOrigin = other.mPixelRefOrigin; -    this->mPixelRefStableID = other.mPixelRefStableID; -} - -bool BitmapKey::operator==(const BitmapKey& other) const { -    return mPixelRefStableID == other.mPixelRefStableID && -           mPixelRefOrigin == other.mPixelRefOrigin && -           mBitmapDimensions == other.mBitmapDimensions; -} - -bool BitmapKey::operator<(const BitmapKey& other) const { -    if (mPixelRefStableID != other.mPixelRefStableID) { -        return mPixelRefStableID < other.mPixelRefStableID; -    } -    if (mPixelRefOrigin.x() != other.mPixelRefOrigin.x()) { -        return mPixelRefOrigin.x() < other.mPixelRefOrigin.x(); -    } -    if (mPixelRefOrigin.y() != other.mPixelRefOrigin.y()) { -        return mPixelRefOrigin.y() < other.mPixelRefOrigin.y(); -    } -    if (mBitmapDimensions.width() != other.mBitmapDimensions.width()) { -        return mBitmapDimensions.width() < other.mBitmapDimensions.width(); -    } -    return mBitmapDimensions.height() < other.mBitmapDimensions.height(); -} -  }; // namespace uirenderer  }; // namespace android |