[core] Named members for diff before/after
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,12 +10,19 @@
|
||||
|
||||
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>;
|
||||
|
||||
Reference in New Issue
Block a user