Avoid 9patch cache lookups when possible
This optimization saves up to 0.3ms per frame on the Play Store's
front page, on a Nexus 4 device.
Change-Id: Iaa4ef33c6e3b37e175efd5b9eea9ef59b43f14f3
diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h
index 530dad0..1829b89 100644
--- a/libs/hwui/PatchCache.h
+++ b/libs/hwui/PatchCache.h
@@ -70,8 +70,13 @@
return mMeshBuffer;
}
+ uint32_t getGenerationId() const {
+ return mGenerationId;
+ }
+
private:
void clearCache();
+ void createVertexBuffer();
struct PatchDescription {
PatchDescription(): mPatch(NULL), mBitmapWidth(0), mBitmapHeight(0),
@@ -122,9 +127,11 @@
uint32_t mMaxSize;
uint32_t mSize;
+ LruCache<PatchDescription, Patch*> mCache;
+
GLuint mMeshBuffer;
- LruCache<PatchDescription, Patch*> mCache;
+ uint32_t mGenerationId;
}; // class PatchCache
}; // namespace uirenderer