Merge pull request #6251 from ahocevar/image-tile-pixel-ratio

Take image pixel ratio into account for rendered resolution
This commit is contained in:
Andreas Hocevar
2016-12-15 08:55:10 +01:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -89,7 +89,6 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye
var loaded = this.loadImage(image);
if (loaded) {
this.image_ = image;
this.renderedResolution = viewResolution;
}
}
}
@@ -115,6 +114,7 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame = function(frameState, laye
this.updateAttributions(frameState.attributions, image.getAttributions());
this.updateLogos(frameState, imageSource);
this.renderedResolution = viewResolution * pixelRatio / imagePixelRatio;
}
return !!this.image_;

View File

@@ -208,17 +208,17 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
}
this.renderedRevision = sourceRevision;
this.renderedResolution = tileResolution;
this.renderedResolution = tileResolution * pixelRatio / tilePixelRatio;
this.renderedExtent_ = imageExtent;
}
var scale = pixelRatio / tilePixelRatio * this.renderedResolution / viewResolution;
var scale = this.renderedResolution / viewResolution;
var transform = ol.transform.compose(this.imageTransform_,
pixelRatio * size[0] / 2, pixelRatio * size[1] / 2,
scale, scale,
0,
tilePixelRatio * (this.renderedExtent_[0] - viewCenter[0]) / this.renderedResolution,
tilePixelRatio * (viewCenter[1] - this.renderedExtent_[3]) / this.renderedResolution);
(this.renderedExtent_[0] - viewCenter[0]) / this.renderedResolution * pixelRatio,
(viewCenter[1] - this.renderedExtent_[3]) / this.renderedResolution * pixelRatio);
ol.transform.compose(this.coordinateToCanvasPixelTransform,
pixelRatio * size[0] / 2 - transform[4], pixelRatio * size[1] / 2 - transform[5],
pixelRatio / viewResolution, -pixelRatio / viewResolution,