diff options
author | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 04:45:58 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 04:45:58 +0000 |
commit | 0449fc3ffdf27f391052e2f3ec2510c101c7b5b0 (patch) | |
tree | 62a87cad3918baac72c4382d1650ceafc5f6d3f5 /cc/base | |
parent | fed734a145c6defbf1063b3b9a497aee88db720d (diff) | |
download | chromium_src-0449fc3ffdf27f391052e2f3ec2510c101c7b5b0.zip chromium_src-0449fc3ffdf27f391052e2f3ec2510c101c7b5b0.tar.gz chromium_src-0449fc3ffdf27f391052e2f3ec2510c101c7b5b0.tar.bz2 |
Make cc::FilterOperations blendable
This adds the ability to interpolate between pairs of
cc::FilterOperations. This is needed for threading filter
animations.
BUG=181613
Review URL: https://chromiumcodereview.appspot.com/18690006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/base')
-rw-r--r-- | cc/base/math_util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cc/base/math_util.h b/cc/base/math_util.h index 69dd8d8..cb158dd 100644 --- a/cc/base/math_util.h +++ b/cc/base/math_util.h @@ -5,6 +5,7 @@ #ifndef CC_BASE_MATH_UTIL_H_ #define CC_BASE_MATH_UTIL_H_ +#include <algorithm> #include <cmath> #include "base/logging.h" @@ -79,6 +80,10 @@ class CC_EXPORT MathUtil { return (d > 0.0) ? std::floor(d + 0.5) : std::ceil(d - 0.5); } + template <typename T> static T ClampToRange(T value, T min, T max) { + return std::min(std::max(value, min), max); + } + // Background: Existing transform code does not do the right thing in // MapRect / MapQuad / ProjectQuad when there is a perspective projection that // causes one of the transformed vertices to go to w < 0. In those cases, it |