diff --git a/src/ol/image.js b/src/ol/image.js index adea4b9d16..ba5d6dcc52 100644 --- a/src/ol/image.js +++ b/src/ol/image.js @@ -28,11 +28,13 @@ ol.ImageState = { * @extends {goog.events.EventTarget} * @param {ol.Extent} extent Extent. * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. * @param {string} src Image source URI. * @param {?string} crossOrigin Cross origin. * @param {Array.} attributions Attributions. */ -ol.Image = function(extent, resolution, src, crossOrigin, attributions) { +ol.Image = + function(extent, resolution, pixelRatio, src, crossOrigin, attributions) { goog.base(this); @@ -54,6 +56,12 @@ ol.Image = function(extent, resolution, src, crossOrigin, attributions) { */ this.src_ = src; + /** + * @private + * @type {number} + */ + this.pixelRatio_ = pixelRatio; + /** * @private * @type {number} @@ -137,6 +145,14 @@ ol.Image.prototype.getImageElement = function(opt_context) { }; +/** + * @return {number} PixelRatio. + */ +ol.Image.prototype.getPixelRatio = function() { + return this.pixelRatio_; +}; + + /** * @return {number} Resolution. */ diff --git a/src/ol/source/imagesource.js b/src/ol/source/imagesource.js index 66fd16e24f..2fbcb87bb1 100644 --- a/src/ol/source/imagesource.js +++ b/src/ol/source/imagesource.js @@ -89,7 +89,7 @@ ol.source.Image.prototype.createImage = var imageUrl = this.imageUrlFunction(extent, size, projection); if (goog.isDef(imageUrl)) { image = new ol.Image( - extent, resolution, imageUrl, this.crossOrigin_, + extent, resolution, pixelRatio, imageUrl, this.crossOrigin_, this.getAttributions()); } return image; diff --git a/src/ol/source/imagewmssource.js b/src/ol/source/imagewmssource.js index 84431b58fa..21c3deeed7 100644 --- a/src/ol/source/imagewmssource.js +++ b/src/ol/source/imagewmssource.js @@ -75,6 +75,7 @@ ol.source.ImageWMS.prototype.getImage = var image = this.image_; if (!goog.isNull(image) && image.getResolution() == resolution && + image.getPixelRatio() == pixelRatio && ol.extent.containsExtent(image.getExtent(), extent)) { return image; } diff --git a/src/ol/source/mapguidesource.js b/src/ol/source/mapguidesource.js index c07cbeb18c..4d7d8001ca 100644 --- a/src/ol/source/mapguidesource.js +++ b/src/ol/source/mapguidesource.js @@ -78,6 +78,7 @@ ol.source.MapGuide.prototype.getImage = var image = this.image_; if (!goog.isNull(image) && image.getResolution() == resolution && + image.getPixelRatio() == pixelRatio && ol.extent.containsExtent(image.getExtent(), extent)) { return image; }