チェンジセット 1561

差分発生行の前後
無視リスト:
コミット日時:
2008/10/10 00:10:03 (3 年前)
コミッタ:
gyuque
ログメッセージ:

0.4.8: shape cache

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • ruby/jsplash/trunk/client2/demo_20081001.xml

    r1494 r1561  
    5656                <p id="statusout"> </p> 
    5757                <p>playing on javascript with JSplash</p> 
    58                 <p id="sout">starting <em>JSplash Player 0.2.2</em>...<br />-------------------------------------<br /></p> 
     58                <p id="sout">starting <em>JSplash Player 0.4.8</em>...<br />-------------------------------------<br /></p> 
    5959                <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 
    6060                </svg> 
  • ruby/jsplash/trunk/client2/index.xml

    r1536 r1561  
    5454                <div id="progbar"><div>  </div></div> 
    5555                <p id="statusout"> </p> 
    56                 <p id="sout"><em>JSplash Player</em> 0.4.7<br />-------------------------------------<br /></p> 
     56                <p id="sout"><em>JSplash Player</em> 0.4.8<br />-------------------------------------<br /></p> 
    5757                <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 
    5858                </svg> 
  • ruby/jsplash/trunk/client2/jsplash/objects.js

    r1535 r1561  
    2525        return func2; 
    2626} 
     27 
     28//JSplash.ObjectInstance.makeClipId = function(o) { 
     29//      return "jsplash-cp-"+o.instance_uid; 
     30//} 
    2731 
    2832JSplash.ObjectInstance.prototype = { 
     
    157161 
    158162                        if (old && old.appended) { 
    159                                 this.g.insertBefore(obj.g, old.g); 
    160                                 this.g.removeChild(old.g); 
     163                                this.g.insertBefore(obj.getActiveViewElement(), old.getActiveViewElement()); 
     164                                this.g.removeChild(old.getActiveViewElement()); 
    161165 
    162166                                old.appended = false; 
     
    174178                                if (nxtd == 65536) { 
    175179                                        console.warn("unknown case!"); 
    176                                         this.g.appendChild(obj.g); 
     180                                        this.g.appendChild(obj.getActiveViewElement()); 
    177181                                } 
    178182                                else 
    179                                         this.g.insertBefore(obj.g, this.depthMap[nxtd].g); 
     183                                        this.g.insertBefore(obj.getActiveViewElement(), this.depthMap[nxtd].getActiveViewElement()); 
    180184                                obj.appended = true; 
    181185                        } 
     
    185189         
    186190        placeObject: function(depth, oid, iname, clip_depth, replace_flg, inherit_transform) { 
    187                 if (clip_depth) 
    188                         this.clipMap[depth] = clip_depth; 
     191                this.clipMap[depth] = clip_depth || this.clipMap[depth]; 
    189192 
    190193                if (this.context.reachedFrame > this.context.frameC) { 
     
    229232                                if (inherit_transform) 
    230233                                        inst.copyTransformFrom(replaced); 
    231                                 g_before = replaced.g; /* to correct draw order*/ 
     234                                g_before = replaced.getActiveViewElement(); /* to correct draw order*/ 
    232235                        } 
    233236                         
    234237                        inst.render(); 
     238                        if (clip_depth) 
     239                                inst.hide(); 
    235240 
    236241                        if (!g_before) 
     
    250255                                if (this.taglist.length > JSplash.ObjectInstance.REMOVE_THRESH) 
    251256                                { 
    252                                         this.g.replaceChild(inst.g, g_before); 
     257                                        this.g.replaceChild(inst.getActiveViewElement(), g_before); 
    253258                                        replaced.appended = false; 
    254259                                } 
    255260                                else 
    256                                         this.g.insertBefore(inst.g, g_before); 
     261                                        this.g.insertBefore(inst.getActiveViewElement(), g_before); 
    257262 
    258263//} catch (e) { 
     
    278283                                if (this.taglist.length > JSplash.ObjectInstance.REMOVE_THRESH) 
    279284                                { 
    280                                         this.g.removeChild(replaced.g); 
     285                                        this.g.removeChild(replaced.getActiveViewElement()); 
    281286                                        replaced.appended = false; 
    282287                                } 
     
    297302                if (depth == this.topDepths[this.topDepths.length-1]) 
    298303                { 
    299                         this.g.removeChild(obj.g); 
     304                        this.g.removeChild(obj.getActiveViewElement()); 
    300305                        obj.appended = false; 
    301306                        this.topDepths.pop(); 
     
    306311                var d; 
    307312                 
    308                 this.g.removeChild(o.g); 
     313                this.g.removeChild(o.getActiveViewElement()); 
    309314                o.appended = false; 
    310315                 
     
    328333                if (o) 
    329334                { 
    330                  
     335                        //if (this.clipMap[depth]) 
     336                        //      this.applyAClip(depth, this.clipMap[depth], false); 
    331337                        delete this.clipMap[depth]; 
    332338                        // delete this.depthMap[depth]; 
     
    360366         
    361367                if (!skip_visual_change)         
    362                         this.hideClippers(); 
     368                        this.applyClippers(); 
    363369 
    364370                if (this.g && this.g.childNodes.length > 0 && !this.klass.isShapeObject) 
     
    371377         
    372378        hide: function() { 
    373                 this.g.style.display = "none"; 
    374         }, 
    375          
    376         hideClippers: function() { 
     379                if (this.g) 
     380                        this.g.style.display = "none"; 
     381        }, 
     382         
     383        applyClippers: function() { 
     384                // FIXME: waining for mask implementation... 
     385         
     386/*       
    377387                var cd, upto; 
    378388                var i; 
     
    380390                { 
    381391                        cd   = cd - 0; 
    382                         if (this.depthMap[cd]) 
    383                                 this.depthMap[cd].hide(); 
    384                 } 
    385         }, 
     392                        if (this.clipMap[cd] && this.depthMap[cd] && !this.depthMap[cd].sleeping) 
     393                                this.applyAClip(cd, this.clipMap[cd], true); 
     394                } 
     395*/ 
     396        }, 
     397/* 
     398        applyAClip: function(orgDepth, clipDepth, set_or_remove) { 
     399                var co = this.depthMap[orgDepth]; 
     400        }, 
     401         
     402 
     403        setClipper: function(depth, urn) { 
     404                var o = this.depthMap[depth]; 
     405                if (!o || !o.g) return; 
     406                 
     407        }, 
     408*/ 
     409 
     410        getActiveViewElement: function() { 
     411                return this.g; 
     412        }, 
     413 
    386414         
    387415        rewind: function(deep) { 
     
    818846        }                
    819847} 
     848         
  • ruby/jsplash/trunk/client2/jsplash/player.js

    r1535 r1561  
    1313JSplash.Player.prototype = { 
    1414        initialize: function(swf, svg) { 
     15                JSplash.gPlayer = this; 
    1516 
    1617                this.executor = new JSplash.Executor(); 
     
    1819                this.svg = svg; 
    1920                JSplash.createFillDef(svg); 
    20          
     21 
    2122                svg.style.width  = swf.pxWidth  + "px"; 
    2223                svg.style.height = swf.pxHeight + "px"; 
     
    3334 
    3435                JSplash.SWFGlobals.setup(this); 
    35                 this.doInitActions(); 
    36                 this.stage.registerExecutor(this.executor); 
    37         },  
     36                this.preprocessShapes(0); 
     37        }, 
     38 
     39        preprocessShapes: function(si) { 
     40                var ti, t; 
     41                var taglist = this.stage.taglist; 
     42                var tlen = taglist.length; 
     43 
     44                for (var i = 0;i < 500;i++) { 
     45                        ti = si + i; 
     46                        if (ti >= tlen) 
     47                                break; 
     48 
     49                        t = taglist[ti]; 
     50                        if (t.tag == JSplash.tDefineSprite) 
     51                                t.tag(t, this.stage); 
     52 
     53                } 
     54 
     55                if ((si+i) >= tlen) { 
     56                        // finish 
     57                        this.doInitActions(); 
     58                        this.stage.registerExecutor(this.executor); 
     59                        return; 
     60                } 
     61 
     62 
     63                // continue 
     64                JSplash.$next( this.preprocessShapes.bind(this, si+i) ); 
     65        }, 
    3866         
    3967        doInitActions: function() { 
     
    96124        var swf = new JSplash.SWF(JSplash.swfdata); 
    97125        var player = new JSplash.Player(swf, $('svgrt')); 
    98         JSplash.gPlayer = player; 
    99126        player.start(); 
    100127} 
     
    165192                } 
    166193        } 
    167          
     194 
    168195        JSplash.$next( JSplash.initPlayer ); 
    169196} 
  • ruby/jsplash/trunk/client2/jsplash/shaperenderer.js

    r1535 r1561  
    656656        }, 
    657657         
    658         buildSVG: function(g) { 
    659                 if (this.hitCount == 2) { 
     658        buildSVG: function(g, force_cache) { 
     659                if (!this.pathCache && (this.hitCount == 2 || force_cache)) { 
    660660                        this.pathCache = new JSplash.ShapeRenderer.PathCache(); 
    661661                        this.do_cache = true; 
  • ruby/jsplash/trunk/client2/jsplash/tags.js

    r1525 r1561  
    6161                 
    6262                tDefineSprite: function(data, owner) { 
    63                         JSplash.gPlayer.stage.registerObject(data.id, new JSplash.TagClass(data) ); 
     63                        if (!JSplash.gPlayer.stage.fetchObject(data.id)) 
     64                                JSplash.gPlayer.stage.registerObject(data.id, new JSplash.TagClass(data) ); 
    6465                }, 
    6566 
     
    102103                                        this.renderer = new JSplash.ShapeRenderer(data); 
    103104                                        this.renderer.buildEdgeIndex(); 
     105                                         
     106                                        if (data.shape.length > 10) { // heavy shape? 
     107                                                var dmy_g = JSplash.$svg('g'); 
     108                                                this.renderer.buildSVG(dmy_g, true); 
     109                                        } 
     110                                         
    104111                                        this.isShapeObject = true; 
    105112                                } 
  • ruby/jsplash/trunk/client2/rocket_demo.xml

    r1536 r1561  
    5656                <p id="statusout"> </p> 
    5757                <p>playing on javascript with JSplash</p> 
    58                 <p id="sout">starting <em>JSplash Player 0.4.7</em>...<br />-------------------------------------<br /></p> 
     58                <p id="sout">starting <em>JSplash Player 0.4.8</em>...<br />-------------------------------------<br /></p> 
    5959                <svg id="svgrt" xmlns="http://www.w3.org/2000/svg" style="width: 100px; height: 100px;"> 
    6060                </svg>