gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/movie_instance.h server/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/movie_instance.h server/...
Date: Fri, 14 Dec 2007 20:13:47 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/14 20:13:47

Modified files:
        .              : ChangeLog 
        server         : movie_instance.h sprite_instance.cpp 
                         sprite_instance.h 
        server/swf     : DoInitActionTag.h 
        testsuite/misc-swfmill.all: Makefile.am 

Log message:
        Rework handlign of init actions. Fixes init actions in define sprites
        w/out putting state in character definitions. A subsequent cleanup
        pass is possible in movie_def_impl/movie_definition (drop of unused
        interfaces)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5176&r2=1.5177
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_instance.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.412&r2=1.413
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.156&r2=1.157
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DoInitActionTag.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfmill.all/Makefile.am?cvsroot=gnash&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5176
retrieving revision 1.5177
diff -u -b -r1.5176 -r1.5177
--- ChangeLog   14 Dec 2007 17:24:40 -0000      1.5176
+++ ChangeLog   14 Dec 2007 20:13:46 -0000      1.5177
@@ -1,5 +1,20 @@
 2007-12-14 Sandro Santilli <address@hidden>
 
+       * server/swf/DoInitActionTag.h: store referenced character
+         in the instance, pass to execute_init_actions when
+         executing; add self as a normal control tag.
+       * server/movie_instance.h: maintain a set of 'initialized'
+         characters (characters referenced by executed DoInitAction
+         tags).
+       * server/sprite_instance.{cpp,h} (execute_init_action):
+         update the movie_instance maintained set of initialized
+         characters and use that set to figure out whether or not
+         to execute them again.
+       * testsuite/misc-swfmill.all/Makefile.am: expect a success
+         for initaction in definesprite test.
+
+2007-12-14 Sandro Santilli <address@hidden>
+
        * testsuite/misc-swfmill.all/: Makefile.am,
          initaction_in_definesprite.xml: test that DOINITACTION
          tags in sprite definitions are valid, and that whether or

Index: server/movie_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_instance.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/movie_instance.h     10 Dec 2007 20:17:17 -0000      1.10
+++ server/movie_instance.h     14 Dec 2007 20:13:46 -0000      1.11
@@ -29,6 +29,7 @@
 #endif
 
 #include <vector>
+#include <set>
 
 #include "sprite_instance.h" // for inheritance
 #include "smart_ptr.h" // for composition
@@ -74,8 +75,22 @@
        ///
        void stagePlacementCallback();
 
+       /// Set a character in the dictionary as initialized, returning
+       /// true if not already initialized.
+       bool setCharacterInitialized(int cid)
+       {
+               return _initializedCharacters.insert(cid).second;
+       }
+
 private:
 
+       /// A map to track execution of init actions
+       //
+       /// Elements of this set are ids of characters
+       /// in our definition's CharacterDictionary.
+       ///
+       std::set<int> _initializedCharacters;
+
        boost::intrusive_ptr<movie_definition> _def;
 };
 

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.412
retrieving revision 1.413
diff -u -b -r1.412 -r1.413
--- server/sprite_instance.cpp  12 Dec 2007 14:24:16 -0000      1.412
+++ server/sprite_instance.cpp  14 Dec 2007 20:13:46 -0000      1.413
@@ -1829,7 +1829,7 @@
        m_has_looped(false),
        is_jumping_back(false),
        _callingFrameActions(false),
-       m_init_actions_executed(),
+       //m_init_actions_executed(),
        m_as_environment(),
        m_has_key_event(false),
        m_has_mouse_event(false),
@@ -2489,9 +2489,10 @@
 }
 
 void
