diff options
Diffstat (limited to 'src/mbgl/renderer/painter_fill.cpp')
-rw-r--r-- | src/mbgl/renderer/painter_fill.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp index 1ac90a2806..ed0b3eec53 100644 --- a/src/mbgl/renderer/painter_fill.cpp +++ b/src/mbgl/renderer/painter_fill.cpp @@ -18,19 +18,11 @@ void Painter::renderFill(FillBucket& bucket, translatedMatrix(matrix, properties.fillTranslate, tileID, properties.fillTranslateAnchor); Color fill_color = properties.fillColor; - fill_color[0] *= properties.fillOpacity; - fill_color[1] *= properties.fillOpacity; - fill_color[2] *= properties.fillOpacity; - fill_color[3] *= properties.fillOpacity; + float opacity = properties.fillOpacity; Color stroke_color = properties.fillOutlineColor; if (stroke_color[3] < 0) { stroke_color = fill_color; - } else { - stroke_color[0] *= properties.fillOpacity; - stroke_color[1] *= properties.fillOpacity; - stroke_color[2] *= properties.fillOpacity; - stroke_color[3] *= properties.fillOpacity; } bool pattern = !properties.fillPattern.value.from.empty(); @@ -41,6 +33,7 @@ void Painter::renderFill(FillBucket& bucket, if (wireframe) { fill_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }}; stroke_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }}; + opacity = 1.0f; pattern = false; outline = true; fringeline = true; @@ -60,6 +53,7 @@ void Painter::renderFill(FillBucket& bucket, config.lineWidth = 2.0f; // This is always fixed and does not depend on the pixelRatio! outlineShader->u_color = stroke_color; + outlineShader->u_opacity = opacity; // Draw the entire line outlineShader->u_world = {{ @@ -164,7 +158,7 @@ void Painter::renderFill(FillBucket& bucket, } } else if (!wireframe) { // No image fill. - if ((fill_color[3] >= 1.0f) == (pass == RenderPass::Opaque)) { + if ((fill_color[3] >= 1.0f && opacity >= 1.0f) == (pass == RenderPass::Opaque)) { // Only draw the fill when it's either opaque and we're drawing opaque // fragments or when it's translucent and we're drawing translucent // fragments @@ -172,6 +166,7 @@ void Painter::renderFill(FillBucket& bucket, config.program = plainShader->getID(); plainShader->u_matrix = vtxMatrix; plainShader->u_color = fill_color; + plainShader->u_opacity = opacity; // Draw the actual triangles into the color & stencil buffer. setDepthSublayer(1); @@ -187,7 +182,8 @@ void Painter::renderFill(FillBucket& bucket, config.lineWidth = 2.0f; // This is always fixed and does not depend on the pixelRatio! outlineShader->u_color = fill_color; - + outlineShader->u_opacity = opacity; + // Draw the entire line outlineShader->u_world = {{ static_cast<float>(frame.framebufferSize[0]), |