summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Teng-Hui Zhu <ztenghui@google.com> 2016-10-08 18:34:47 +0000
committer android-build-merger <android-build-merger@google.com> 2016-10-08 18:34:47 +0000
commitb7d34fa725814d83d9d3e95fd70fb22a7e685044 (patch)
tree7d33490bc98db989fa2cd559e9c7d6759eaba05b
parentf4dfa84c74ad1a141dfbe542d6d89e81bd6adb5f (diff)
parent6ff1730df5045e953834dd3be9df6a42f4089590 (diff)
Make umbra lighter when the blocker is too high and has no real umbra area. am: 9c555566bf am: 9ad599930d
am: 6ff1730df5 Change-Id: Ia7855238cfb893d591ff404a1f17ada76dd79ff0
-rw-r--r--libs/hwui/SpotShadow.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/hwui/SpotShadow.cpp b/libs/hwui/SpotShadow.cpp
index e2ee5bf02630..7b0a1bc3e93e 100644
--- a/libs/hwui/SpotShadow.cpp
+++ b/libs/hwui/SpotShadow.cpp
@@ -927,9 +927,13 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength
AlphaVertex::set(&shadowVertices[vertexBufferIndex++], newPenumbra[i].x,
newPenumbra[i].y, PENUMBRA_ALPHA);
}
+ // Since the umbra can be a faked one when the occluder is too high, the umbra should be lighter
+ // in this case.
+ float scaledUmbraAlpha = UMBRA_ALPHA * shadowStrengthScale;
+
for (int i = 0; i < umbraLength; i++) {
AlphaVertex::set(&shadowVertices[vertexBufferIndex++], umbra[i].x, umbra[i].y,
- UMBRA_ALPHA);
+ scaledUmbraAlpha);
}
for (int i = 0; i < verticesPairIndex; i++) {
@@ -969,14 +973,14 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength
indexBuffer[indexBufferIndex++] = newPenumbraLength + i;
indexBuffer[indexBufferIndex++] = vertexBufferIndex;
AlphaVertex::set(&shadowVertices[vertexBufferIndex++],
- closerVertex.x, closerVertex.y, UMBRA_ALPHA);
+ closerVertex.x, closerVertex.y, scaledUmbraAlpha);
}
} else {
// If there is no occluded umbra at all, then draw the triangle fan
// starting from the centroid to all umbra vertices.
int lastCentroidIndex = vertexBufferIndex;
AlphaVertex::set(&shadowVertices[vertexBufferIndex++], centroid.x,
- centroid.y, UMBRA_ALPHA);
+ centroid.y, scaledUmbraAlpha);
for (int i = 0; i < umbraLength; i++) {
indexBuffer[indexBufferIndex++] = newPenumbraLength + i;
indexBuffer[indexBufferIndex++] = lastCentroidIndex;