diff options
| author | 2014-09-02 16:17:00 +0000 | |
|---|---|---|
| committer | 2014-09-02 16:17:01 +0000 | |
| commit | 6a08b8f9b424db46518e8f080df96441c5c2457a (patch) | |
| tree | aaccb0209c7aa20430714136d6b642311fb3c8dd | |
| parent | 75f903e1237fa071676871c6cb4f6df46f1e9f86 (diff) | |
| parent | 26131368ecc2e16dfb4965b9165632ee3ca4f1d9 (diff) | |
Merge "Fix the (0,0) vector case for extra vertices computation" into lmp-dev
| -rw-r--r-- | libs/hwui/AmbientShadow.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/AmbientShadow.cpp b/libs/hwui/AmbientShadow.cpp index 7834ef85c750..4873479fdf17 100644 --- a/libs/hwui/AmbientShadow.cpp +++ b/libs/hwui/AmbientShadow.cpp @@ -93,6 +93,10 @@ inline float getTransformedAlphaFromFactoredZ(float factoredZ) { inline int getExtraVertexNumber(const Vector2& vector1, const Vector2& vector2, float divisor) { + // When there is no distance difference, there is no need for extra vertices. + if (vector1.lengthSquared() == 0 || vector2.lengthSquared() == 0) { + return 0; + } // The formula is : // extraNumber = floor(acos(dot(n1, n2)) / (M_PI / EXTRA_VERTEX_PER_PI)) // The value ranges for each step are: |