From 8e9510d2b4180fef50b7dd2e90b98143721ae414 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 28 Jan 2016 21:57:50 -0800 Subject: [core] tweak dash rendering and enable render tests fixes #2646 --- package.json | 2 +- src/mbgl/renderer/painter_line.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 742808bbaa..aa88c983d5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "aws-sdk": "^2.2.21", - "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#7ebad0438ea47721235434f56eb0dba2db66ddb5", + "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#2b4ed672dc7e7e60f98115e3eb2dc55125b96e66", "node-gyp": "^3.2.1", "request": "^2.67.0", "tape": "^4.2.2" diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp index b507c8c865..dd2833b117 100644 --- a/src/mbgl/renderer/painter_line.cpp +++ b/src/mbgl/renderer/painter_line.cpp @@ -83,10 +83,12 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI LinePatternPos posB = lineAtlas->getDashPosition(properties.dasharray.value.to, layout.cap == CapType::Round); lineAtlas->bind(); + const float widthA = posA.width * properties.dasharray.value.fromScale; + const float widthB = posB.width * properties.dasharray.value.toScale; float patternratio = std::pow(2.0, std::floor(::log2(state.getScale())) - id.z) / (util::EXTENT / util::tileSize) * id.overscaling; - float scaleXA = patternratio / posA.width / properties.dashLineWidth / properties.dasharray.value.fromScale; + float scaleXA = patternratio / widthA / properties.dashLineWidth; float scaleYA = -posA.height / 2.0; - float scaleXB = patternratio / posB.width / properties.dashLineWidth / properties.dasharray.value.toScale; + float scaleXB = patternratio / widthB / properties.dashLineWidth; float scaleYB = -posB.height / 2.0; linesdfShader->u_patternscale_a = {{ scaleXA, scaleYA }}; @@ -94,7 +96,7 @@ void Painter::renderLine(LineBucket& bucket, const LineLayer& layer, const TileI linesdfShader->u_patternscale_b = {{ scaleXB, scaleYB }}; linesdfShader->u_tex_y_b = posB.y; linesdfShader->u_image = 0; - linesdfShader->u_sdfgamma = lineAtlas->width / (properties.dashLineWidth * std::min(posA.width, posB.width) * 256.0 * data.pixelRatio) / 2; + linesdfShader->u_sdfgamma = lineAtlas->width / (properties.dashLineWidth * std::min(widthA, widthB) * 256.0 * data.pixelRatio) / 2; linesdfShader->u_mix = properties.dasharray.value.t; linesdfShader->u_extra = extra; linesdfShader->u_offset = -properties.offset; -- cgit v1.2.1