Skip to content

Commit

Permalink
Better reuse in MovieClip::boundsRect
Browse files Browse the repository at this point in the history
  • Loading branch information
alexp-sssup committed Dec 14, 2010
1 parent 082fe2f commit edfe9b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
30 changes: 1 addition & 29 deletions scripting/flashdisplay.cpp
Expand Up @@ -925,35 +925,7 @@ Vector2 MovieClip::debugRender(FTFont* font, bool deep)

bool MovieClip::boundsRect(number_t& xmin, number_t& xmax, number_t& ymin, number_t& ymax) const
{
bool valid=false;
{
Locker l(mutexDisplayList);

list<DisplayObject*>::const_iterator dynit=dynamicDisplayList.begin();
for(;dynit!=dynamicDisplayList.end();++dynit)
{
number_t t1,t2,t3,t4;
if((*dynit)->getBounds(t1,t2,t3,t4))
{
if(valid==false)
{
xmin=t1;
xmax=t2;
ymin=t3;
ymax=t4;
valid=true;
//Now values are valid
}
else
{
xmin=imin(xmin,t1);
xmax=imax(xmax,t2);
ymin=imin(ymin,t3);
ymax=imax(ymax,t4);
}
}
}
}
bool valid=Sprite::boundsRect(xmin,xmax,ymin,ymax);

if(framesLoaded==0) //We end here
return valid;
Expand Down
3 changes: 1 addition & 2 deletions scripting/flashdisplay.h
Expand Up @@ -368,9 +368,8 @@ class Loader: public IThreadJob, public DisplayObjectContainer
class Sprite: public DisplayObjectContainer, public GraphicsContainer
{
friend class DisplayObject;
private:
bool boundsRect(number_t& xmin, number_t& xmax, number_t& ymin, number_t& ymax) const;
protected:
bool boundsRect(number_t& xmin, number_t& xmax, number_t& ymin, number_t& ymax) const;
void renderImpl(bool maskEnabled, number_t t1,number_t t2,number_t t3,number_t t4) const;
InteractiveObject* hitTestImpl(number_t x, number_t y);
public:
Expand Down

0 comments on commit edfe9b0

Please sign in to comment.