Prevent degenerate 9-patches from drawing out of bounds
Bug #7137292

Change-Id: I371e94899445d2f3c6794d5c0aee8faa514d3c2c
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index 6971d8a..abc88fa 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -266,6 +266,11 @@
     const uint32_t oldQuadCount = quadCount;
     quadCount++;
 
+    if (x1 < 0.0f) x1 = 0.0f;
+    if (x2 < 0.0f) x2 = 0.0f;
+    if (y1 < 0.0f) y1 = 0.0f;
+    if (y2 < 0.0f) y2 = 0.0f;
+
     // Skip degenerate and transparent (empty) quads
     if ((mColorKey >> oldQuadCount) & 0x1) {
 #if DEBUG_PATCHES_EMPTY_VERTICES