Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] Don't upload the FrameHistory texture in frames where it's not changing #9257

Merged
merged 2 commits into from
Jun 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/mbgl/renderer/frame_history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ void FrameHistory::record(const TimePoint& now, float zoom, const Duration& dura
}

for (int16_t z = 0; z <= 255; z++) {
std::chrono::duration<float> 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);
const std::chrono::duration<float> 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) {
opacities.data[z] = opacity;
dirty = true;
}
}

dirty = true;

if (zoomIndex != previousZoomIndex) {
previousZoomIndex = zoomIndex;
previousTime = now;
Expand Down