Add a layer (FBO) cache.
The cache is used to draw layers so that a new
texture does not have to be recreated every time
a call to saveLayer() happens.
The FBO cache used a KeyedVector, which is a bad
idea. The cache should be able to store several
FBOs of the same size (this happens a lot during
scrolling with fading edges for instance.) This
will be changed in a future CL.
Change-Id: Ic316189e625f0dbcf0d273a71cc981a433d48726
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index 93ee138..612f04e 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -28,7 +28,7 @@
///////////////////////////////////////////////////////////////////////////////
TextureCache::TextureCache(uint32_t maxByteSize):
- mCache(GenerationCache<SkBitmap, Texture>::kUnlimitedCapacity),
+ mCache(GenerationCache<SkBitmap*, Texture*>::kUnlimitedCapacity),
mSize(0), mMaxSize(maxByteSize) {
mCache.setOnEntryRemovedListener(this);
}
@@ -60,7 +60,7 @@
// Callbacks
///////////////////////////////////////////////////////////////////////////////
-void TextureCache::operator()(SkBitmap* bitmap, Texture* texture) {
+void TextureCache::operator()(SkBitmap*& bitmap, Texture*& texture) {
if (bitmap) {
const uint32_t size = bitmap->rowBytes() * bitmap->height();
mSize -= size;