diff options
Diffstat (limited to 'src/mbgl/renderer/painter_background.cpp')
-rw-r--r-- | src/mbgl/renderer/painter_background.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/mbgl/renderer/painter_background.cpp b/src/mbgl/renderer/painter_background.cpp index 4a3e41701d..e8a5342f4a 100644 --- a/src/mbgl/renderer/painter_background.cpp +++ b/src/mbgl/renderer/painter_background.cpp @@ -14,13 +14,20 @@ using namespace style; void Painter::renderBackground(PaintParameters& parameters, const BackgroundLayer& layer) { // Note that for bottommost layers without a pattern, the background color is drawn with // glClear rather than this method. - const BackgroundPaintProperties::Evaluated& properties = layer.impl->paint.evaluated; + const BackgroundPaintProperties::Evaluated& background = layer.impl->paint.evaluated; - if (!properties.get<BackgroundPattern>().to.empty()) { + style::FillPaintProperties::Evaluated properties; + properties.get<FillPattern>() = background.get<BackgroundPattern>(); + properties.get<FillOpacity>() = { background.get<BackgroundOpacity>() }; + properties.get<FillColor>() = { background.get<BackgroundColor>() }; + + const FillProgram::PaintPropertyBinders paintAttibuteData(properties, 0); + + if (!background.get<BackgroundPattern>().to.empty()) { optional<SpriteAtlasPosition> imagePosA = spriteAtlas->getPosition( - properties.get<BackgroundPattern>().from, SpritePatternMode::Repeating); + background.get<BackgroundPattern>().from, SpritePatternMode::Repeating); optional<SpriteAtlasPosition> imagePosB = spriteAtlas->getPosition( - properties.get<BackgroundPattern>().to, SpritePatternMode::Repeating); + background.get<BackgroundPattern>().to, SpritePatternMode::Repeating); if (!imagePosA || !imagePosB) return; @@ -36,17 +43,19 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye colorModeForRenderPass(), FillPatternUniforms::values( matrixForTile(tileID), - properties.get<BackgroundOpacity>(), context.viewport.getCurrentValue().size, *imagePosA, *imagePosB, - properties.get<BackgroundPattern>(), + background.get<BackgroundPattern>(), tileID, state ), tileVertexBuffer, tileTriangleIndexBuffer, - tileTriangleSegments + tileTriangleSegments, + paintAttibuteData, + properties, + state.getZoom() ); } } else { @@ -59,14 +68,14 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye colorModeForRenderPass(), FillProgram::UniformValues { uniforms::u_matrix::Value{ matrixForTile(tileID) }, - uniforms::u_opacity::Value{ properties.get<BackgroundOpacity>() }, - uniforms::u_color::Value{ properties.get<BackgroundColor>() }, - uniforms::u_outline_color::Value{ properties.get<BackgroundColor>() }, uniforms::u_world::Value{ context.viewport.getCurrentValue().size }, }, tileVertexBuffer, tileTriangleIndexBuffer, - tileTriangleSegments + tileTriangleSegments, + paintAttibuteData, + properties, + state.getZoom() ); } } |