From 3af5d549f600cb471796ded978420521c547f9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 14 Feb 2011 01:14:03 +0000 Subject: [PATCH] Add comments about possible optimisations in PathItem#transformContent(). --- src/path/PathItem.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 05e60be0..e55c935d 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -148,11 +148,19 @@ PathItem = Item.extend(new function() { transformContent: function(matrix, flags) { for (var i = 0, l = this._segments.length; i < l; i++) { var segment = this._segments[i]; + // We need to convert handles to absolute coordinates in order + // to transform them. + // TODO: Is transformation even required if they are [0, 0]? + // TODO: Can we optimise this by using the matrix.transform() + // version that takes arrays as in and output values, and just + // modifying points rather than producing new ones? This would + // consume less memory for sure. var point = segment.point; var handleIn = segment.handleIn.add(point); var handleOut = segment.handleOut.add(point); point = matrix.transform(point); segment.point = point; + // Convert handles back to relative values after transformation segment.handleIn = matrix.transform(handleIn).subtract(point); segment.handleOut = matrix.transform(handleOut).subtract(point); }