From d27740650bb71469ab5a2ce5528d71d59f23ad8a Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 13 Jun 2017 11:28:41 -0700 Subject: [core] Don't upload the FrameHistory texture in frames where it's not changing --- src/mbgl/renderer/frame_history.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp index a933a9004a..35e246f488 100644 --- a/src/mbgl/renderer/frame_history.cpp +++ b/src/mbgl/renderer/frame_history.cpp @@ -39,15 +39,15 @@ 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; - if (z <= zoomIndex) { - opacities.data[z] = util::min(255, changeOpacities[z] + opacityChange); - } else { - opacities.data[z] = util::max(0, changeOpacities[z] - opacityChange); + uint8_t opacity = z <= zoomIndex + ? util::min(255, changeOpacities[z] + opacityChange) + : util::max(0, changeOpacities[z] - opacityChange); + if (opacities.data[z] != opacity) { + opacities.data[z] = opacity; + dirty = true; } } - dirty = true; - if (zoomIndex != previousZoomIndex) { previousZoomIndex = zoomIndex; previousTime = now; -- cgit v1.2.1