High resolution image style for immediate renderer

This commit is contained in:
Maximilian Krög
2021-07-04 14:55:25 +02:00
parent 87f215939c
commit f1ecc87425

View File

@@ -1047,34 +1047,24 @@ class CanvasImmediateRenderer extends VectorContext {
* @param {import("../../style/Image.js").default} imageStyle Image style. * @param {import("../../style/Image.js").default} imageStyle Image style.
*/ */
setImageStyle(imageStyle) { setImageStyle(imageStyle) {
if (!imageStyle) { let imageSize;
if (!imageStyle || !(imageSize = imageStyle.getSize())) {
this.image_ = null; this.image_ = null;
} else { return;
const imageSize = imageStyle.getSize(); }
if (!imageSize) {
this.image_ = null;
} else {
const imageAnchor = imageStyle.getAnchor(); const imageAnchor = imageStyle.getAnchor();
// FIXME pixel ratio
const imageImage = imageStyle.getImage(1);
const imageOrigin = imageStyle.getOrigin(); const imageOrigin = imageStyle.getOrigin();
const imageScale = imageStyle.getScaleArray(); this.image_ = imageStyle.getImage(this.pixelRatio_);
this.imageAnchorX_ = imageAnchor[0]; this.imageAnchorX_ = imageAnchor[0] * this.pixelRatio_;
this.imageAnchorY_ = imageAnchor[1]; this.imageAnchorY_ = imageAnchor[1] * this.pixelRatio_;
this.imageHeight_ = imageSize[1]; this.imageHeight_ = imageSize[1] * this.pixelRatio_;
this.image_ = imageImage;
this.imageOpacity_ = imageStyle.getOpacity(); this.imageOpacity_ = imageStyle.getOpacity();
this.imageOriginX_ = imageOrigin[0]; this.imageOriginX_ = imageOrigin[0];
this.imageOriginY_ = imageOrigin[1]; this.imageOriginY_ = imageOrigin[1];
this.imageRotateWithView_ = imageStyle.getRotateWithView(); this.imageRotateWithView_ = imageStyle.getRotateWithView();
this.imageRotation_ = imageStyle.getRotation(); this.imageRotation_ = imageStyle.getRotation();
this.imageScale_ = [ this.imageScale_ = imageStyle.getScaleArray();
this.pixelRatio_ * imageScale[0], this.imageWidth_ = imageSize[0] * this.pixelRatio_;
this.pixelRatio_ * imageScale[1],
];
this.imageWidth_ = imageSize[0];
}
}
} }
/** /**