summaryrefslogtreecommitdiffstats
path: root/libs/hwui/LayerCache.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-07-08 11:45:51 -0700
committerRomain Guy <romainguy@google.com>2010-07-08 11:45:51 -0700
commitf18fd99b5c182329cd8936a9611f0103d8ece44a (patch)
treec32def6bcb82e2a2019a5a49744dfa34c94d8d81 /libs/hwui/LayerCache.h
parent132f22590a3cd27ce15a705bdb481675e8fd02bc (diff)
downloadframeworks_base-f18fd99b5c182329cd8936a9611f0103d8ece44a.zip
frameworks_base-f18fd99b5c182329cd8936a9611f0103d8ece44a.tar.gz
frameworks_base-f18fd99b5c182329cd8936a9611f0103d8ece44a.tar.bz2
Create FBOs in LayerCache.
This moves a bit of code away from OpenGLRenderer and matches what happens with the TextureCache. Change-Id: I3c67f54f83d7240770daa015861c0e75a1dd8c42
Diffstat (limited to 'libs/hwui/LayerCache.h')
-rw-r--r--libs/hwui/LayerCache.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index 519552d..adc6713 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -23,6 +23,24 @@
namespace android {
namespace uirenderer {
+///////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////
+
+// Debug
+#define DEBUG_LAYERS 0
+
+// Debug
+#if DEBUG_LAYERS
+ #define LAYER_LOGD(...) LOGD(__VA_ARGS__)
+#else
+ #define LAYER_LOGD(...)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Cache
+///////////////////////////////////////////////////////////////////////////////
+
class LayerCache: public OnEntryRemoved<LayerSize, Layer*> {
public:
LayerCache(uint32_t maxByteSize);
@@ -35,13 +53,25 @@ public:
void operator()(LayerSize& bitmap, Layer*& texture);
/**
- * Returns the layer of specified dimensions, NULL if cannot be found.
+ * Returns the layer of specified dimensions. If not suitable layer
+ * can be found, a new one is created and returned. If creating a new
+ * layer fails, NULL is returned.
+ *
+ * When a layer is obtained from the cache, it is removed and the total
+ * size of the cache goes down.
+ *
+ * @param size The dimensions of the desired layer
+ * @param previousFbo The name of the FBO to bind to if creating a new
+ * layer fails
*/
- Layer* get(LayerSize& size);
+ Layer* get(LayerSize& size, GLuint previousFbo);
/**
* Adds the layer to the cache. The layer will not be added if there is
* not enough space available.
*
+ * @param size The dimensions of the layer
+ * @param layer The layer to add to the cache
+ *
* @return True if the layer was added, false otherwise.
*/
bool put(LayerSize& size, Layer* layer);