summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-08-12 13:06:28 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-08-24 13:06:23 -0700
commitad70cd30efe6befca858bc1c428fd95d82b3585a (patch)
treed3ca8782e383f2bcbd9715676c57d52f73f64d06
parent47ac22b6ac1290cbf3e3db65dea05d0c60796ddf (diff)
downloadqtlocation-mapboxgl-ad70cd30efe6befca858bc1c428fd95d82b3585a.tar.gz
[core] Inline RenderItem and RenderData
-rw-r--r--cmake/core-files.cmake1
-rw-r--r--src/mbgl/renderer/render_item.hpp36
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp31
3 files changed, 18 insertions, 50 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake
index 27af6e59f9..6b88fc9803 100644
--- a/cmake/core-files.cmake
+++ b/cmake/core-files.cmake
@@ -183,7 +183,6 @@ set(MBGL_CORE_FILES
src/mbgl/renderer/possibly_evaluated_property_value.hpp
src/mbgl/renderer/property_evaluation_parameters.hpp
src/mbgl/renderer/property_evaluator.hpp
- src/mbgl/renderer/render_item.hpp
src/mbgl/renderer/render_layer.cpp
src/mbgl/renderer/render_layer.hpp
src/mbgl/renderer/render_light.cpp
diff --git a/src/mbgl/renderer/render_item.hpp b/src/mbgl/renderer/render_item.hpp
deleted file mode 100644
index 4bf5629263..0000000000
--- a/src/mbgl/renderer/render_item.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-
-#include <mbgl/util/color.hpp>
-
-#include <unordered_set>
-#include <vector>
-
-namespace mbgl {
-
-class RenderLayer;
-class RenderSource;
-class RenderTile;
-class Bucket;
-
-namespace style {
-} // namespace style
-
-class RenderItem {
-public:
- RenderItem(RenderLayer& layer_,
- RenderSource* renderSource_)
- : layer(layer_), source(renderSource_) {
- }
-
- RenderLayer& layer;
- RenderSource* source;
-};
-
-class RenderData {
-public:
- Color backgroundColor;
- std::unordered_set<RenderSource*> sources;
- std::vector<RenderItem> order;
-};
-
-} // namespace mbgl
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index ae21c35152..18b0ab08f5 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -1,13 +1,11 @@
#include <mbgl/renderer/renderer_impl.hpp>
#include <mbgl/renderer/render_static_data.hpp>
-#include <mbgl/renderer/render_item.hpp>
#include <mbgl/renderer/update_parameters.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/transition_parameters.hpp>
#include <mbgl/renderer/property_evaluation_parameters.hpp>
#include <mbgl/renderer/tile_parameters.hpp>
#include <mbgl/renderer/render_source.hpp>
-#include <mbgl/renderer/render_item.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/layers/render_background_layer.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
@@ -296,16 +294,23 @@ void Renderer::Impl::doRender(PaintParameters& parameters) {
parameters.context.setDirtyState();
}
- RenderData renderData;
- const std::vector<RenderItem>& order = renderData.order;
- const std::unordered_set<RenderSource*>& sources = renderData.sources;
-
+ std::unordered_set<RenderSource*> sources;
for (const auto& entry : renderSources) {
if (entry.second->isEnabled()) {
- renderData.sources.insert(entry.second.get());
+ sources.insert(entry.second.get());
}
}
+ Color backgroundColor;
+
+ class RenderItem {
+ public:
+ RenderLayer& layer;
+ RenderSource* source;
+ };
+
+ std::vector<RenderItem> order;
+
for (auto& layerImpl : *layerImpls) {
RenderLayer* layer = getRenderLayer(layerImpl->id);
assert(layer);
@@ -317,22 +322,22 @@ void Renderer::Impl::doRender(PaintParameters& parameters) {
if (const RenderBackgroundLayer* background = layer->as<RenderBackgroundLayer>()) {
if (parameters.debugOptions & MapDebugOptions::Overdraw) {
// We want to skip glClear optimization in overdraw mode.
- renderData.order.emplace_back(*layer, nullptr);
+ order.emplace_back(RenderItem { *layer, nullptr });
continue;
}
const BackgroundPaintProperties::PossiblyEvaluated& paint = background->evaluated;
if (layerImpl.get() == layerImpls->at(0).get() && paint.get<BackgroundPattern>().from.empty()) {
// This is a solid background. We can use glClear().
- renderData.backgroundColor = paint.get<BackgroundColor>() * paint.get<BackgroundOpacity>();
+ backgroundColor = paint.get<BackgroundColor>() * paint.get<BackgroundOpacity>();
} else {
// This is a textured background, or not the bottommost layer. We need to render it with a quad.
- renderData.order.emplace_back(*layer, nullptr);
+ order.emplace_back(RenderItem { *layer, nullptr });
}
continue;
}
if (layer->is<RenderCustomLayer>()) {
- renderData.order.emplace_back(*layer, nullptr);
+ order.emplace_back(RenderItem { *layer, nullptr });
continue;
}
@@ -396,7 +401,7 @@ void Renderer::Impl::doRender(PaintParameters& parameters) {
}
}
layer->setRenderTiles(std::move(sortedTilesForInsertion));
- renderData.order.emplace_back(*layer, source);
+ order.emplace_back(RenderItem { *layer, source });
}
frameHistory.record(parameters.timePoint,
@@ -421,7 +426,7 @@ void Renderer::Impl::doRender(PaintParameters& parameters) {
parameters.backend.bind();
parameters.context.clear((parameters.debugOptions & MapDebugOptions::Overdraw)
? Color::black()
- : renderData.backgroundColor,
+ : backgroundColor,
1.0f,
0);
}