From d98aa2de9ab18e09c2be1997f41212740f51f6e6 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Mon, 25 Oct 2010 15:47:32 -0700 Subject: DisplayList optimizations and fixes. We now use a copy of SkPaint objects to avoid having it changed from under us. We reuse copies that have not changed. We also copy the SkMatrix every time to avoid the same problem. Change-Id: If3fd80698f2d43ea16d23302063e0fd8d0549027 --- libs/hwui/ResourceCache.cpp | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'libs/hwui/ResourceCache.cpp') diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp index 20b8d6ce5b83..b0fbe65339bb 100644 --- a/libs/hwui/ResourceCache.cpp +++ b/libs/hwui/ResourceCache.cpp @@ -62,14 +62,6 @@ void ResourceCache::incrementRefcount(SkBitmap* bitmapResource) { incrementRefcount((void*)bitmapResource, kBitmap); } -void ResourceCache::incrementRefcount(SkMatrix* matrixResource) { - incrementRefcount((void*)matrixResource, kMatrix); -} - -void ResourceCache::incrementRefcount(SkPaint* paintResource) { - incrementRefcount((void*)paintResource, kPaint); -} - void ResourceCache::incrementRefcount(SkiaShader* shaderResource) { shaderResource->getSkShader()->safeRef(); incrementRefcount((void*)shaderResource, kShader); @@ -136,34 +128,6 @@ void ResourceCache::destructor(SkBitmap* resource) { } } -void ResourceCache::destructor(SkMatrix* resource) { - ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL; - if (ref == NULL) { - // If we're not tracking this resource, just delete it - delete resource; - return; - } - ref->destroyed = true; - if (ref->refCount == 0) { - deleteResourceReference(resource, ref); - return; - } -} - -void ResourceCache::destructor(SkPaint* resource) { - ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL; - if (ref == NULL) { - // If we're not tracking this resource, just delete it - delete resource; - return; - } - ref->destroyed = true; - if (ref->refCount == 0) { - deleteResourceReference(resource, ref); - return; - } -} - void ResourceCache::destructor(SkiaShader* resource) { ResourceReference* ref = mCache->indexOfKey(resource) >= 0 ? mCache->valueFor(resource) : NULL; if (ref == NULL) { @@ -196,12 +160,6 @@ void ResourceCache::deleteResourceReference(void* resource, ResourceReference* r delete bitmap; } break; - case kMatrix: - delete (SkMatrix*) resource; - break; - case kPaint: - delete (SkPaint*) resource; - break; case kShader: SkiaShader* shader = (SkiaShader*)resource; if (Caches::hasInstance()) { -- cgit v1.2.3-59-g8ed1b