diff options
author | Chris Craik <ccraik@google.com> | 2014-08-07 14:34:46 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-08-07 22:26:55 +0000 |
commit | 74cf7e6a25c6d7b331c231b7bc2512044f9d2950 (patch) | |
tree | 18e658508fa40721ce7c9ceb4308d875c8d718f3 /libs/hwui/utils | |
parent | d224a9dfd2d2f1977e7a40ba3bbfb42a4165aedc (diff) | |
download | frameworks_base-74cf7e6a25c6d7b331c231b7bc2512044f9d2950.zip frameworks_base-74cf7e6a25c6d7b331c231b7bc2512044f9d2950.tar.gz frameworks_base-74cf7e6a25c6d7b331c231b7bc2512044f9d2950.tar.bz2 |
Cap scales used for tessellation with minimum and maximum
bug:15615144
Change-Id: I3e833864af3a7b34e444bd13db34b6c90496a8b6
Diffstat (limited to 'libs/hwui/utils')
-rw-r--r-- | libs/hwui/utils/MathUtils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/hwui/utils/MathUtils.h b/libs/hwui/utils/MathUtils.h index 66bc127..6fb0411 100644 --- a/libs/hwui/utils/MathUtils.h +++ b/libs/hwui/utils/MathUtils.h @@ -35,6 +35,9 @@ public: return value >= NON_ZERO_EPSILON; } + /** + * Clamps alpha value, and snaps when very near 0 or 1 + */ inline static float clampAlpha(float alpha) { if (alpha <= ALPHA_EPSILON) { return 0; @@ -45,6 +48,20 @@ public: } } + /* + * Clamps positive tessellation scale values + */ + inline static float clampTessellationScale(float scale) { + const float MIN_SCALE = 0.0001; + const float MAX_SCALE = 1e10; + if (scale < MIN_SCALE) { + return MIN_SCALE; + } else if (scale > MAX_SCALE) { + return MAX_SCALE; + } + return scale; + } + inline static bool areEqual(float valueA, float valueB) { return isZero(valueA - valueB); } |