From 56869baaadb5c32cf5e77b592636e8fce0ca699a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 7 Jan 2016 22:07:26 +0100 Subject: [PATCH] Only transform canvas if matrix is not the identity. --- src/basic/Matrix.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 7ebf141f..00fe8a6e 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -757,7 +757,10 @@ var Matrix = Base.extend(/** @lends Matrix# */{ * @param {CanvasRenderingContext2D} ctx */ applyToContext: function(ctx) { - ctx.transform(this._a, this._c, this._b, this._d, this._tx, this._ty); + if (!this.isIdentity()) { + ctx.transform(this._a, this._c, this._b, this._d, + this._tx, this._ty); + } } }, Base.each(['a', 'c', 'b', 'd', 'tx', 'ty'], function(name) { // Create getters and setters for all internal attributes.