summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-06-01 08:26:24 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-06-05 19:38:08 -0700
commit5d5f9405b4f20ea208916ade17fe085c240ce8c2 (patch)
tree6ddbece98f34fc9045c3c3d8537b99e4fdbfa5e3 /src
parent9dfc2d924d440560adb2db13c758b2c5b3b7dd47 (diff)
downloadqtlocation-mapboxgl-5d5f9405b4f20ea208916ade17fe085c240ce8c2.tar.gz
[core] Named members for diff before/after
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/render_style.cpp4
-rw-r--r--src/mbgl/renderer/style_diff.cpp4
-rw-r--r--src/mbgl/renderer/style_diff.hpp9
3 files changed, 12 insertions, 5 deletions
diff --git a/src/mbgl/renderer/render_style.cpp b/src/mbgl/renderer/render_style.cpp
index dc49a20646..0998722f75 100644
--- a/src/mbgl/renderer/render_style.cpp
+++ b/src/mbgl/renderer/render_style.cpp
@@ -134,7 +134,7 @@ void RenderStyle::update(const UpdateParameters& parameters) {
// Update changed images.
for (const auto& entry : imageDiff.changed) {
- spriteAtlas->updateImage(entry.second[1]);
+ spriteAtlas->updateImage(entry.second.after);
}
if (parameters.spriteLoaded && !spriteAtlas->isLoaded()) {
@@ -157,7 +157,7 @@ void RenderStyle::update(const UpdateParameters& parameters) {
// Update render layers for changed layers.
for (const auto& entry : layerDiff.changed) {
- renderLayers.at(entry.first)->setImpl(entry.second[1]);
+ renderLayers.at(entry.first)->setImpl(entry.second.after);
}
// Update layers for class and zoom changes.
diff --git a/src/mbgl/renderer/style_diff.cpp b/src/mbgl/renderer/style_diff.cpp
index cd547f2a0b..0017280310 100644
--- a/src/mbgl/renderer/style_diff.cpp
+++ b/src/mbgl/renderer/style_diff.cpp
@@ -33,7 +33,7 @@ StyleDifference<T> diff(const Immutable<std::vector<T>>& a,
bIt++;
} else {
if (aIt->get() != bIt->get()) {
- result.changed.emplace((*bIt)->id, std::array<T, 2> {{ *aIt, *bIt }});
+ result.changed.emplace((*bIt)->id, StyleChange<T> { *aIt, *bIt });
}
aIt++;
bIt++;
@@ -73,7 +73,7 @@ bool hasLayoutDifference(const LayerDifference& layerDiff, const std::string& la
const auto it = layerDiff.changed.find(layerID);
if (it == layerDiff.changed.end())
return false;
- return it->second[0]->hasLayoutDifference(*it->second[1]);
+ return it->second.before->hasLayoutDifference(*it->second.after);
}
} // namespace mbgl
diff --git a/src/mbgl/renderer/style_diff.hpp b/src/mbgl/renderer/style_diff.hpp
index ef788c380c..a5b42fc662 100644
--- a/src/mbgl/renderer/style_diff.hpp
+++ b/src/mbgl/renderer/style_diff.hpp
@@ -11,11 +11,18 @@
namespace mbgl {
template <class T>
+class StyleChange {
+public:
+ T before;
+ T after;
+};
+
+template <class T>
class StyleDifference {
public:
std::unordered_map<std::string, T> added;
std::unordered_map<std::string, T> removed;
- std::unordered_map<std::string, std::array<T, 2>> changed;
+ std::unordered_map<std::string, StyleChange<T>> changed;
};
using ImmutableImage = Immutable<style::Image::Impl>;