From 5e0018cdc3844994bf4afdc0a5e6ae90636c9967 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 13 Jun 2017 13:57:52 -0700 Subject: [core] Add consts --- src/mbgl/renderer/frame_history.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp index 35e246f488..869222b4eb 100644 --- a/src/mbgl/renderer/frame_history.cpp +++ b/src/mbgl/renderer/frame_history.cpp @@ -37,9 +37,9 @@ void FrameHistory::record(const TimePoint& now, float zoom, const Duration& dura } for (int16_t z = 0; z <= 255; z++) { - std::chrono::duration timeDiff = now - changeTimes[z]; - int32_t opacityChange = (duration == Milliseconds(0) ? 1 : (timeDiff / duration)) * 255; - uint8_t opacity = z <= zoomIndex + const std::chrono::duration timeDiff = now - changeTimes[z]; + const int32_t opacityChange = (duration == Milliseconds(0) ? 1 : (timeDiff / duration)) * 255; + const uint8_t opacity = z <= zoomIndex ? util::min(255, changeOpacities[z] + opacityChange) : util::max(0, changeOpacities[z] - opacityChange); if (opacities.data[z] != opacity) { -- cgit v1.2.1