From c44d056c242187ad721211bc097a8202f3e49648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 12 Mar 2014 11:42:17 +0100 Subject: [PATCH] respect style background color --- include/llmr/style/properties.hpp | 8 +++++++- include/llmr/style/style.hpp | 1 + src/renderer/painter.cpp | 4 +--- src/style/style.cpp | 5 ++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/llmr/style/properties.hpp b/include/llmr/style/properties.hpp index 9d05b4ad9..de7b3404b 100644 --- a/include/llmr/style/properties.hpp +++ b/include/llmr/style/properties.hpp @@ -113,9 +113,15 @@ struct FillProperties { }; struct BackgroundClass { - Color fill_color = {{ 0, 0, 0, 0 }}; + Color color = {{ 1, 1, 1, 1 }}; }; + +struct BackgroundProperties { + Color color = {{ 1, 1, 1, 1 }}; +}; + + } #endif diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp index 2b7562244..1b57521f8 100644 --- a/include/llmr/style/style.hpp +++ b/include/llmr/style/style.hpp @@ -52,6 +52,7 @@ public: // This are applied settings. std::set appliedClasses; struct { + BackgroundProperties background; std::map fills; std::map lines; std::map points; diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index deabe0c16..a9094fdfb 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -114,10 +114,8 @@ void Painter::prepareClippingMask() { } void Painter::drawClippingMask(const mat4& matrix, uint8_t clip_id) { - Color fill_color = {{ 1, 1, 1, 1 }}; - plainShader->setMatrix(matrix); - plainShader->setColor(fill_color); + plainShader->setColor(style.computed.background.color); glStencilFunc(GL_ALWAYS, clip_id, 0xFF); glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index()); diff --git a/src/style/style.cpp b/src/style/style.cpp index a17fb8689..8062fc973 100644 --- a/src/style/style.cpp +++ b/src/style/style.cpp @@ -74,6 +74,9 @@ void Style::cascade(float z) { point.opacity = layer.opacity(z); point.image = layer.image; } + + // Cascade background + computed.background.color = sheetClass.background.color; } } @@ -562,7 +565,7 @@ BackgroundClass loadBackgroundClassJSON(const rapidjson::Value& value) { BackgroundClass klass; if (value.HasMember("color")) { - klass.fill_color = parseColor(value["color"]); + klass.color = parseColor(value["color"]); } return klass;