diff options
author | 2013-02-12 16:08:55 -0800 | |
---|---|---|
committer | 2013-02-13 11:27:05 -0800 | |
commit | 8d4aeb7111afac0c3c7e56d4ad5d92f9cfce2ffd (patch) | |
tree | d526296ca8e54842b15b60adaad484ee29feccf2 /libs/hwui/LayerCache.h | |
parent | d1a84242a7ba807310d8f8d389796c7163cb97a0 (diff) |
Add a render buffer cache to reuse stencil buffers
Bug #7146141
This new cache is used in a similar way to LayerCache. It helps
reuse already allocated stencil buffers and thus avoid churning
memory on every frame.
Change-Id: I19551d72da52c40039e65904563600e492c8b193
Diffstat (limited to 'libs/hwui/LayerCache.h')
-rw-r--r-- | libs/hwui/LayerCache.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h index 7720b4232ae9..221bfe000de1 100644 --- a/libs/hwui/LayerCache.h +++ b/libs/hwui/LayerCache.h @@ -19,7 +19,6 @@ #include "Debug.h" #include "Layer.h" -#include "Properties.h" #include "utils/SortedList.h" namespace android { @@ -54,7 +53,7 @@ public: * size of the cache goes down. * * @param width The desired width of the layer - * @param width The desired height of the layer + * @param height The desired height of the layer */ Layer* get(const uint32_t width, const uint32_t height); @@ -91,6 +90,7 @@ public: */ void dump(); +private: struct LayerEntry { LayerEntry(): mLayer(NULL), mWidth(0), mHeight(0) { @@ -115,12 +115,19 @@ public: return compare(*this, other) != 0; } + friend inline int strictly_order_type(const LayerEntry& lhs, const LayerEntry& rhs) { + return LayerEntry::compare(lhs, rhs) < 0; + } + + friend inline int compare_type(const LayerEntry& lhs, const LayerEntry& rhs) { + return LayerEntry::compare(lhs, rhs); + } + Layer* mLayer; uint32_t mWidth; uint32_t mHeight; }; // struct LayerEntry -private: void deleteLayer(Layer* layer); SortedList<LayerEntry> mCache; @@ -129,15 +136,6 @@ private: uint32_t mMaxSize; }; // class LayerCache -inline int strictly_order_type(const LayerCache::LayerEntry& lhs, - const LayerCache::LayerEntry& rhs) { - return LayerCache::LayerEntry::compare(lhs, rhs) < 0; -} - -inline int compare_type(const LayerCache::LayerEntry& lhs, const LayerCache::LayerEntry& rhs) { - return LayerCache::LayerEntry::compare(lhs, rhs); -} - }; // namespace uirenderer }; // namespace android |