summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-10-10 17:16:34 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-10 17:16:34 -0700
commit1460c8ca094e2e1cbf19a71319341fbc7678cfd9 (patch)
tree5dbbd1ac07bed442a7bf35129ebe3d5626fb954e
parent38a642401332088cb8e09b23b6cdb617a7a70ccd (diff)
parentc37f349ecff54f15ed31d57c1b886897c91430af (diff)
downloadframeworks_base-1460c8ca094e2e1cbf19a71319341fbc7678cfd9.zip
frameworks_base-1460c8ca094e2e1cbf19a71319341fbc7678cfd9.tar.gz
frameworks_base-1460c8ca094e2e1cbf19a71319341fbc7678cfd9.tar.bz2
Merge "Prevent possible divide by 0 Bug #7307304" into jb-mr1-dev
-rw-r--r--libs/hwui/Patch.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/hwui/Patch.cpp b/libs/hwui/Patch.cpp
index b3631df..902c82f 100644
--- a/libs/hwui/Patch.cpp
+++ b/libs/hwui/Patch.cpp
@@ -134,7 +134,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight,
const float fixed = bitmapWidth - stretchSize;
const float xStretch = fmaxf(right - left - fixed, 0.0f);
stretchX = xStretch / xStretchTex;
- rescaleX = fminf(fmaxf(right - left, 0.0f) / fixed, 1.0f);
+ rescaleX = fixed == 0.0f ? 0.0f : fminf(fmaxf(right - left, 0.0f) / fixed, 1.0f);
}
if (yStretchCount > 0) {
@@ -146,7 +146,7 @@ void Patch::updateVertices(const float bitmapWidth, const float bitmapHeight,
const float fixed = bitmapHeight - stretchSize;
const float yStretch = fmaxf(bottom - top - fixed, 0.0f);
stretchY = yStretch / yStretchTex;
- rescaleY = fminf(fmaxf(bottom - top, 0.0f) / fixed, 1.0f);
+ rescaleY = fixed == 0.0f ? 0.0f : fminf(fmaxf(bottom - top, 0.0f) / fixed, 1.0f);
}
TextureVertex* vertex = mVertices;