summaryrefslogtreecommitdiff
path: root/libs/hwui/SpotShadow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/SpotShadow.cpp')
-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;