summaryrefslogtreecommitdiffstats
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2015-02-17 13:26:10 -0800
committerztenghui <ztenghui@google.com>2015-04-09 09:57:27 -0700
commitecf091e171012831cddea59f1f64a46e87ee8c4f (patch)
tree80faa269881a6cc562b999dc4d7fedbbf2d0b4a9 /libs/hwui/ProgramCache.cpp
parentb929d65800fcc91c04d385fe9ec23a924868883b (diff)
downloadframeworks_base-ecf091e171012831cddea59f1f64a46e87ee8c4f.zip
frameworks_base-ecf091e171012831cddea59f1f64a46e87ee8c4f.tar.gz
frameworks_base-ecf091e171012831cddea59f1f64a46e87ee8c4f.tar.bz2
Update the shadow fall off function from cosine to gaussian.
Also tune the parameters to match a better look designed by UX team. For ambient part, the acos transformed alpha is not needed any more. b/19370798 Change-Id: I20d2615d1be502eb900942ed756aecd1660dee48
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index e9b22e2..41adda1 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -240,8 +240,9 @@ const char* gFS_Main_ModulateColor =
const char* gFS_Main_ApplyVertexAlphaLinearInterp =
" fragColor *= alpha;\n";
const char* gFS_Main_ApplyVertexAlphaShadowInterp =
- " fragColor *= (1.0 - cos(alpha)) / 2.0;\n";
-
+ // Use a gaussian function for the shadow fall off. Note that alpha here
+ // is actually (1.0 - alpha) for saving computation.
+ " fragColor *= exp(- alpha * alpha * 4.0) - 0.018;\n";
const char* gFS_Main_FetchTexture[2] = {
// Don't modulate
" fragColor = texture2D(baseSampler, outTexCoords);\n",