Skip to content

Commit

Permalink
Add Sprite::constructed flag
Browse files Browse the repository at this point in the history
  • Loading branch information
alexp-sssup committed Mar 29, 2011
1 parent b5dfa54 commit 729a9b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripting/flashdisplay.cpp
Expand Up @@ -365,10 +365,15 @@ bool Loader::getBounds(number_t& xmin, number_t& xmax, number_t& ymin, number_t&
return false;
}

Sprite::Sprite():GraphicsContainer(this)
Sprite::Sprite():GraphicsContainer(this),constructed(false)
{
}

Sprite::Sprite(const Sprite& r):GraphicsContainer(this),constructed(false)
{
assert(!r.isConstructed());
}

void Sprite::sinit(Class_base* c)
{
c->setConstructor(Class<IFunction>::getFunction(_constructor));
Expand Down
5 changes: 5 additions & 0 deletions scripting/flashdisplay.h
Expand Up @@ -384,12 +384,16 @@ class Loader: public IThreadJob, public DisplayObjectContainer
class Sprite: public DisplayObjectContainer, public GraphicsContainer
{
friend class DisplayObject;
private:
ACQUIRE_RELEASE_FLAG(constructed);
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);
void setConstructed() { RELEASE_WRITE(constructed,true); }
public:
Sprite();
Sprite(const Sprite& r);
static void sinit(Class_base* c);
static void buildTraits(ASObject* o);
ASFUNCTION(_constructor);
Expand All @@ -403,6 +407,7 @@ friend class DisplayObject;
InteractiveObject* hitTest(InteractiveObject* last, number_t x, number_t y);
void invalidate();
void requestInvalidation();
bool isConstructed() const { return ACQUIRE_READ(constructed); }
};

class MovieClip: public Sprite
Expand Down

0 comments on commit 729a9b0

Please sign in to comment.