Don't render degenerate triangles in 9patches.
Bug #3251983
Change-Id: Ib0b38a7b8111542372f4c4c106b6321c26fe4ad4
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 60343e0..f3e5b16 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -936,7 +936,8 @@
const Patch* mesh = mCaches.patchCache.get(bitmap->width(), bitmap->height(),
right - left, bottom - top, xDivs, yDivs, colors, width, height, numColors);
- if (mesh) {
+ if (mesh && mesh->verticesCount > 0) {
+#if RENDER_LAYERS_AS_REGIONS
// Mark the current layer dirty where we are going to draw the patch
if ((mSnapshot->flags & Snapshot::kFlagFboTarget) &&
mSnapshot->region && mesh->hasEmptyQuads) {
@@ -947,14 +948,12 @@
*mSnapshot->transform);
}
}
+#endif
drawTextureMesh(left, top, right, bottom, texture->id, alpha / 255.0f,
mode, texture->blend, (GLvoid*) 0, (GLvoid*) gMeshTextureOffset,
GL_TRIANGLES, mesh->verticesCount, false, false, mesh->meshBuffer,
true, !mesh->hasEmptyQuads);
- } else {
- PATCH_LOGD("Invisible 9patch, ignoring (%.2f, %.2f, %.2f, %.2f)",
- left, top, right, bottom);
}
}