diff options
| author | Derek Sollenberger <djsollen@google.com> | 2014-05-23 15:51:20 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-23 15:51:20 +0000 |
| commit | c33fb2b5c014f37ce36dbc12eff1e969562f7d50 (patch) | |
| tree | b2db1d7f782a9295fa2da11fcc30e2175a24b31d /libs/hwui/utils/Blur.cpp | |
| parent | c250d06a81fab12a9ce6f73636c9eaf43b76121c (diff) | |
| parent | e392c81f6b8f9ace0c0a48c9d4df117fda31fd13 (diff) | |
| download | frameworks_base-c33fb2b5c014f37ce36dbc12eff1e969562f7d50.zip frameworks_base-c33fb2b5c014f37ce36dbc12eff1e969562f7d50.tar.gz frameworks_base-c33fb2b5c014f37ce36dbc12eff1e969562f7d50.tar.bz2 | |
Merge "Pass the radius as a float deeper into HWUI allowing RS to generate more accurate blurs."
Diffstat (limited to 'libs/hwui/utils/Blur.cpp')
| -rw-r--r-- | libs/hwui/utils/Blur.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/hwui/utils/Blur.cpp b/libs/hwui/utils/Blur.cpp index c020b40..877a422 100644 --- a/libs/hwui/utils/Blur.cpp +++ b/libs/hwui/utils/Blur.cpp @@ -19,6 +19,7 @@ #include <math.h> #include "Blur.h" +#include "MathUtils.h" namespace android { namespace uirenderer { @@ -35,6 +36,17 @@ float Blur::convertSigmaToRadius(float sigma) { return sigma > 0.5f ? (sigma - 0.5f) / BLUR_SIGMA_SCALE : 0.0f; } +// if the original radius was on an integer boundary and the resulting radius +// is within the conversion error tolerance then we attempt to snap to the +// original integer boundary. +uint32_t Blur::convertRadiusToInt(float radius) { + const float radiusCeil = ceilf(radius); + if (MathUtils::areEqual(radiusCeil, radius)) { + return radiusCeil; + } + return radius; +} + /** * HWUI has used a slightly different equation than Skia to generate the value * for sigma and to preserve compatibility we have kept that logic. |
