summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-15 17:19:19 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-06-15 18:53:05 +0300
commitfc0f4edef3bc333e4a6d2cdbdb89b2836186cb7f (patch)
treeee9068027c9179493a26932b499e9e13a42ee2ef
parent54e3aa185f536bf2ca27e44fe55239b4bfafcb06 (diff)
downloadqtlocation-mapboxgl-fc0f4edef3bc333e4a6d2cdbdb89b2836186cb7f.tar.gz
[core] Fix sublayer depth when drawing stroke
Port from -js: https://github.com/mapbox/mapbox-gl-js/commit/002c69071275997886fd98aa4dbc6025eed36a86
-rw-r--r--src/mbgl/renderer/painter_fill.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp
index 123215ee21..087dcf2f58 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);
}