Skip to content
This repository was 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 1 commit
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
12 changes: 6 additions & 6 deletions src/mbgl/renderer/frame_history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<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);
uint8_t opacity = z <= zoomIndex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

? 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