-sprite_instance::execute_init_action_buffer(const action_buffer& a)
+sprite_instance::execute_init_action_buffer(const action_buffer& a, int cid)
 {
-       if ( m_init_actions_executed.find(m_current_frame) == 
m_init_actions_executed.end() )
+       movie_instance* mi = get_root();
+       if ( mi->setCharacterInitialized(cid) )
        {
 #ifdef GNASH_DEBUG
                log_debug("Queuing init actions in frame " SIZET_FMT " of 
sprite %s", m_current_frame, getTarget().c_str());
@@ -2514,7 +2515,7 @@
        else
        {
 #ifdef GNASH_DEBUG
-               log_debug("Init actions in frame " SIZET_FMT " of sprite %s 
already executed", m_current_frame, getTarget().c_str());
+               log_debug("Init actions for character %d already executed", 
cid);
 #endif
        }
 }
@@ -2597,7 +2598,7 @@
        }
 
        // Mark this frame's init actions as executed 
-       m_init_actions_executed.insert(frame);
+       //m_init_actions_executed.insert(frame);
 
        testInvariant();
 }

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- server/sprite_instance.h    12 Dec 2007 08:38:16 -0000      1.156
+++ server/sprite_instance.h    14 Dec 2007 20:13:46 -0000      1.157
@@ -525,13 +525,19 @@
        
        /// \brief
        /// Execute the given init action buffer, if not done yet
-       /// for the current frame
+       /// for the target character id.
        //
        /// The action will normally be pushed on queue, but will
        /// be executed immediately if we are executing actions
        /// resulting from a callFame instead.
        ///
-       void execute_init_action_buffer(const action_buffer& a);
+       /// @param a
+       ///     The action buffer to execute
+       ///
+       /// @param cid
+       ///     The referenced character id
+       ///
+       void execute_init_action_buffer(const action_buffer& a, int cid);
 
        /// Execute a single action buffer (DOACTION block)
        void execute_action(const action_buffer& ab);
@@ -971,7 +977,7 @@
        bool _callingFrameActions;
 
        // a bit-array class would be ideal for this
-       std::set<size_t>        m_init_actions_executed;
+       //std::set<size_t>      m_init_actions_executed;
 
        /// This timeline's variable scope
        as_environment  m_as_environment;

Index: server/swf/DoInitActionTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DoInitActionTag.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/swf/DoInitActionTag.h        13 Dec 2007 10:58:10 -0000      1.5
+++ server/swf/DoInitActionTag.h        14 Dec 2007 20:13:46 -0000      1.6
@@ -48,24 +48,21 @@
 {
 public:
 
-    DoInitActionTag()
-    {}
-
-    /// Read a DoInitAction block from the stream
-    //
-    void read(stream* in)
+    DoInitActionTag(stream& in, int cid)
+       :
+       _cid(cid)
     {
-        m_buf.read(*in, in->get_tag_end_position());
+        read(in);
     }
 
     virtual void execute_state(sprite_instance* m) const
     {
-        m->execute_init_action_buffer(m_buf);
+        m->execute_init_action_buffer(m_buf, _cid);
     }
 
     virtual void execute(sprite_instance* m) const
     {
-        m->execute_init_action_buffer(m_buf);
+        m->execute_init_action_buffer(m_buf, _cid);
     }
 
     // Tell the caller that we are an action tag.
@@ -76,21 +73,32 @@
 
     static void doInitActionLoader(stream* in, tag_type tag, movie_definition* 
m)
     {
-        DoInitActionTag* da = new DoInitActionTag;
         int cid = in->read_u16();
-        da->read(in);
+        DoInitActionTag* da = new DoInitActionTag(*in, cid);
 
         IF_VERBOSE_PARSE (
         log_parse(_("  tag %d: do_init_action_loader"), tag);
         log_parse(_("  -- init actions for sprite %d"), cid);
         );
 
-        m->add_init_action(da, cid); // ownership transferred
+        //m->add_init_action(da, cid); // ownership transferred
+        m->addControlTag(da); // ownership transferred
     }
 
 private:
 
+    /// Read a DoInitAction block from the stream
+    //
+    void read(stream& in)
+    {
+        m_buf.read(in, in.get_tag_end_position());
+    }
+
+
     action_buffer m_buf;
+
+    // id of referenced character definition
+    int _cid;
 };
 
 } // namespace gnash::SWF

Index: testsuite/misc-swfmill.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-swfmill.all/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/misc-swfmill.all/Makefile.am      14 Dec 2007 17:24:40 -0000      
1.9
+++ testsuite/misc-swfmill.all/Makefile.am      14 Dec 2007 20:13:46 -0000      
1.10
@@ -56,7 +56,7 @@
        chmod 755 $@
 
 initaction_in_definesprite-runner: $(srcdir)/../generic-testrunner.sh 
initaction_in_definesprite.swf Makefile
-       sh $< -r 50 -C "END OF TEST" $(top_builddir) 
initaction_in_definesprite.swf > $@
+       sh $< -r 50 -c "END OF TEST" $(top_builddir) 
initaction_in_definesprite.swf > $@
        chmod 755 $@
 
 .xml.swf: 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]