diff options
author | Romain Guy <romainguy@google.com> | 2011-01-16 15:16:38 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-01-16 15:16:38 -0800 |
commit | fb13abd800cd610c7f46815848545feff83e5748 (patch) | |
tree | 299f1c241fc360cbf3016adee07ac3db46750203 /libs | |
parent | 90fc03bc493fc2c984599b198b9d50bc387134f2 (diff) | |
download | frameworks_base-fb13abd800cd610c7f46815848545feff83e5748.zip frameworks_base-fb13abd800cd610c7f46815848545feff83e5748.tar.gz frameworks_base-fb13abd800cd610c7f46815848545feff83e5748.tar.bz2 |
Fix 9patch rendering in ExpandableListView.
Change-Id: I60843d61a40b0cb7dd09923cb4489a5a76f20486
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/Debug.h | 4 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/Patch.cpp | 15 | ||||
-rw-r--r-- | libs/hwui/Patch.h | 2 |
4 files changed, 19 insertions, 9 deletions
diff --git a/libs/hwui/Debug.h b/libs/hwui/Debug.h index bdd8e73..71ec760 100644 --- a/libs/hwui/Debug.h +++ b/libs/hwui/Debug.h @@ -37,6 +37,10 @@ // Turn on to display vertex and tex coords data about 9patch objects // This flag requires DEBUG_PATCHES to be turned on #define DEBUG_PATCHES_VERTICES 0 +// Turn on to display vertex and tex coords data used by empty quads +// in 9patch objects +// This flag requires DEBUG_PATCHES to be turned on +#define DEBUG_PATCHES_EMPTY_VERTICES 0 // Turn on to display debug info about paths #define DEBUG_PATHS 0 diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index cd2554e..e6bea78 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -29,10 +29,6 @@ namespace uirenderer { void LayerRenderer::prepare(bool opaque) { LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->fbo); -#if RENDER_LAYERS_AS_REGIONS - mLayer->region.clear(); -#endif - glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &mPreviousFbo); glBindFramebuffer(GL_FRAMEBUFFER, mLayer->fbo); @@ -78,6 +74,7 @@ void LayerRenderer::generateMesh() { mLayer->meshIndices = NULL; mLayer->meshElementCount = 0; } + mLayer->region.clear(); return; } @@ -129,6 +126,8 @@ void LayerRenderer::generateMesh() { indices[index + 4] = quad + 1; // top-right indices[index + 5] = quad + 3; // bottom-right } + + mLayer->region.clear(); #endif } diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp index e5cb67b..77cbb80 100644 --- a/libs/hwui/Patch.cpp +++ b/libs/hwui/Patch.cpp @@ -212,7 +212,7 @@ void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, fl } float u2 = fmax(0.0f, stepX - 0.5f) / bitmapWidth; - generateQuad(vertex, x1, y1, x2, y2, u1, v1, u2, v2, quadCount); + bool valid = generateQuad(vertex, x1, y1, x2, y2, u1, v1, u2, v2, quadCount); x1 = x2; u1 = (stepX + 0.5f) / bitmapWidth; @@ -223,17 +223,22 @@ void Patch::generateRow(TextureVertex*& vertex, float y1, float y2, float v1, fl generateQuad(vertex, x1, y1, width, y2, u1, v1, 1.0f, v2, quadCount); } -void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, +bool Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, uint32_t& quadCount) { const uint32_t oldQuadCount = quadCount; - const bool valid = x2 - x1 > 0.9999f && y2 - y1 > 0.9999f; + const bool valid = x2 >= x1 && y2 >= y1; if (valid) { quadCount++; } // Skip degenerate and transparent (empty) quads if (!valid || ((mColorKey >> oldQuadCount) & 0x1) == 1) { - return; +#if DEBUG_PATCHES_EMPTY_VERTICES + PATCH_LOGD(" quad %d (empty)", oldQuadCount); + PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.2f, %.2f", x1, y1, u1, v1); + PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.2f, %.2f", x2, y2, u2, v2); +#endif + return false; } #if RENDER_LAYERS_AS_REGIONS @@ -262,6 +267,8 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f PATCH_LOGD(" left, top = %.2f, %.2f\t\tu1, v1 = %.2f, %.2f", x1, y1, u1, v1); PATCH_LOGD(" right, bottom = %.2f, %.2f\t\tu2, v2 = %.2f, %.2f", x2, y2, u2, v2); #endif + + return true; } }; // namespace uirenderer diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h index 0f0ffa2..45ce998 100644 --- a/libs/hwui/Patch.h +++ b/libs/hwui/Patch.h @@ -71,7 +71,7 @@ private: void generateRow(TextureVertex*& vertex, float y1, float y2, float v1, float v2, float stretchX, float width, float bitmapWidth, uint32_t& quadCount); - void generateQuad(TextureVertex*& vertex, + bool generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2, uint32_t& quadCount); |