diff --git a/src/ol/render/canvas/textreplay.js b/src/ol/render/canvas/textreplay.js index 2ff5fd3792..842b8e148b 100644 --- a/src/ol/render/canvas/textreplay.js +++ b/src/ol/render/canvas/textreplay.js @@ -326,7 +326,7 @@ ol.render.canvas.TextReplay.prototype.getImage_ = function(text, fill, stroke) { context.font = textState.font; if (stroke) { context.strokeStyle = strokeState.strokeStyle; - context.lineWidth = strokeWidth * pixelRatio; + context.lineWidth = strokeWidth * (ol.has.SAFARI ? pixelRatio : 1); context.lineCap = strokeState.lineCap; context.lineJoin = strokeState.lineJoin; context.miterLimit = strokeState.miterLimit; diff --git a/test/rendering/ol/style/expected/text-canvas-hidpi.png b/test/rendering/ol/style/expected/text-canvas-hidpi.png index 4c8a444edb..7577d3b62f 100644 Binary files a/test/rendering/ol/style/expected/text-canvas-hidpi.png and b/test/rendering/ol/style/expected/text-canvas-hidpi.png differ diff --git a/test/rendering/ol/style/text.test.js b/test/rendering/ol/style/text.test.js index 0329a58c5d..8c561f947a 100644 --- a/test/rendering/ol/style/text.test.js +++ b/test/rendering/ol/style/text.test.js @@ -18,14 +18,15 @@ describe('ol.rendering.style.Text', function() { var map, vectorSource; function createMap(renderer, opt_pixelRatio) { + var pixelRatio = opt_pixelRatio || 1; vectorSource = new ol.source.Vector(); var vectorLayer = new ol.layer.Vector({ source: vectorSource }); map = new ol.Map({ - pixelRatio: opt_pixelRatio || 1, - target: createMapDiv(200, 200), + pixelRatio: pixelRatio, + target: createMapDiv(200 / pixelRatio, 200 / pixelRatio), renderer: renderer, layers: [vectorLayer], view: new ol.View({ @@ -157,7 +158,7 @@ describe('ol.rendering.style.Text', function() { it('renders correct stroke with pixelRatio != 1', function(done) { createMap('canvas', 2); createFeatures(); - expectResemble(map, 'rendering/ol/style/expected/text-canvas-hidpi.png', IMAGE_TOLERANCE, done); + expectResemble(map, 'rendering/ol/style/expected/text-canvas-hidpi.png', 2.8, done); }); it('renders multiline text with alignment options', function(done) {