[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... |
Date: |
Wed, 30 Apr 2008 09:15:12 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 08/04/30 09:15:12
Modified files:
. : ChangeLog
server : sprite_instance.cpp sprite_instance.h
server/swf : ControlTag.h DisplayListTag.h DoActionTag.h
DoInitActionTag.h PlaceObject2Tag.cpp
PlaceObject2Tag.h RemoveObjectTag.cpp
RemoveObjectTag.h
Log message:
* server/sprite_instance.{h,cpp}: drop ugly m_tmp_display_list
and
m_is_jumping back. execute_frame_tags() now take a
dislpayList parameter.
* server/swf/ControlTag.h
server/swf/DisplayListTag.h
server/swf/DoActionTag.h
server/swf/DoInitActionTag.h
server/swf/PlaceObject2Tag.cpp
server/swf/PlaceObject2Tag.h
server/swf/RemoveObjectTag.cpp
server/swf/RemoveObjectTag.h,
make all those control tags to take a dlist parameter.
cleanups.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6457&r2=1.6458
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.524&r2=1.525
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.189&r2=1.190
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ControlTag.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DisplayListTag.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DoActionTag.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DoInitActionTag.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.h?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/RemoveObjectTag.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/RemoveObjectTag.h?cvsroot=gnash&r1=1.9&r2=1.10
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6457
retrieving revision 1.6458
diff -u -b -r1.6457 -r1.6458
--- ChangeLog 30 Apr 2008 07:52:52 -0000 1.6457
+++ ChangeLog 30 Apr 2008 09:14:59 -0000 1.6458
@@ -1,3 +1,17 @@
+2008-04-30 Zou Lunkai <address@hidden>
+
+ * server/sprite_instance.{h,cpp}: drop ugly m_tmp_display_list and
+ m_is_jumping back. execute_frame_tags() now take a dislpayList
parameter.
+ * server/swf/ControlTag.h
+ server/swf/DisplayListTag.h
+ server/swf/DoActionTag.h
+ server/swf/DoInitActionTag.h
+ server/swf/PlaceObject2Tag.cpp
+ server/swf/PlaceObject2Tag.h
+ server/swf/RemoveObjectTag.cpp
+ server/swf/RemoveObjectTag.h,
+ make all those control tags to take a dlist parameter.
+
2008-04-30 Sandro Santilli <address@hidden>
* libbase/rc.cpp: initialize the _lcshmkey member to 0, add a note
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.524
retrieving revision 1.525
diff -u -b -r1.524 -r1.525
--- server/sprite_instance.cpp 30 Apr 2008 02:33:06 -0000 1.524
+++ server/sprite_instance.cpp 30 Apr 2008 09:15:01 -0000 1.525
@@ -2342,7 +2342,6 @@
m_play_state(PLAY),
m_current_frame(0),
m_has_looped(false),
- is_jumping_back(false),
_callingFrameActions(false),
m_as_environment(),
_text_variables(),
@@ -2564,8 +2563,14 @@
const PlayList* playlist = m_def->getPlaylist(frame_number);
if ( playlist )
{
- std::for_each(playlist->begin(), playlist->end(),
- boost::bind(&ControlTag::execute_action, _1, this));
+ // std::for_each(playlist->begin(), playlist->end(),
+ // boost::bind(&ControlTag::execute_action, _1, this));
+ PlayList::const_iterator it = playlist->begin();
+ PlayList::const_iterator e = playlist->end();
+ for(; it != e; it++)
+ {
+ (*it)->execute_action(this, m_display_list);
+ }
}
_callingFrameActions=false;
@@ -2969,7 +2974,7 @@
log_debug("Executing frame%d (0-based) tags of sprite %s",
m_current_frame, getTarget());
#endif
// Make sure m_current_frame is 0-based during execution of DLIST tags
- execute_frame_tags(m_current_frame, TAG_DLIST|TAG_ACTION);
+ execute_frame_tags(m_current_frame, m_display_list,
TAG_DLIST|TAG_ACTION);
}
}
}
@@ -3056,36 +3061,34 @@
// and there are some old questions spreading the source files.
set_invalidated();
- is_jumping_back = true; //remember we are jumping back
-
+ DisplayList m_tmp_display_list;
for (size_t f = 0; f<tgtFrame; ++f)
{
m_current_frame = f;
- execute_frame_tags(f, TAG_DLIST);
+ execute_frame_tags(f, m_tmp_display_list, TAG_DLIST);
}
// Execute both action tags and DLIST tags of the target frame
m_current_frame = tgtFrame;
- execute_frame_tags(tgtFrame, TAG_DLIST|TAG_ACTION);
-
- is_jumping_back = false; // finished jumping back
+ execute_frame_tags(tgtFrame, m_tmp_display_list, TAG_DLIST|TAG_ACTION);
m_display_list.mergeDisplayList(m_tmp_display_list);
}
// 0-based frame number !
void
-sprite_instance::execute_frame_tags(size_t frame, int typeflags)
+sprite_instance::execute_frame_tags(size_t frame, DisplayList& dlist, int
typeflags)
{
testInvariant();
- //assert(frame < get_loaded_frames());
-
assert(typeflags);
const PlayList* playlist = m_def->getPlaylist(frame);
if ( playlist )
{
+ PlayList::const_iterator it = playlist->begin();
+ PlayList::const_iterator e = playlist->end();
+
IF_VERBOSE_ACTION(
// Use 1-based frame numbers
log_action(_("Executing %d tags in frame %d/%d of sprite %s"),
@@ -3095,17 +3098,25 @@
if ( (typeflags&TAG_DLIST) && (typeflags&TAG_ACTION) )
{
- std::for_each( playlist->begin(), playlist->end(),
boost::bind(&ControlTag::execute, _1, this) );
+ for(; it != e; it++)
+ {
+ (*it)->execute(this, dlist);
+ }
}
else if ( typeflags & TAG_DLIST )
{
- assert( ! (typeflags & TAG_ACTION) );
- std::for_each( playlist->begin(), playlist->end(),
boost::bind(&ControlTag::execute_state, _1, this) );
+ for(; it != e; it++)
+ {
+ (*it)->execute_state(this, dlist);
+ }
}
else
{
assert(typeflags & TAG_ACTION);
- std::for_each(playlist->begin(), playlist->end(),
boost::bind(&ControlTag::execute_action, _1, this));
+ for(; it != e; it++)
+ {
+ (*it)->execute_action(this, dlist);
+ }
}
}
@@ -3207,7 +3218,7 @@
// Second argument requests that only "DisplayList" tags
// are executed. This means NO actions will be
// pushed on m_action_list.
- execute_frame_tags(m_current_frame, TAG_DLIST);
+ execute_frame_tags(m_current_frame, m_display_list, TAG_DLIST);
}
assert(m_current_frame == target_frame_number);
@@ -3217,7 +3228,7 @@
// we'll backup and resume the _callingFrameActions flag
bool callingFrameActionsBackup = _callingFrameActions;
_callingFrameActions = false;
- execute_frame_tags(target_frame_number, TAG_DLIST|TAG_ACTION);
+ execute_frame_tags(target_frame_number, m_display_list,
TAG_DLIST|TAG_ACTION);
_callingFrameActions = callingFrameActionsBackup;
}
@@ -3270,9 +3281,7 @@
// descend the display list
m_display_list.display();
-
clear_invalidated();
-
}
bool
@@ -3284,7 +3293,7 @@
}
character*
-sprite_instance::add_display_object(const SWF::PlaceObject2Tag* tag)
+sprite_instance::add_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist)
{
assert(m_def != NULL);
assert(tag != NULL);
@@ -3299,7 +3308,6 @@
return NULL;
}
- DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
character* existing_char = dlist.get_character_at_depth(tag->getDepth());
if(existing_char)
@@ -3341,10 +3349,8 @@
}
void
-sprite_instance::move_display_object(const SWF::PlaceObject2Tag* tag)
+sprite_instance::move_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist)
{
- DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
-
int ratio = tag->getRatio();
dlist.move_character(
tag->getDepth(),
@@ -3354,7 +3360,7 @@
NULL); // clip_depth is not used in MOVE tag(at least no related
tests).
}
-void sprite_instance::replace_display_object(const SWF::PlaceObject2Tag* tag)
+void sprite_instance::replace_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist)
{
assert(m_def != NULL);
assert(tag != NULL);
@@ -3368,7 +3374,6 @@
}
assert(cdef);
- DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
character* existing_char = dlist.get_character_at_depth(tag->getDepth());
if (existing_char)
@@ -3376,7 +3381,7 @@
// if the existing character is not a shape, move it instead of replace
if ( existing_char->isActionScriptReferenceable() )
{
- move_display_object(tag);
+ move_display_object(tag, dlist);
return;
}
else
@@ -3406,7 +3411,7 @@
{
ch->set_matrix(tag->getMatrix());
}
- replace_display_object(ch.get(), tag->getDepth(),
+ dlist.replace_character(ch.get(), tag->getDepth(),
!tag->hasCxform(), // use matrix from the old character if tag
doesn't provide one.
!tag->hasMatrix());
}
@@ -3417,6 +3422,12 @@
}
}
+void sprite_instance::remove_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist)
+{
+ set_invalidated();
+ dlist.remove_character(tag->getDepth());
+}
+
void sprite_instance::replace_display_object(
character* ch,
int depth,
@@ -3425,9 +3436,7 @@
{
assert(ch != NULL);
- DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
-
- dlist.replace_character(ch, depth, use_old_cxform, use_old_matrix);
+ m_display_list.replace_character(ch, depth, use_old_cxform,
use_old_matrix);
}
int sprite_instance::get_id_at_depth(int depth)
@@ -4135,7 +4144,7 @@
#ifdef GNASH_DEBUG
log_debug(_("Executing tags of frame0 in sprite %s"), getTarget());
#endif
- execute_frame_tags(0, TAG_DLIST|TAG_ACTION);
+ execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
if ( _vm.getSWFVersion() > 5 )
{
@@ -4157,7 +4166,7 @@
#ifdef GNASH_DEBUG
log_debug(_("Executing tags of frame0 in sprite %s"), getTarget());
#endif
- execute_frame_tags(0, TAG_DLIST|TAG_ACTION);
+ execute_frame_tags(0, m_display_list, TAG_DLIST|TAG_ACTION);
}
}
@@ -4578,8 +4587,6 @@
m_display_list.visitAll(marker);
- assert(m_tmp_display_list.empty());
-
_drawable->setReachable();
_drawable_inst->setReachable();
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -b -r1.189 -r1.190
--- server/sprite_instance.h 30 Apr 2008 02:33:06 -0000 1.189
+++ server/sprite_instance.h 30 Apr 2008 09:15:02 -0000 1.190
@@ -357,24 +357,14 @@
/// Any successful new placement triggers invokation of the newly
created
/// instance's LOAD event.
///
- /// @param tag
- /// A swf defined placement tag(PlaceObject, or PlaceObject2, or
PlaceObject3)
- /// No ownership transfer, the tag is still owned by the
movie_definition class.
- ///
- /// @return
- /// A pointer to the character being added or NULL
- /// if this call results in a move of an existing character
- /// or in a no-op due to is_jumping_back being false.
- ///
- character* add_display_object(const SWF::PlaceObject2Tag* tag);
-
- /// Proxy of DisplayList::move_display_object()
- //
- void move_display_object(const SWF::PlaceObject2Tag* tag);
-
- void replace_display_object(const SWF::PlaceObject2Tag* tag);
-
+ character* add_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist);
+ // Proxy of DisplayList::move_character()
+ void move_display_object(const SWF::PlaceObject2Tag* tag, DisplayList&
dlist);
// Proxy of DisplayList::replace_character()
+ void replace_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist);
+ // Proxy of DisplayList::remove_character()
+ void remove_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist);
+
void replace_display_object(character* ch, int depth,
bool use_old_cxform,
bool use_old_matrix);
@@ -389,8 +379,7 @@
void remove_display_object(int depth, int /* id */)
{
set_invalidated();
- DisplayList& dlist = const_cast<DisplayList &>(
getDisplayList() );
- dlist.remove_character(depth);
+ m_display_list.remove_character(depth);
}
/// Attach the given character instance to current display list
@@ -620,11 +609,7 @@
const DisplayList& getDisplayList() const {
- if(! is_jumping_back) {
return m_display_list;
- } else {
- return m_tmp_display_list;
- }
}
/// Return the next highest available depth
@@ -874,9 +859,6 @@
/// Current Display List contents.
DisplayList m_display_list;
- /// temporary display list used for timeline construction during jump
back
- DisplayList m_tmp_display_list;
-
/// The canvas for dynamic drawing
//
/// WARNING: since DynamicShape is a character_def, which is
@@ -907,9 +889,6 @@
// true if this sprite reached the last frame and restarted
bool m_has_looped;
- // true is the sprite is jumping back.
- bool is_jumping_back;
-
// true is we're calling frame actions
bool _callingFrameActions;
@@ -971,7 +950,7 @@
/// Which kind of control tags we want to execute.
/// See control_tag_type enum.
///
- void execute_frame_tags(size_t frame, int
typeflags=TAG_DLIST|TAG_ACTION);
+ void execute_frame_tags(size_t frame, DisplayList& dlist, int
typeflags=TAG_DLIST|TAG_ACTION);
/// \brief
/// This is either sprite_definition (for sprites defined by
Index: server/swf/ControlTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ControlTag.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/swf/ControlTag.h 21 Jan 2008 20:56:01 -0000 1.3
+++ server/swf/ControlTag.h 30 Apr 2008 09:15:03 -0000 1.4
@@ -29,6 +29,7 @@
// Forward declarations
class sprite_instance;
+class DisplayList;
/// Control tags are swf tags that control the operation of the movie.
//
@@ -43,7 +44,7 @@
}
/// Execute this tag, whatever it is.
- virtual void execute(sprite_instance* /*m*/) const
+ virtual void execute(sprite_instance* /*m*/, DisplayList& /*dlist*/)
const
{
}
@@ -51,14 +52,14 @@
//
/// State tags include all tags except action tags.
///
- virtual void execute_state(sprite_instance* /*m*/) const
+ virtual void execute_state(sprite_instance* /*m*/, DisplayList&
/*dlist*/) const
{
}
/// Execute this tag but only if it is an action tag
- void execute_action(sprite_instance* m) const
+ void execute_action(sprite_instance* m, DisplayList& dlist) const
{
- if ( is_action_tag() ) execute(m);
+ if ( is_action_tag() ) execute(m, dlist);
}
/// Return true if this is an action tag.
Index: server/swf/DisplayListTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DisplayListTag.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/swf/DisplayListTag.h 28 Apr 2008 06:44:51 -0000 1.11
+++ server/swf/DisplayListTag.h 30 Apr 2008 09:15:04 -0000 1.12
@@ -54,11 +54,11 @@
virtual ~DisplayListTag() {}
- virtual void execute(sprite_instance* m) const=0;
+ virtual void execute(sprite_instance* m, DisplayList& dlist) const=0;
- void execute_state(sprite_instance* m) const
+ void execute_state(sprite_instance* m, DisplayList& dlist) const
{
- execute(m);
+ execute(m, dlist);
}
/// Return the depth affected by this DisplayList tag
Index: server/swf/DoActionTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DoActionTag.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/swf/DoActionTag.h 21 Jan 2008 20:56:02 -0000 1.12
+++ server/swf/DoActionTag.h 30 Apr 2008 09:15:08 -0000 1.13
@@ -56,7 +56,7 @@
m_buf.read(*in, in->get_tag_end_position());
}
- virtual void execute(sprite_instance* m) const
+ virtual void execute(sprite_instance* m, DisplayList& /* dlist */) const
{
m->add_action_buffer(&m_buf);
}
Index: server/swf/DoInitActionTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DoInitActionTag.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/swf/DoInitActionTag.h 21 Jan 2008 20:56:02 -0000 1.8
+++ server/swf/DoInitActionTag.h 30 Apr 2008 09:15:09 -0000 1.9
@@ -52,12 +52,12 @@
read(in);
}
- virtual void execute_state(sprite_instance* m) const
+ virtual void execute_state(sprite_instance* m, DisplayList& /*dlist*/)
const
{
m->execute_init_action_buffer(_buf, _cid);
}
- virtual void execute(sprite_instance* m) const
+ virtual void execute(sprite_instance* m, DisplayList& /*dlist*/) const
{
m->execute_init_action_buffer(_buf, _cid);
}
Index: server/swf/PlaceObject2Tag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/swf/PlaceObject2Tag.cpp 28 Apr 2008 06:44:51 -0000 1.40
+++ server/swf/PlaceObject2Tag.cpp 30 Apr 2008 09:15:10 -0000 1.41
@@ -421,24 +421,24 @@
/// Place/move/whatever our object in the given movie.
void
-PlaceObject2Tag::execute(sprite_instance* m) const
+PlaceObject2Tag::execute(sprite_instance* m, DisplayList& dlist) const
{
switch ( getPlaceType() )
{
case PLACE:
- m->add_display_object(this);
+ m->add_display_object(this, dlist);
break;
case MOVE:
- m->move_display_object(this);
+ m->move_display_object(this, dlist);
break;
case REPLACE:
- m->replace_display_object(this);
+ m->replace_display_object(this, dlist);
break;
case REMOVE:
- m->remove_display_object(m_depth, 0); // 0 since it is unused.
+ m->remove_display_object(this, dlist);
break;
}
}
Index: server/swf/PlaceObject2Tag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/swf/PlaceObject2Tag.h 28 Apr 2008 06:44:51 -0000 1.25
+++ server/swf/PlaceObject2Tag.h 30 Apr 2008 09:15:11 -0000 1.26
@@ -37,6 +37,7 @@
class swf_event;
class action_buffer;
class movie_definition;
+ class DisplayList;
}
namespace gnash {
@@ -111,7 +112,7 @@
void read(stream& in, tag_type tag);
/// Place/move/whatever our object in the given movie.
- void execute(sprite_instance* m) const;
+ void execute(sprite_instance* m, DisplayList& dlist) const;
static void loader(stream* in, tag_type tag, movie_definition* m);
Index: server/swf/RemoveObjectTag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/RemoveObjectTag.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/swf/RemoveObjectTag.cpp 10 Apr 2008 03:52:08 -0000 1.9
+++ server/swf/RemoveObjectTag.cpp 30 Apr 2008 09:15:11 -0000 1.10
@@ -48,9 +48,10 @@
}
void
-RemoveObjectTag::execute(sprite_instance* m) const
+RemoveObjectTag::execute(sprite_instance* m, DisplayList& dlist) const
{
- m->remove_display_object(m_depth, m_id);
+ m->set_invalidated();
+ dlist.remove_character(m_depth);
}
/* public static */
Index: server/swf/RemoveObjectTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/RemoveObjectTag.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/swf/RemoveObjectTag.h 28 Apr 2008 06:44:52 -0000 1.9
+++ server/swf/RemoveObjectTag.h 30 Apr 2008 09:15:11 -0000 1.10
@@ -33,6 +33,7 @@
class sprite_instance;
class swf_event;
class movie_definition;
+ class DisplayList;
}
namespace gnash {
@@ -58,7 +59,7 @@
void read(stream* in, tag_type tag);
/// Remove object at specified depth from sprite_instance DisplayList.
- void execute(sprite_instance* m) const;
+ void execute(sprite_instance* m, DisplayList& dlist) const;
static void loader(stream* in, tag_type tag, movie_definition* m);