One fewer transform

This commit is contained in:
Tim Schaub
2018-11-14 21:32:04 +01:00
parent a9f98f2b1e
commit 33f6d6f110
2 changed files with 4 additions and 9 deletions
+1 -8
View File
@@ -79,18 +79,11 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
*/ */
this.tmpTileRange_ = new TileRange(0, 0, 0, 0); this.tmpTileRange_ = new TileRange(0, 0, 0, 0);
/**
* @private
* @type {import("../../transform.js").Transform}
*/
this.imageTransform_ = createTransform();
/** /**
* @protected * @protected
* @type {number} * @type {number}
*/ */
this.zDirection = 0; this.zDirection = 0;
} }
/** /**
@@ -293,7 +286,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
// TODO: check where these are used and confirm they are correct // TODO: check where these are used and confirm they are correct
const transform = composeTransform( const transform = composeTransform(
this.imageTransform_, this.transform_,
halfWidth, halfHeight, halfWidth, halfHeight,
scale, scale, scale, scale,
rotation, rotation,
+3 -1
View File
@@ -95,12 +95,14 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
const imagePixelRatio = image.getPixelRatio(); const imagePixelRatio = image.getPixelRatio();
const scale = pixelRatio * imageResolution / const scale = pixelRatio * imageResolution /
(viewResolution * imagePixelRatio); (viewResolution * imagePixelRatio);
const transform = composeTransform(this.imageTransform_,
const transform = composeTransform(this.transform_,
pixelRatio * size[0] / 2, pixelRatio * size[1] / 2, pixelRatio * size[0] / 2, pixelRatio * size[1] / 2,
scale, scale, scale, scale,
0, 0,
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution, imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution,
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution); imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution);
composeTransform(this.coordinateToCanvasPixelTransform, composeTransform(this.coordinateToCanvasPixelTransform,
pixelRatio * size[0] / 2 - transform[4], pixelRatio * size[1] / 2 - transform[5], pixelRatio * size[0] / 2 - transform[4], pixelRatio * size[1] / 2 - transform[5],
pixelRatio / viewResolution, -pixelRatio / viewResolution, pixelRatio / viewResolution, -pixelRatio / viewResolution,