summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Patch.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-09-10 17:40:18 -0700
committerRomain Guy <romainguy@google.com>2012-09-10 17:40:18 -0700
commit70561df470c31513056df181571632851fd0d081 (patch)
tree371119049d622a7c524017ad0cf3900bd5e53a96 /libs/hwui/Patch.cpp
parent753e1280cbc3f0006b04f67385f02e1f92019f7d (diff)
downloadframeworks_base-70561df470c31513056df181571632851fd0d081.zip
frameworks_base-70561df470c31513056df181571632851fd0d081.tar.gz
frameworks_base-70561df470c31513056df181571632851fd0d081.tar.bz2
Prevent degenerate 9-patches from drawing out of bounds
Bug #7137292 Change-Id: I371e94899445d2f3c6794d5c0aee8faa514d3c2c
Diffstat (limited to 'libs/hwui/Patch.cpp')
-rw-r--r--libs/hwui/Patch.cpp5
1 files changed, 5 insertions, 0 deletions
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 @@ void Patch::generateQuad(TextureVertex*& vertex, float x1, float y1, float x2, f
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