[Sie-announce] SIEコード [1501] STPathオブジェクトの最適化

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 12月 24日 (木) 23:35:32 JST


Revision: 1501
          http://sourceforge.jp/projects/sie/svn/view?view=rev&revision=1501
Author:   dhrname
Date:     2009-12-24 23:35:32 +0900 (Thu, 24 Dec 2009)

Log Message:
-----------
STPathオブジェクトの最適化

Modified Paths:
--------------
    branches/05x/057/sie.js

Modified: branches/05x/057/sie.js
===================================================================
--- branches/05x/057/sie.js	2009-12-24 14:06:08 UTC (rev 1500)
+++ branches/05x/057/sie.js	2009-12-24 14:35:32 UTC (rev 1501)
@@ -167,9 +167,7 @@
   var sw = this.swi.value, sh = this.shi.value;
   this.getObject("USE", STUseElement, "use", sw, sh); //use要素を先に処理
   var mat = this.vi.set(sw, sh, ob); //返り値はMatrix型
-  var sed = new Date();
   this.chset(this.rootElement, mat, sw, sh);
-  alert((new Date()).getTime() - sed.getTime());
   } catch(n) {stlog.add(n,109);}
 };
 SVGtoVML.prototype.getObject = function stvgetob( /*string*/ tag, /*object*/ st, /*string*/nodes, /*float*/w, h) {
@@ -588,9 +586,13 @@
 (function (){
   var a =  /^\],/,
       b = /\s*$/,
-      c = /[\s,]{2,}|\s/g;
+      c = /[\s,]{2,}|\s/g,
+      isCorQ = {
+        "c" : 1,
+        "q" : 1
+      };
 STPath.prototype.set = function ( /*float*/ w, /*float*/ h) {
-  var dat = "";
+  var dat = "", _isCorQ = isCorQ;
   try {
     var dd = this.d
       .replace(/\s*([A-DF-Z])/gi, '],["$1" ') //convert to JSON array
@@ -649,7 +651,7 @@
           F = NAIBU.reltoabs(x, y, F); //絶対座標に変換
         }
         preCom = com = F[0];
-        if (com === "c" || com === "q") {
+        if (_isCorQ[com]) {
           var Fli = F.length;
           dx = F[Fli-2] - F[Fli-4];
           dy = F[Fli-1] - F[Fli-3];




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