diff options
author | Romain Guy <romainguy@google.com> | 2013-07-24 18:54:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-24 18:54:11 +0000 |
commit | fb6c743c6e01aa2d4c457d85389a698a193c60b8 (patch) | |
tree | 1ef3aed292e3ab91ecd8da467c64b7675e60e710 /libs/hwui | |
parent | 87c79a18fe03de3b141b95336199b7504ac95c6c (diff) | |
parent | 6cad75744ed3b81cf2c96f545368067b62c726ec (diff) | |
download | frameworks_base-fb6c743c6e01aa2d4c457d85389a698a193c60b8.zip frameworks_base-fb6c743c6e01aa2d4c457d85389a698a193c60b8.tar.gz frameworks_base-fb6c743c6e01aa2d4c457d85389a698a193c60b8.tar.bz2 |
Merge "Fix 9patches' limitation of 32 empty quads"
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/Extensions.cpp | 2 | ||||
-rw-r--r-- | libs/hwui/Patch.cpp | 19 | ||||
-rw-r--r-- | libs/hwui/Patch.h | 2 |
3 files changed, 10 insertions, 13 deletions
diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp index 218c18e..84e7e65 100644 --- a/libs/hwui/Extensions.cpp +++ b/libs/hwui/Extensions.cpp @@ -86,7 +86,7 @@ Extensions::Extensions(): Singleton<Extensions>() { // or more digits. The release number and vendor specific information are // optional." - if (sscanf(version, "OpenGL ES %d.%d", &mVersionMajor, &mVersionMinor) !=2) { + if (sscanf(version, "OpenGL ES %d.%d", &mVersionMajor, &mVersionMinor) != 2) { // If we cannot parse the version number, assume OpenGL ES 2.0 mVersionMajor = 2; mVersionMinor = 0; diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp index 7656f85..9b023f9 100644 --- a/libs/hwui/Patch.cpp +++ b/libs/hwui/Patch.cpp @@ -56,17 +56,14 @@ TextureVertex* Patch::createMesh(const float bitmapWidth, const float bitmapHeig float width, float height, const UvMapper& mapper, const Res_png_9patch* patch) { if (vertices) return vertices; - const uint32_t* colors = &patch->colors[0]; - const int8_t numColors = patch->numColors; - - mColorKey = 0; int8_t emptyQuads = 0; + mColors = patch->colors; + const int8_t numColors = patch->numColors; if (uint8_t(numColors) < sizeof(uint32_t) * 4) { for (int8_t i = 0; i < numColors; i++) { - if (colors[i] == 0x0) { + if (mColors[i] == 0x0) { emptyQuads++; - mColorKey |= 0x1 << i; } } } @@ -221,11 +218,11 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f if (y2 < 0.0f) y2 = 0.0f; // Skip degenerate and transparent (empty) quads - if (((mColorKey >> oldQuadCount) & 0x1) || x1 >= x2 || y1 >= y2) { + if ((mColors[oldQuadCount] == 0) || x1 >= x2 || y1 >= y2) { #if DEBUG_PATCHES_EMPTY_VERTICES PATCH_LOGD(" quad %d (empty)", oldQuadCount); - PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.4f, %.4f", x1, y1, u1, v1); - PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.4f, %.4f", x2, y2, u2, v2); + PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.8f, %.8f", x1, y1, u1, v1); + PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.8f, %.8f", x2, y2, u2, v2); #endif return; } @@ -248,8 +245,8 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f #if DEBUG_PATCHES_VERTICES PATCH_LOGD(" quad %d", oldQuadCount); - PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.4f, %.4f", x1, y1, u1, v1); - PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.4f, %.4f", x2, y2, u2, v2); + PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.8f, %.8f", x1, y1, u1, v1); + PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.8f, %.8f", x2, y2, u2, v2); #endif } diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h index 246ba66..763a785 100644 --- a/libs/hwui/Patch.h +++ b/libs/hwui/Patch.h @@ -66,7 +66,7 @@ private: void generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, uint32_t& quadCount); - uint32_t mColorKey; + uint32_t* mColors; UvMapper mUvMapper; }; // struct Patch |