From 2728f961614a385df1f056fc24803a9f65c90fab Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 8 Oct 2010 18:36:15 -0700 Subject: Don't update 9patches on every frame. Change-Id: I7ffb2365f83e0453e7d0a0cdcb3fc9308b305238 --- libs/hwui/PatchCache.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'libs/hwui/PatchCache.h') diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h index b0774692df2b..08f78a316af0 100644 --- a/libs/hwui/PatchCache.h +++ b/libs/hwui/PatchCache.h @@ -17,8 +17,9 @@ #ifndef ANDROID_UI_PATCH_CACHE_H #define ANDROID_UI_PATCH_CACHE_H +#include + #include "Patch.h" -#include "GenerationCache.h" namespace android { namespace uirenderer { @@ -41,23 +42,21 @@ namespace uirenderer { // Cache /////////////////////////////////////////////////////////////////////////////// -class PatchCache: public OnEntryRemoved { +class PatchCache { public: PatchCache(); PatchCache(uint32_t maxCapacity); ~PatchCache(); - /** - * Used as a callback when an entry is removed from the cache. - * Do not invoke directly. - */ - void operator()(PatchDescription& description, Patch*& mesh); - - Patch* get(uint32_t width, uint32_t height); + Patch* get(const float bitmapWidth, const float bitmapHeight, + const float pixelWidth, const float pixelHeight, + const int32_t* xDivs, const int32_t* yDivs, + const uint32_t width, const uint32_t height); void clear(); private: - GenerationCache mCache; + uint32_t mMaxEntries; + KeyedVector mCache; }; // class PatchCache }; // namespace uirenderer -- cgit v1.2.3-59-g8ed1b