From fc0f4edef3bc333e4a6d2cdbdb89b2836186cb7f Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 15 Jun 2016 17:19:19 +0300 Subject: [PATCH] [core] Fix sublayer depth when drawing stroke Port from -js: https://github.com/mapbox/mapbox-gl-js/commit/002c69071275997886fd98aa4dbc6025eed36a86 --- src/mbgl/renderer/painter_fill.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp index 123215ee2..087dcf2f5 100644 --- a/src/mbgl/renderer/painter_fill.cpp +++ b/src/mbgl/renderer/painter_fill.cpp @@ -64,7 +64,19 @@ void Painter::renderFill(FillBucket& bucket, // Draw the entire line outlineShader->u_world = worldSize; - setDepthSublayer(0); + if (isOutlineColorDefined) { + // If we defined a different color for the fill outline, we are + // going to ignore the bits in 0x07 and just care about the global + // clipping mask. + setDepthSublayer(2); // OK + } else { + // Otherwise, we only want to drawFill the antialiased parts that are + // *outside* the current shape. This is important in case the fill + // or stroke color is translucent. If we wouldn't clip to outside + // the current shape, some pixels from the outline stroke overlapped + // the (non-antialiased) fill. + setDepthSublayer(0); // OK + } bucket.drawVertices(*outlineShader, store); }