aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOliver Eftevaag <[email protected]>2022-06-14 16:07:44 +0200
committerOliver Eftevaag <[email protected]>2023-08-13 14:34:43 +0200
commitefed2109c31c69f5eadb2b5ed40d36afdfa3dc37 (patch)
tree2cdcad7bdaec9d5e01d24e296d0d4380eefa4b37 /src
parent5fd2223d44133a1b328b4f88004a802d18e81af8 (diff)
Remove unnecessary negating of values
For some reason, the argument for the Round() function would be negated before the function call, and then negated again after the function call. I cant imagine any cenario where the resulting value from the expression would be different, if I simply remove those minus signs. Change-Id: I8d752516f46bb82bd8227583d259078b10b4d333 Reviewed-by: Edward Welbourne <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickflickable.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 66c8ae9375..a34ffac20a 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -371,7 +371,7 @@ bool QQuickFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExt
qreal dist = v2 / (accel * 2.0);
if (v > 0)
dist = -dist;
- qreal target = -std::round(-(data.move.value() - dist));
+ qreal target = std::round(data.move.value() - dist);
dist = -target + data.move.value();
accel = v2 / (2.0f * qAbs(dist));
@@ -497,14 +497,14 @@ void QQuickFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal maxExt
// We could animate, but since it is less than 0.5 pixel it's probably not worthwhile.
resetTimeline(data);
qreal val = data.move.value();
- if (qAbs(-std::round(-val) - val) < 0.25) // round small differences
- val = -std::round(-val);
+ if (std::abs(std::round(val) - val) < 0.25) // round small differences
+ val = std::round(val);
else if (data.smoothVelocity.value() > 0) // continue direction of motion for larger
- val = -qFloor(-val);
+ val = std::ceil(val);
else if (data.smoothVelocity.value() < 0)
- val = -qCeil(-val);
+ val = std::floor(val);
else // otherwise round
- val = -std::round(-val);
+ val = std::round(val);
timeline.set(data.move, val);
}
data.inOvershoot = false;