From 6f72bebe92a4db7b5dc83f4ac5b5fd02e3b4e2cd Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 30 Nov 2010 12:04:14 -0800 Subject: Update 9patch structure when rendering with different divs/colors. Bug #3221488 Change-Id: Ifc9e42a991d630feadc9e8032322f37504d09d6d --- libs/hwui/PatchCache.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'libs/hwui/PatchCache.h') diff --git a/libs/hwui/PatchCache.h b/libs/hwui/PatchCache.h index c38cd99..951fba3 100644 --- a/libs/hwui/PatchCache.h +++ b/libs/hwui/PatchCache.h @@ -61,8 +61,65 @@ public: } private: + /** + * Description of a patch. + */ + struct PatchDescription { + PatchDescription(): bitmapWidth(0), bitmapHeight(0), pixelWidth(0), pixelHeight(0), + xCount(0), yCount(0), emptyCount(0), colorKey(0) { + } + + PatchDescription(const float bitmapWidth, const float bitmapHeight, + const float pixelWidth, const float pixelHeight, + const uint32_t xCount, const uint32_t yCount, + const int8_t emptyCount, const uint32_t colorKey): + bitmapWidth(bitmapWidth), bitmapHeight(bitmapHeight), + pixelWidth(pixelWidth), pixelHeight(pixelHeight), + xCount(xCount), yCount(yCount), + emptyCount(emptyCount), colorKey(colorKey) { + } + + PatchDescription(const PatchDescription& description): + bitmapWidth(description.bitmapWidth), bitmapHeight(description.bitmapHeight), + pixelWidth(description.pixelWidth), pixelHeight(description.pixelHeight), + xCount(description.xCount), yCount(description.yCount), + emptyCount(description.emptyCount), colorKey(description.colorKey) { + } + + bool operator<(const PatchDescription& rhs) const { + LTE_FLOAT(bitmapWidth) { + LTE_FLOAT(bitmapHeight) { + LTE_FLOAT(pixelWidth) { + LTE_FLOAT(pixelHeight) { + LTE_INT(xCount) { + LTE_INT(yCount) { + LTE_INT(emptyCount) { + LTE_INT(colorKey) return false; + } + } + } + } + } + } + } + return false; + } + + private: + float bitmapWidth; + float bitmapHeight; + float pixelWidth; + float pixelHeight; + uint32_t xCount; + uint32_t yCount; + int8_t emptyCount; + uint32_t colorKey; + + }; // struct PatchDescription + uint32_t mMaxEntries; KeyedVector mCache; + }; // class PatchCache }; // namespace uirenderer -- cgit v1.1