Set one-off transform instead of transforming back and forth
This commit is contained in:
@@ -116,7 +116,7 @@ ol.render.canvas.Replay = function(tolerance, maxExtent, resolution, overlaps) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Transform}
|
* @type {ol.Transform}
|
||||||
*/
|
*/
|
||||||
this.tmpLocalTransformInv_ = ol.transform.create();
|
this.resetTransform_ = ol.transform.create();
|
||||||
};
|
};
|
||||||
ol.inherits(ol.render.canvas.Replay, ol.render.VectorContext);
|
ol.inherits(ol.render.canvas.Replay, ol.render.VectorContext);
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
var d = 0; // data index
|
var d = 0; // data index
|
||||||
var dd; // end of per-instruction data
|
var dd; // end of per-instruction data
|
||||||
var localTransform = this.tmpLocalTransform_;
|
var localTransform = this.tmpLocalTransform_;
|
||||||
var localTransformInv = this.tmpLocalTransformInv_;
|
var resetTransform = this.resetTransform_;
|
||||||
var prevX, prevY, roundX, roundY;
|
var prevX, prevY, roundX, roundY;
|
||||||
var pendingFill = 0;
|
var pendingFill = 0;
|
||||||
var pendingStroke = 0;
|
var pendingStroke = 0;
|
||||||
@@ -342,7 +342,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
var centerY = y + anchorY;
|
var centerY = y + anchorY;
|
||||||
ol.transform.compose(localTransform,
|
ol.transform.compose(localTransform,
|
||||||
centerX, centerY, scale, scale, rotation, -centerX, -centerY);
|
centerX, centerY, scale, scale, rotation, -centerX, -centerY);
|
||||||
context.transform.apply(context, localTransform);
|
context.setTransform.apply(context, localTransform);
|
||||||
}
|
}
|
||||||
var alpha = context.globalAlpha;
|
var alpha = context.globalAlpha;
|
||||||
if (opacity != 1) {
|
if (opacity != 1) {
|
||||||
@@ -359,8 +359,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
context.globalAlpha = alpha;
|
context.globalAlpha = alpha;
|
||||||
}
|
}
|
||||||
if (scale != 1 || rotation !== 0) {
|
if (scale != 1 || rotation !== 0) {
|
||||||
ol.transform.invert(ol.transform.setFromArray(localTransformInv, localTransform));
|
context.setTransform.apply(context, resetTransform);
|
||||||
context.transform.apply(context, localTransformInv);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
@@ -402,7 +401,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
y = pixelCoordinates[d + 1] + offsetY;
|
y = pixelCoordinates[d + 1] + offsetY;
|
||||||
if (scale != 1 || rotation !== 0) {
|
if (scale != 1 || rotation !== 0) {
|
||||||
ol.transform.compose(localTransform, x, y, scale, scale, rotation, -x, -y);
|
ol.transform.compose(localTransform, x, y, scale, scale, rotation, -x, -y);
|
||||||
context.transform.apply(context, localTransform);
|
context.setTransform.apply(context, localTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support multiple lines separated by \n
|
// Support multiple lines separated by \n
|
||||||
@@ -433,8 +432,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scale != 1 || rotation !== 0) {
|
if (scale != 1 || rotation !== 0) {
|
||||||
ol.transform.invert(ol.transform.setFromArray(localTransformInv, localTransform));
|
context.setTransform.apply(context, resetTransform);
|
||||||
context.transform.apply(context, localTransformInv);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
|
|||||||
Reference in New Issue
Block a user