From ad2abfb71fd0379b83515d0152d457c900a3e801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 27 Dec 2011 20:18:02 +0100 Subject: [PATCH] Inline drawDashes() code. --- src/path/Path.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/path/Path.js b/src/path/Path.js index cbf79cc9..2e7d0c94 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -1429,18 +1429,6 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ drawSegment(0); } - // XXX: Make this work with global matrices? - function drawDashes(ctx, path, dashArray, dashOffset) { - var flattener = new PathFlattener(path), - from = dashOffset, to, - i = 0; - while (from < flattener.length) { - to = from + dashArray[(i++) % dashArray.length]; - flattener.drawPart(ctx, from, to); - from = to + dashArray[(i++) % dashArray.length]; - } - } - return { draw: function(ctx, param) { if (!param.compound) @@ -1476,7 +1464,14 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ // We cannot use the path created by drawSegments above // Use CurveFlatteners to draw dashed paths: ctx.beginPath(); - drawDashes(ctx, this, dashArray, style._dashOffset); + var flattener = new PathFlattener(this), + from = style._dashOffset, to, + i = 0; + while (from < flattener.length) { + to = from + dashArray[(i++) % dashArray.length]; + flattener.drawPart(ctx, from, to); + from = to + dashArray[(i++) % dashArray.length]; + } } ctx.stroke(); }