summaryrefslogtreecommitdiffstats
path: root/libs/hwui/utils
diff options
context:
space:
mode:
authorztenghui <ztenghui@google.com>2014-08-21 13:47:54 -0700
committerztenghui <ztenghui@google.com>2014-08-22 13:51:16 -0700
commitc50a03d78aaedd0003377e98710e7038bda330e9 (patch)
treeb52044852d73bd8d7e08bec4e3cda9be89aafed2 /libs/hwui/utils
parent730e9bceb746e6c50b87cc5a695eb73fea27686e (diff)
downloadframeworks_base-c50a03d78aaedd0003377e98710e7038bda330e9.zip
frameworks_base-c50a03d78aaedd0003377e98710e7038bda330e9.tar.gz
frameworks_base-c50a03d78aaedd0003377e98710e7038bda330e9.tar.bz2
Improve the spot shadow computation.
Get rid of compuation of the intersection for penumbra and convex hull for umbra. Use simple circle / normal to compute the penumbra and simple intersection for umbra. The new way could be 2x to 4x faster from rectangle to round shape. And this part is roughly half of the shadow computation, or 2/3 of spot shadow computation. This improve the spot shadow spikeness too. b/16712006 b/14976551 Change-Id: I02911784868731369efa73f76fc915bc08248600
Diffstat (limited to 'libs/hwui/utils')
-rw-r--r--libs/hwui/utils/MathUtils.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/hwui/utils/MathUtils.h b/libs/hwui/utils/MathUtils.h
index 6fb0411..00448b8 100644
--- a/libs/hwui/utils/MathUtils.h
+++ b/libs/hwui/utils/MathUtils.h
@@ -66,11 +66,13 @@ public:
return isZero(valueA - valueB);
}
- inline static int max(int a, int b) {
+ template<typename T>
+ static inline T max(T a, T b) {
return a > b ? a : b;
}
- inline static int min(int a, int b) {
+ template<typename T>
+ static inline T min(T a, T b) {
return a < b ? a : b;
}