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.
*/
setImageStyle(imageStyle) {
if (!imageStyle) {
let imageSize;
if (!imageStyle || !(imageSize = imageStyle.getSize())) {
this.image_ = null;
} else {
const imageSize = imageStyle.getSize();
if (!imageSize) {
this.image_ = null;
} else {
return;
}
const imageAnchor = imageStyle.getAnchor();
// FIXME pixel ratio
const imageImage = imageStyle.getImage(1);
const imageOrigin = imageStyle.getOrigin();
const imageScale = imageStyle.getScaleArray();
this.imageAnchorX_ = imageAnchor[0];
this.imageAnchorY_ = imageAnchor[1];
this.imageHeight_ = imageSize[1];
this.image_ = imageImage;
this.image_ = imageStyle.getImage(this.pixelRatio_);
this.imageAnchorX_ = imageAnchor[0] * this.pixelRatio_;
this.imageAnchorY_ = imageAnchor[1] * this.pixelRatio_;
this.imageHeight_ = imageSize[1] * this.pixelRatio_;
this.imageOpacity_ = imageStyle.getOpacity();
this.imageOriginX_ = imageOrigin[0];
this.imageOriginY_ = imageOrigin[1];
this.imageRotateWithView_ = imageStyle.getRotateWithView();
this.imageRotation_ = imageStyle.getRotation();
this.imageScale_ = [
this.pixelRatio_ * imageScale[0],
this.pixelRatio_ * imageScale[1],
];
this.imageWidth_ = imageSize[0];
}
}
this.imageScale_ = imageStyle.getScaleArray();
this.imageWidth_ = imageSize[0] * this.pixelRatio_;
}
/**