summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-01-23 16:36:04 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-01-23 16:36:04 +0100
commit2a6e4597e29d440e03416b0cf9d47da4eb2ff781 (patch)
treea616a43e3a80ea267605b97ffbf9b177fbde0231
parent9ba8d5b7a6599ae19e4d6eaccdc7a948a8663aa0 (diff)
downloadqtlocation-mapboxgl-2a6e4597e29d440e03416b0cf9d47da4eb2ff781.tar.gz
pass style into painter
-rw-r--r--include/llmr/map/map.hpp2
-rw-r--r--include/llmr/renderer/painter.hpp4
-rw-r--r--include/llmr/style/style.hpp6
-rw-r--r--src/map/map.cpp2
-rw-r--r--src/renderer/painter.cpp9
5 files changed, 12 insertions, 11 deletions
diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp
index d8babcef66..512830713b 100644
--- a/include/llmr/map/map.hpp
+++ b/include/llmr/map/map.hpp
@@ -60,8 +60,8 @@ private:
private:
Settings& settings;
Transform transform;
- Painter painter;
Style style;
+ Painter painter;
int32_t min_zoom;
int32_t max_zoom;
diff --git a/include/llmr/renderer/painter.hpp b/include/llmr/renderer/painter.hpp
index 85b2b91007..715098bd77 100644
--- a/include/llmr/renderer/painter.hpp
+++ b/include/llmr/renderer/painter.hpp
@@ -11,13 +11,14 @@ namespace llmr {
class Settings;
class Transform;
+class Style;
class FillBucket;
struct FillProperties;
class Painter {
public:
- Painter(Transform& transform, Settings& settings);
+ Painter(Transform& transform, Settings& settings, Style& style);
// Make noncopyable
Painter(const Painter&) = delete;
@@ -49,6 +50,7 @@ public:
private:
Transform& transform;
Settings& settings;
+ Style& style;
float matrix[16];
Shader *currentShader;
diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp
index 6aea83d307..3324e01dc1 100644
--- a/include/llmr/style/style.hpp
+++ b/include/llmr/style/style.hpp
@@ -2,6 +2,7 @@
#define LLMR_STYLE_STYLE
#include <array>
+#include <map>
#include "../util/pbf.hpp"
namespace llmr {
@@ -43,8 +44,9 @@ public:
void reset();
void load(pbf data);
- // StrokeStyle strokeStyle(const std::string& layer_name) const;
- // FillProperties fillStyle(const std::string& layer_name) const;
+public:
+ std::map<std::string, FillProperties> computedFills;
+ std::map<std::string, StrokeProperties> computedStrokes;
};
}
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8470af8a45..6d716fea42 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -13,8 +13,8 @@ using namespace llmr;
Map::Map(Settings& settings)
: settings(settings),
transform(),
- painter(transform, settings),
style(),
+ painter(transform, settings, style),
min_zoom(0),
max_zoom(14) {
}
diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp
index e899e81927..b3e1fee569 100644
--- a/src/renderer/painter.cpp
+++ b/src/renderer/painter.cpp
@@ -39,9 +39,10 @@ GLshort tile_border_vertices[] = {
0, 0
};
-Painter::Painter(Transform& transform, Settings& settings)
+Painter::Painter(Transform& transform, Settings& settings, Style& style)
: transform(transform),
settings(settings),
+ style(style),
currentShader(NULL),
fillShader(NULL),
lineShader(NULL),
@@ -180,11 +181,7 @@ void Painter::render(const Tile::Ptr& tile) {
}
void Painter::renderFill(FillBucket& bucket, const std::string& layer_name) {
- // TODO: obtain the correct style information for this layer
- FillProperties properties;
- properties.fill_color = {{ 0, 0, 1, 0.5 }};
- properties.stroke_color = properties.fill_color;
-
+ const FillProperties& properties = style.computedFills[layer_name];
// Draw the stencil mask.
{