summaryrefslogtreecommitdiff
path: root/libs/hwui/AmbientShadow.cpp
diff options
context:
space:
mode:
author ztenghui <ztenghui@google.com> 2014-09-01 17:19:51 -0700
committer ztenghui <ztenghui@google.com> 2014-09-01 17:23:27 -0700
commit26131368ecc2e16dfb4965b9165632ee3ca4f1d9 (patch)
treeb1d54a0018e660cb4afb7c65626c949fd58b4ce4 /libs/hwui/AmbientShadow.cpp
parentc8316dfc05f20da2381b5a29ee29bd05b4a85098 (diff)
Fix the (0,0) vector case for extra vertices computation
TODO: Figure out why we have collided vertices from input polygon. b/17340792 Change-Id: I6636ff957ef17514bd11cf290ccc0a2c302aca0b
Diffstat (limited to 'libs/hwui/AmbientShadow.cpp')
-rw-r--r--libs/hwui/AmbientShadow.cpp4
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: