From dec5eb3326e149bd0c7da54525c3369aff1ddeee Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 25 Nov 2019 21:32:09 -0500 Subject: [PATCH] fix really overscaled lines We resample lines after sharp corners in some situations. Doing this for really overscaled tiles mean that sometimes the offset to the new vertex was closer than the precision supported. This disables that after a certain point. fix #9009 asdf --- src/data/bucket/line_bucket.js | 4 +- .../mapbox-gl-js#9009/expected.png | Bin 0 -> 8060 bytes .../regressions/mapbox-gl-js#9009/style.json | 44 ++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#9009/expected.png create mode 100644 test/integration/render-tests/regressions/mapbox-gl-js#9009/style.json diff --git a/src/data/bucket/line_bucket.js b/src/data/bucket/line_bucket.js index 4e1f31c65d7..f1cfe80e34f 100644 --- a/src/data/bucket/line_bucket.js +++ b/src/data/bucket/line_bucket.js @@ -250,7 +250,9 @@ class LineBucket implements Bucket { if (join === 'bevel') miterLimit = 1.05; - const sharpCornerOffset = SHARP_CORNER_OFFSET * (EXTENT / (512 * this.overscaling)); + const sharpCornerOffset = this.overscaling < 16 ? + SHARP_CORNER_OFFSET * EXTENT / (512 * this.overscaling) : + 0; // we could be more precise, but it would only save a negligible amount of space const segment = this.segments.prepareSegment(len * 10, this.layoutVertexArray, this.indexArray); diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#9009/expected.png b/test/integration/render-tests/regressions/mapbox-gl-js#9009/expected.png new file mode 100644 index 0000000000000000000000000000000000000000..b14d5740582c0c51d433ecc09a80872beec3328b GIT binary patch literal 8060 zcmeHMc|4SD+g4A}Qz}D+8jNYIg(Uly++`~wB`PW*6pba>E8*5M8imSMA}Pxw$&#fs z))>Iu| z-_L7%d)MF(40AKpN^(YD>gQZhlD<(#5tMq>b7s6wM#c3lEvTnP)5yt5ioWgihi#Qx zSaz>7ZC5b+7O>nGkbnP9r)AbjZt{Bx>%_S$Oou+!|{hr*n z>)QIAY6(?#W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OwkKI z2hk2-5fuM*nq&3Vd){0&ZagQ7_1)SeD@%y%n{jb5OBC#$9<9GAhZ}bv6<`_%jRf{M z4z^|z=!g^#zz_R^Xh-(g%1;ENSqUFLvk1b9N@C?5Pr?u10FN^G=&=B^1c0KN3eE)i ze@{Li%FS>_^DR+OZ-O6!Hof$K-@uI@$fNnfe2}X;$e8}Wovmt z!Gj~K5_Z_zegZVC?hk7$ZCDvM&er^VN$A#=V~Y{;HzqV%*{oT+77Z&b&0{OPtv&lK z|F(XpUinCGq9deZEL#vwa&mG8*q~w<&Z_opKT-n?YWuH9p<2Wcjjlm8c-#EHbAz~; z7{QMrv!^+ryw7wv#Y<9s6AZB9ucv|$QG(Tf6}fs}0yyIrZ|)hAm?cdVYMx7W)r5|z zsp+zd=Rcg8pW(u}2r#?gNVPsk>d#3+j}hGi5@6pAa9M=Yi`f7tl5yDg-To}Qg3Cae zpArc@>;~<2|H$*Rxbg57+&HN<=ZH2eyM|MB1?u@F!Ba5&pVo&~D1xP#Zvd8oXJRNf z=aTtWi}xLzfyr)$cIFigS7q7M$16yz0LXc3c1Yj&T%$j)OpOWTr^cw5Yk%MNZ@!zG zupZ(^!w7!(9{N68D*kXKJner?L*_K^mT0 z_H(_15vZ(O2MJQ$5nfWAKcuA(z%4f4W1-9RNI-sh=tQ}7GSbOG`(m;aST|3N@+?#z1ZyZ%DmBVcfJ9=llyP`w$Ps~;X>@*gIYxt*L?W4x!{BuqDI literal 0 HcmV?d00001 diff --git a/test/integration/render-tests/regressions/mapbox-gl-js#9009/style.json b/test/integration/render-tests/regressions/mapbox-gl-js#9009/style.json new file mode 100644 index 00000000000..59b1f474e5f --- /dev/null +++ b/test/integration/render-tests/regressions/mapbox-gl-js#9009/style.json @@ -0,0 +1,44 @@ +{ + "version": 8, + "metadata": { + "test": { + "height": 256 + } + }, + "center": [ + 0, + 0 + ], + "zoom": 18, + "sources": { + "line": { + "type": "geojson", + "maxzoom": 10, + "data": { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [[-180, 70], [0, 0], [100, 80]] + } + } + } + }, + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "white" + } + }, + { + "id": "road", + "type": "line", + "source": "line", + "paint": { + "line-width": 20, + "line-color": "#000" + } + } + ] +}