summaryrefslogtreecommitdiff
path: root/libs/hwui/Interpolator.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2017-11-03 10:12:19 -0700
committerJohn Reck <jreck@google.com>2017-11-03 10:57:44 -0700
commit1bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52 (patch)
tree4a1366cf2d1cf50b5ec4ed1a8cf0f437053cd0d7 /libs/hwui/Interpolator.cpp
parent30ec71c0fe194a551d2e4abaff2159e0730488e0 (diff)
Format the world (or just HWUI)
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
Diffstat (limited to 'libs/hwui/Interpolator.cpp')
-rw-r--r--libs/hwui/Interpolator.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/libs/hwui/Interpolator.cpp b/libs/hwui/Interpolator.cpp
index d740c038f36d..7bdca2ee0f00 100644
--- a/libs/hwui/Interpolator.cpp
+++ b/libs/hwui/Interpolator.cpp
@@ -54,8 +54,10 @@ static float o(float t, float s) {
}
float AnticipateOvershootInterpolator::interpolate(float t) {
- if (t < 0.5f) return 0.5f * a(t * 2.0f, mTension);
- else return 0.5f * (o(t * 2.0f - 2.0f, mTension) + 2.0f);
+ if (t < 0.5f)
+ return 0.5f * a(t * 2.0f, mTension);
+ else
+ return 0.5f * (o(t * 2.0f - 2.0f, mTension) + 2.0f);
}
static float bounce(float t) {
@@ -64,10 +66,14 @@ static float bounce(float t) {
float BounceInterpolator::interpolate(float t) {
t *= 1.1226f;
- if (t < 0.3535f) return bounce(t);
- else if (t < 0.7408f) return bounce(t - 0.54719f) + 0.7f;
- else if (t < 0.9644f) return bounce(t - 0.8526f) + 0.9f;
- else return bounce(t - 1.0435f) + 0.95f;
+ if (t < 0.3535f)
+ return bounce(t);
+ else if (t < 0.7408f)
+ return bounce(t - 0.54719f) + 0.7f;
+ else if (t < 0.9644f)
+ return bounce(t - 0.8526f) + 0.9f;
+ else
+ return bounce(t - 1.0435f) + 0.95f;
}
float CycleInterpolator::interpolate(float input) {
@@ -119,16 +125,11 @@ float PathInterpolator::interpolate(float t) {
float startY = mY[startIndex];
float endY = mY[endIndex];
return startY + (fraction * (endY - startY));
-
}
-LUTInterpolator::LUTInterpolator(float* values, size_t size)
- : mValues(values)
- , mSize(size) {
-}
+LUTInterpolator::LUTInterpolator(float* values, size_t size) : mValues(values), mSize(size) {}
-LUTInterpolator::~LUTInterpolator() {
-}
+LUTInterpolator::~LUTInterpolator() {}
float LUTInterpolator::interpolate(float input) {
// lut position should only be at the end of the table when input is 1f.
@@ -140,10 +141,12 @@ float LUTInterpolator::interpolate(float input) {
float ipart, weight;
weight = modff(lutpos, &ipart);
- int i1 = (int) ipart;
- int i2 = std::min(i1 + 1, (int) mSize - 1);
+ int i1 = (int)ipart;
+ int i2 = std::min(i1 + 1, (int)mSize - 1);
- LOG_ALWAYS_FATAL_IF(i1 < 0 || i2 < 0, "negatives in interpolation!"
+ LOG_ALWAYS_FATAL_IF(
+ i1 < 0 || i2 < 0,
+ "negatives in interpolation!"
" i1=%d, i2=%d, input=%f, lutpos=%f, size=%zu, values=%p, ipart=%f, weight=%f",
i1, i2, input, lutpos, mSize, mValues.get(), ipart, weight);
@@ -153,6 +156,5 @@ float LUTInterpolator::interpolate(float input) {
return MathUtils::lerp(v1, v2, weight);
}
-
} /* namespace uirenderer */
} /* namespace android */