summaryrefslogtreecommitdiff
path: root/libs/hwui/ResourceCache.cpp
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2014-01-02 17:13:34 -0800
committer Chris Craik <ccraik@google.com> 2014-01-03 13:55:08 -0800
commitd218a92c0afb8c0d98135b20b52ac87236e1c935 (patch)
tree3eef804e9948ca463e720ac636db46b2637fdabb /libs/hwui/ResourceCache.cpp
parent8523706236b0b2536ed4359d92ec6ccdca060d78 (diff)
Use const where possible for drawing parameters
They should never be modified by a Renderer, only read and copied. Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
Diffstat (limited to 'libs/hwui/ResourceCache.cpp')
-rw-r--r--libs/hwui/ResourceCache.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index 3f77021da02a..e58857cb6959 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -40,7 +40,7 @@ void ResourceCache::logCache() {
ResourceCache::ResourceCache() {
Mutex::Autolock _l(mLock);
- mCache = new KeyedVector<void*, ResourceReference*>();
+ mCache = new KeyedVector<const void*, ResourceReference*>();
}
ResourceCache::~ResourceCache() {
@@ -61,13 +61,13 @@ void ResourceCache::incrementRefcount(void* resource, ResourceType resourceType)
incrementRefcountLocked(resource, resourceType);
}
-void ResourceCache::incrementRefcount(SkBitmap* bitmapResource) {
+void ResourceCache::incrementRefcount(const SkBitmap* bitmapResource) {
bitmapResource->pixelRef()->globalRef();
SkSafeRef(bitmapResource->getColorTable());
incrementRefcount((void*) bitmapResource, kBitmap);
}
-void ResourceCache::incrementRefcount(SkPath* pathResource) {
+void ResourceCache::incrementRefcount(const SkPath* pathResource) {
incrementRefcount((void*) pathResource, kPath);
}
@@ -81,7 +81,7 @@ void ResourceCache::incrementRefcount(SkiaColorFilter* filterResource) {
incrementRefcount((void*) filterResource, kColorFilter);
}
-void ResourceCache::incrementRefcount(Res_png_9patch* patchResource) {
+void ResourceCache::incrementRefcount(const Res_png_9patch* patchResource) {
incrementRefcount((void*) patchResource, kNinePatch);
}
@@ -99,13 +99,13 @@ void ResourceCache::incrementRefcountLocked(void* resource, ResourceType resourc
ref->refCount++;
}
-void ResourceCache::incrementRefcountLocked(SkBitmap* bitmapResource) {
+void ResourceCache::incrementRefcountLocked(const SkBitmap* bitmapResource) {
bitmapResource->pixelRef()->globalRef();
SkSafeRef(bitmapResource->getColorTable());
incrementRefcountLocked((void*) bitmapResource, kBitmap);
}
-void ResourceCache::incrementRefcountLocked(SkPath* pathResource) {
+void ResourceCache::incrementRefcountLocked(const SkPath* pathResource) {
incrementRefcountLocked((void*) pathResource, kPath);
}
@@ -119,7 +119,7 @@ void ResourceCache::incrementRefcountLocked(SkiaColorFilter* filterResource) {
incrementRefcountLocked((void*) filterResource, kColorFilter);
}
-void ResourceCache::incrementRefcountLocked(Res_png_9patch* patchResource) {
+void ResourceCache::incrementRefcountLocked(const Res_png_9patch* patchResource) {
incrementRefcountLocked((void*) patchResource, kNinePatch);
}
@@ -132,13 +132,13 @@ void ResourceCache::decrementRefcount(void* resource) {
decrementRefcountLocked(resource);
}
-void ResourceCache::decrementRefcount(SkBitmap* bitmapResource) {
+void ResourceCache::decrementRefcount(const SkBitmap* bitmapResource) {
bitmapResource->pixelRef()->globalUnref();
SkSafeUnref(bitmapResource->getColorTable());
decrementRefcount((void*) bitmapResource);
}
-void ResourceCache::decrementRefcount(SkPath* pathResource) {
+void ResourceCache::decrementRefcount(const SkPath* pathResource) {
decrementRefcount((void*) pathResource);
}
@@ -152,7 +152,7 @@ void ResourceCache::decrementRefcount(SkiaColorFilter* filterResource) {
decrementRefcount((void*) filterResource);
}
-void ResourceCache::decrementRefcount(Res_png_9patch* patchResource) {
+void ResourceCache::decrementRefcount(const Res_png_9patch* patchResource) {
decrementRefcount((void*) patchResource);
}
@@ -173,13 +173,13 @@ void ResourceCache::decrementRefcountLocked(void* resource) {
}
}
-void ResourceCache::decrementRefcountLocked(SkBitmap* bitmapResource) {
+void ResourceCache::decrementRefcountLocked(const SkBitmap* bitmapResource) {
bitmapResource->pixelRef()->globalUnref();
SkSafeUnref(bitmapResource->getColorTable());
decrementRefcountLocked((void*) bitmapResource);
}
-void ResourceCache::decrementRefcountLocked(SkPath* pathResource) {
+void ResourceCache::decrementRefcountLocked(const SkPath* pathResource) {
decrementRefcountLocked((void*) pathResource);
}
@@ -193,7 +193,7 @@ void ResourceCache::decrementRefcountLocked(SkiaColorFilter* filterResource) {
decrementRefcountLocked((void*) filterResource);
}
-void ResourceCache::decrementRefcountLocked(Res_png_9patch* patchResource) {
+void ResourceCache::decrementRefcountLocked(const Res_png_9patch* patchResource) {
decrementRefcountLocked((void*) patchResource);
}
@@ -223,12 +223,12 @@ void ResourceCache::destructorLocked(SkPath* resource) {
}
}
-void ResourceCache::destructor(SkBitmap* resource) {
+void ResourceCache::destructor(const SkBitmap* resource) {
Mutex::Autolock _l(mLock);
destructorLocked(resource);
}
-void ResourceCache::destructorLocked(SkBitmap* resource) {
+void ResourceCache::destructorLocked(const SkBitmap* resource) {
ssize_t index = mCache->indexOfKey(resource);
ResourceReference* ref = index >= 0 ? mCache->valueAt(index) : NULL;
if (ref == NULL) {
@@ -345,7 +345,7 @@ bool ResourceCache::recycleLocked(SkBitmap* resource) {
* This method should only be called while the mLock mutex is held (that mutex is grabbed
* by the various destructor() and recycle() methods which call this method).
*/
-void ResourceCache::deleteResourceReferenceLocked(void* resource, ResourceReference* ref) {
+void ResourceCache::deleteResourceReferenceLocked(const void* resource, ResourceReference* ref) {
if (ref->recycled && ref->resourceType == kBitmap) {
((SkBitmap*) resource)->setPixels(NULL, NULL);
}