Last Object tupdate

This commit is contained in:
Mat Groves 2013-06-30 10:55:36 +01:00
parent edda8b451c
commit e010142b21
19 changed files with 934 additions and 364 deletions

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -4,7 +4,7 @@
* Copyright (c) 2012, Mat Groves * Copyright (c) 2012, Mat Groves
* http://goodboydigital.com/ * http://goodboydigital.com/
* *
* Compiled: 2013-06-29 * Compiled: 2013-06-30
* *
* Pixi.JS is licensed under the MIT License. * Pixi.JS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
@ -797,7 +797,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -823,13 +822,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -861,17 +863,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -892,6 +905,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -902,9 +922,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -921,6 +942,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -943,10 +965,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -972,6 +996,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -1049,9 +1078,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -1065,16 +1094,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;
@ -2703,7 +2733,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);
@ -4818,7 +4848,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }
@ -5396,11 +5425,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -5414,7 +5447,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -5459,13 +5491,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -21,7 +21,6 @@ PIXI.DisplayObjectContainer = function()
//s //s
this.renderable = false; this.renderable = false;
//this.last = this;
} }
// constructor // constructor
@ -47,13 +46,16 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'visible', {
*/ */
PIXI.DisplayObjectContainer.prototype.addChild = function(child) PIXI.DisplayObjectContainer.prototype.addChild = function(child)
{ {
//this.addChildAt(child, this.children.length)
//this.addChildAt(child, this.children.length)
// return; // return;
if(child.parent != undefined) if(child.parent != undefined)
{ {
//// COULD BE THIS???
child.parent.removeChild(child); child.parent.removeChild(child);
// return;
} }
child.parent = this; child.parent = this;
@ -85,17 +87,28 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
var previousObject; var previousObject;
previousObject = this.last; previousObject = this.last;
// if(this.last._iNext)
//console.log( this.last._iNext);
nextObject = previousObject._iNext; nextObject = previousObject._iNext;
// always true in this case // always true in this case
this.last = child.last; //this.last = child.last;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) var prevLast = this.last;
while(updateLast)
{ {
updateParent.last = this.last if(updateLast.last == prevLast)
updateParent = updateParent.parent; {
updateLast.last = child.last;
}
else
{
// console.log("Not last")
}
updateLast = updateLast.parent;
} }
if(nextObject) if(nextObject)
@ -116,6 +129,13 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
/*
if(this.stage)
{
console.log(this.stage.last == child.last);
console.log(this.stage.last._iNext)
}*/
} }
/** /**
@ -126,9 +146,10 @@ PIXI.DisplayObjectContainer.prototype.addChild = function(child)
*/ */
PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
{ {
//this.addChild(child); // console.log(child)
this.addChild(child);
//console.log("AT " + index) //console.log("AT " + index)
//return; return;
if(index >= 0 && index <= this.children.length) if(index >= 0 && index <= this.children.length)
{ {
if(child.parent != undefined)child.parent.removeChild(child); if(child.parent != undefined)child.parent.removeChild(child);
@ -145,6 +166,7 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
while(tmpChild) while(tmpChild)
} }
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
var childLast = child.last; var childLast = child.last;
@ -167,10 +189,12 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
} }
else if(index == 0) else if(index == 0)
{ {
// console.log("")
previousObject = this; previousObject = this;
} }
else else
{ {
//console.log("!!!")
previousObject = this.children[index].last; previousObject = this.children[index].last;
} }
@ -196,6 +220,11 @@ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index)
// add them to the new render group.. // add them to the new render group..
this.__renderGroup.addDisplayObjectAndChildren(child); this.__renderGroup.addDisplayObjectAndChildren(child);
} }
if(this.stage)
{
console.log(this.stage.last == child.last );
}
} }
else else
{ {
@ -273,9 +302,9 @@ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index)
PIXI.DisplayObjectContainer.prototype.removeChild = function(child) PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
{ {
var index = this.children.indexOf( child ); var index = this.children.indexOf( child );
if ( index !== -1 ) if ( index !== -1 )
{ {
//console.log(">>")
// unlink // // unlink //
// modify the list.. // modify the list..
var childFirst = child.first var childFirst = child.first
@ -289,16 +318,17 @@ PIXI.DisplayObjectContainer.prototype.removeChild = function(child)
if(this.last == childLast.last) if(this.last == childLast.last)
{ {
this.last = child._iPrev; var tempLast = childFirst._iPrev;
// need to make sure the parents last is updated too // need to make sure the parents last is updated too
var updateParent = this.parent; var updateLast = this;//.parent;
while(updateParent) while(updateLast.last == childLast.last)
{ {
updateParent.last = this.last updateLast.last = tempLast;
updateParent = updateParent.parent; updateLast = updateLast.parent;
if(!updateLast)break;
} }
} }
childLast._iNext = null; childLast._iNext = null;
childFirst._iPrev = null; childFirst._iPrev = null;

View file

@ -133,11 +133,15 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
// one the display object hits this. we can break the loop // one the display object hits this. we can break the loop
var testObject = displayObject.last._iNext; var testObject = displayObject.last._iNext;
if(testObject)
{
// console.log(testObject.last == displayObject.last)//_iNext);
}
var count = 0;
var count = 0
do do
{ {
transform = displayObject.worldTransform; transform = displayObject.worldTransform;
if(!displayObject.visible) if(!displayObject.visible)
@ -151,7 +155,6 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
continue; continue;
} }
count++;
if(displayObject instanceof PIXI.Sprite) if(displayObject instanceof PIXI.Sprite)
@ -196,13 +199,19 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject)
PIXI.CanvasGraphics.renderGraphics(displayObject, context); PIXI.CanvasGraphics.renderGraphics(displayObject, context);
} }
count++
displayObject = displayObject._iNext; displayObject = displayObject._iNext;
} }
while(displayObject != testObject) while(displayObject != testObject)
this.context.setTransform(1,0,0,1,0,0); console.log(count);
// this.context.setTransform(1,0,0,1,0,0);
} }
var cacheCount;
PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject) PIXI.CanvasRenderer.prototype.renderDisplayObject2 = function(displayObject)
{ {
var transform = displayObject.worldTransform; var transform = displayObject.worldTransform;

View file

@ -364,7 +364,6 @@ PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren = function(displayOb
if(displayObject.renderable) if(displayObject.renderable)
{ {
this.insertObject(displayObject, previousRenderable, nextRenderable); this.insertObject(displayObject, previousRenderable, nextRenderable);
previousRenderable = displayObject; previousRenderable = displayObject;
} }

View file

@ -24,7 +24,7 @@ PIXI.autoDetectRenderer = function(width, height, view, transparent)
//console.log(webgl); //console.log(webgl);
if( webgl ) if( webgl )
{ {
return new PIXI.WebGLRenderer(width, height, view, transparent); // return new PIXI.WebGLRenderer(width, height, view, transparent);
} }
return new PIXI.CanvasRenderer(width, height, view, transparent); return new PIXI.CanvasRenderer(width, height, view, transparent);