respect style background color

This commit is contained in:
Konstantin Käfer
2014-03-12 11:42:17 +01:00
parent e1868194d9
commit c44d056c24
4 changed files with 13 additions and 5 deletions

View File

@@ -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

View File

@@ -52,6 +52,7 @@ public:
// This are applied settings.
std::set<std::string> appliedClasses;
struct {
BackgroundProperties background;
std::map<std::string, FillProperties> fills;
std::map<std::string, LineProperties> lines;
std::map<std::string, PointProperties> points;

View File

@@ -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());

View File

@@ -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;