[Sie-announce] SIEコード [2347] SVGPathElementの軽量化

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 1月 31日 (月) 21:41:58 JST


Revision: 2347
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=2347
Author:   dhrname
Date:     2011-01-31 21:41:58 +0900 (Mon, 31 Jan 2011)

Log Message:
-----------
SVGPathElementの軽量化

Modified Paths:
--------------
    branches/06x/069/org/w3c/dom/svg.js

Modified: branches/06x/069/org/w3c/dom/svg.js
===================================================================
--- branches/06x/069/org/w3c/dom/svg.js	2011-01-30 14:22:40 UTC (rev 2346)
+++ branches/06x/069/org/w3c/dom/svg.js	2011-01-31 12:41:58 UTC (rev 2347)
@@ -2650,32 +2650,36 @@
        *SVGのd属性をVMLに変換していく処理である。
        */
       var tar = evt.target, matrix = tar.getScreenCTM(), tlist = tar.normalizedPathSegList, _parseInt = parseInt;
-      var t = "", ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f;
+      var dat = [], ma = matrix.a, mb = matrix.b, mc = matrix.c, md = matrix.d, me = matrix.e, mf = matrix.f;
       var cname = tar._com._nameCom, isZ = tar._com._isZ, isC = tar._com._isC;
       for (var i=0, tli=tlist.numberOfItems;i<tli;++i) {
         var ti = tlist.getItem(i), tps = ti.pathSegTypeAsLetter;
-        t += cname[tps];
+        var t = cname[tps];
         if (isC[tps]) {
           /*CTM(mx)の行列と座標(x, y)の積を算出する。数学における表現は以下のとおり
            *[ma mc me]   [x]
            *[mb md mf] * [y]
            *[0  0  1 ]   [1]
            */
-          t += _parseInt(ma*ti.x1 + mc*ti.y1 + me, 10)+ " " +_parseInt(mb*ti.x1 + md*ti.y1 + mf, 10)+ " ";
-          t += _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10)+ " " +_parseInt(mb*ti.x2 + md*ti.y2 + mf, 10)+ " ";
-          t += _parseInt(ma*ti.x + mc*ti.y + me, 10)+ " " +_parseInt(mb*ti.x + md*ti.y + mf, 10)+ " ";
+          t += ([_parseInt(ma*ti.x1 + mc*ti.y1 + me, 10),
+                 _parseInt(mb*ti.x1 + md*ti.y1 + mf, 10),
+                 _parseInt(ma*ti.x2 + mc*ti.y2 + me, 10),
+                 _parseInt(mb*ti.x2 + md*ti.y2 + mf, 10),
+                 _parseInt(ma*ti.x + mc*ti.y + me, 10),
+                 _parseInt(mb*ti.x + md*ti.y + mf, 10)]).join(" ");
         } else if (!isZ[tps]) {
-          t += _parseInt(ma*ti.x + mc*ti.y + me, 10)+ " " +_parseInt(mb*ti.x + md*ti.y + mf, 10)+ " ";
+          t += _parseInt(ma*ti.x + mc*ti.y + me, 10)+ " " +_parseInt(mb*ti.x + md*ti.y + mf, 10);
         }
+        dat[i] = t;
       }
       var vi = tar.ownerDocument.documentElement;
       var w = vi.width.baseVal.value, h = vi.height.baseVal.value;
-      t += " e";
-      tar._tar.path = t;
+      dat[dat.length] = " e";
+      tar._tar.path = dat.join(" ");
       tar._tar.coordsize = w + " " + h;
       NAIBU._setPaint(tar, matrix);
       delete tar._cacheMatrix, tar._currentStyle;
-      evt = tar = t = w = h = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isC = i = tli = tps = ti = cname = null;
+      evt = tar = dat = t = w = h = matrix = tlist = x = y = _parseInt = ma = mb = mc = md = me = mf = vi = isZ = isC = i = tli = tps = ti = cname = null;
     }, false);
     evt = tar = null;
   }, false);




Sie-announce メーリングリストの案内
Back to archive index