summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2016-10-06 21:06:36 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-10-06 21:06:36 +0000
commit9ad599930ddc62404d28155f8b200ccdcfa03963 (patch)
tree05788aca616b8cc43f940102690aa343b2f089d0 /libs
parentf4e866947f7af0aaab0f52bd627f1ecc5dfd30aa (diff)
parent9c555566bfef718464546dcab3640f64d2fdc55d (diff)
downloadbase-9ad599930ddc62404d28155f8b200ccdcfa03963.tar.gz
Make umbra lighter when the blocker is too high and has no real umbra area.
am: 9c555566bf Change-Id: I785f5a25aae97f8852bb1cc4833f2662411eabc3
Diffstat (limited to 'libs')
-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 760d814f27a8..cc96a137c306 100644
--- a/libs/hwui/SpotShadow.cpp
+++ b/libs/hwui/SpotShadow.cpp
@@ -942,9 +942,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++) {
@@ -984,14 +988,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;