gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/character.h server/dlist...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/character.h server/dlist...
Date: Wed, 24 Jan 2007 23:33:01 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/01/24 23:33:01

Modified files:
        .              : ChangeLog 
        server         : character.h dlist.cpp dlist.h 
                         sprite_instance.cpp 
        testsuite/misc-ming.all: Makefile.am 
                                 action_execution_order_test.c 
                                 attachMovieLoopingTest.c 
                                 attachMovieLoopingTestRunner.cpp 

Log message:
                * server/character.h: add isDynamic() and setDynamic()
                  function to tag actionscript-created characters;
                  have accept_anim_moves return false for dynamic chars.
                * server/dlist.{cpp,h}: new add() and addAll() helper methods.
                * server/sprite_instance.cpp (execute_frame_tags):
                  keep script objects when reinitializing DisplayList
                  on loop-back; (sprite_attach_movie, 
sprite_duplicate_movieclip,
                  add_empty_movieclip): mark created characters as dynamic.
                * testsuite/misc-ming.all/: Makefile.am, 
attachMovieLoopingTest.c,
                  attachMovieLoopingTestRunner.cpp: test for DisplayList reset
                  on loopback when dynamic characters are present.
                * testsuite/misc-ming.all/action_execution_order_test.c:
                  expect failure of the only test in there...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2169&r2=1.2170
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.135&r2=1.136
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/action_execution_order_test.c?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/attachMovieLoopingTest.c?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/attachMovieLoopingTestRunner.cpp?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2169
retrieving revision 1.2170
diff -u -b -r1.2169 -r1.2170
--- ChangeLog   24 Jan 2007 15:17:28 -0000      1.2169
+++ ChangeLog   24 Jan 2007 23:33:00 -0000      1.2170
@@ -1,5 +1,21 @@
 2007-01-24 Sandro Santilli <address@hidden>
 
+       * server/character.h: add isDynamic() and setDynamic()
+         function to tag actionscript-created characters;
+         have accept_anim_moves return false for dynamic chars.
+       * server/dlist.{cpp,h}: new add() and addAll() helper methods.
+       * server/sprite_instance.cpp (execute_frame_tags): 
+         keep script objects when reinitializing DisplayList
+         on loop-back; (sprite_attach_movie, sprite_duplicate_movieclip,
+         add_empty_movieclip): mark created characters as dynamic.
+       * testsuite/misc-ming.all/: Makefile.am, attachMovieLoopingTest.c,
+         attachMovieLoopingTestRunner.cpp: test for DisplayList reset
+         on loopback when dynamic characters are present.
+       * testsuite/misc-ming.all/action_execution_order_test.c:
+         expect failure of the only test in there...
+
+2007-01-24 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/: Makefile.am,
          action_execution_order_test.c, attachMovieLoopingTest.c,
          attachMovieLoopingTestRunner.cpp:

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- server/character.h  24 Jan 2007 13:23:18 -0000      1.37
+++ server/character.h  24 Jan 2007 23:33:00 -0000      1.38
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: character.h,v 1.37 2007/01/24 13:23:18 strk Exp $ */
+/* $Id: character.h,v 1.38 2007/01/24 23:33:00 strk Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -126,6 +126,8 @@
        ///
        bool _scriptTransformed;
 
+       bool _dynamicallyCreated;
+
 public:
 
     character(character* parent, int id)
@@ -141,7 +143,8 @@
        m_parent(parent),
        m_invalidated(true),
        m_old_invalidated_bounds(),
-       _scriptTransformed(false)
+       _scriptTransformed(false),
+       _dynamicallyCreated(false)
        {
            assert((parent == NULL && m_id == -1)
                   || (parent != NULL && m_id >= 0));
@@ -336,7 +339,23 @@
        ///
        bool get_accept_anim_moves() const
        {
-               return ! _scriptTransformed;
+               return ! _scriptTransformed && ! _dynamicallyCreated;
+       }
+
+       /// Was this character dynamically created ?
+       //
+       /// "Dynamically created" means created trough ActionScript
+       ///
+       bool isDynamic() const {
+               return _dynamicallyCreated;
+       }
+
+       /// Mark this character as dynamically created
+       //
+       /// "Dynamically created" means created trough ActionScript
+       ///
+       void setDynamic() {
+               _dynamicallyCreated = true;
        }
 
        /// \brief

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- server/dlist.cpp    10 Jan 2007 11:21:50 -0000      1.43
+++ server/dlist.cpp    24 Jan 2007 23:33:00 -0000      1.44
@@ -217,6 +217,35 @@
 }
 
 void
+DisplayList::add(character* ch, bool replace)
+{
+       int depth = ch->get_depth();
+
+       container_type::iterator it = find_if(
+                       _characters.begin(), _characters.end(),
+                       DepthGreaterOrEqual(depth));
+       if ( it == _characters.end() || (*it)->get_depth() != depth )
+       {
+               _characters.insert(it, DisplayItem(ch));
+       }
+       else if ( replace )
+       {
+               *it = DisplayItem(ch);
+       }
+}
+
+void
+DisplayList::addAll(std::vector<character*>& chars, bool replace)
+{
+       for (std::vector<character*>::iterator it=chars.begin(),
+                       itEnd=chars.end();
+                       it != itEnd; ++it)
+       {
+               add(*it, replace);
+       }
+}
+
+void
 DisplayList::replace_character(
        character* ch,
        uint16_t depth,

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/dlist.h      10 Jan 2007 11:21:50 -0000      1.22
+++ server/dlist.h      24 Jan 2007 23:33:00 -0000      1.23
@@ -138,6 +138,12 @@
        ///
        void clear_except(std::vector<character*>& exclude);
 
+       /// Add all chars in the list
+       void addAll(std::vector<character*>& chars, bool replace);
+
+       /// Add chars in the list
+       void add(character* ch, bool replace);
+
        // It is executed only before the second and the subsequent
        // execution of execute_frame_tags(0) for sprite_instance
        // with frame count > 1.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- server/sprite_instance.cpp  24 Jan 2007 17:13:24 -0000      1.135
+++ server/sprite_instance.cpp  24 Jan 2007 23:33:00 -0000      1.136
@@ -71,7 +71,7 @@
 // for '_x' property, but attachMovieTest is succeeding with the *new* layout
 // and failign with the previous.
 //
-//#define OLD_GET_MEMBER
+#define OLD_GET_MEMBER
 
 // Forward declarations
 static as_object* getMovieClipInterface();
@@ -219,6 +219,8 @@
                return;
        }
 
+       newch->setDynamic();
+
        /// Properties must be copied *after* the call to attachCharacter
        /// because attachCharacter() will reset matrix !!
        if (fn.nargs > 3 ) {
@@ -396,6 +398,8 @@
                        sprite->get_ratio(),
                        sprite->get_clip_depth());
 
+               ch->setDynamic();
+
                // Copy members from initObject
                if (fn.nargs == 3 && ch)
                {
@@ -1679,6 +1683,76 @@
        }
 };
 
+/// A DisplayList visitor used to extract script characters
+//
+/// Script characters are characters created or transformed
+/// by ActionScript
+///
+class ScriptObjectsFinder {
+       std::vector<character*>& _chars;
+public:
+       ScriptObjectsFinder(std::vector<character*>& chars)
+               :
+               _chars(chars)
+       {}
+
+       bool operator() (character* ch) 
+       {
+               // TODO: Are script-transformed object to be kept ?
+               //       Need a testcase for this
+               if ( ! ch->get_accept_anim_moves() )
+               //if ( ch->isDynamic() )
+               {
+                       _chars.push_back(ch);
+               }
+               return true; // keep scanning
+       }
+};
+
+/// A DisplayList visitor used to extract static characters
+//
+/// Static characters are characters instantiaced trough display-list SWF tags
+///
+class StaticObjectsFinder {
+       std::vector<character*>& _chars;
+public:
+       StaticObjectsFinder(std::vector<character*>& chars)
+               :
+               _chars(chars)
+       {}
+
+       bool operator() (character* ch) 
+       {
+               //if ( ch->get_accept_anim_moves() )
+               if ( ! ch->isDynamic() )
+               {
+                       _chars.push_back(ch);
+               }
+               return true; // keep scanning
+       }
+};
+
+/// A DisplayList visitor used to extract all characters
+//
+/// Script characters are characters created or transformed
+/// by ActionScript
+///
+class CharactersExtractor {
+       std::vector<character*>& _chars;
+public:
+       CharactersExtractor(std::vector<character*>& chars)
+               :
+               _chars(chars)
+       {}
+
+       bool operator() (character* ch) 
+       {
+               _chars.push_back(ch);
+               return true; // keep scanning
+       }
+};
+
+
 //------------------------------------------------
 // sprite_instance
 //------------------------------------------------
@@ -2164,6 +2238,7 @@
 
        sprite_instance* sprite = new sprite_instance(empty_sprite_def, m_root, 
this, 0);
        sprite->set_name(name);
+       sprite->setDynamic();
 
        m_display_list.place_character(
                sprite,
@@ -2758,6 +2833,15 @@
                // characters in it might have been
                // externally changed.
                _frame0_chars.sort();
+
+               // Add script objects in current DisplayList
+               std::vector<character*> charsToAdd; 
+               ScriptObjectsFinder scriptObjFinder(charsToAdd);
+               m_display_list.visitForward(scriptObjFinder);
+               // NOTE: script objects are *not* allowed to replace depths
+               //       of static objects (change second argument to switch)
+               _frame0_chars.addAll(charsToAdd, false);
+
                m_display_list = _frame0_chars;
        }
 

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- testsuite/misc-ming.all/Makefile.am 24 Jan 2007 15:17:28 -0000      1.56
+++ testsuite/misc-ming.all/Makefile.am 24 Jan 2007 23:33:01 -0000      1.57
@@ -437,6 +437,7 @@
        place_and_remove_object_testrunner \
        place_and_remove_object_insane_testrunner \
        attachMovieTestRunner \
+       attachMovieLoopingTestRunner \
        goto_frame_testrunner \
        registerClassTestRunner \
        action_execution_order_testrunner \

Index: testsuite/misc-ming.all/action_execution_order_test.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/action_execution_order_test.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/action_execution_order_test.c       24 Jan 2007 
15:17:28 -0000      1.1
+++ testsuite/misc-ming.all/action_execution_order_test.c       24 Jan 2007 
23:33:01 -0000      1.2
@@ -84,7 +84,7 @@
   //at 1st frame, actions in mc_red is executed *after* actions in _root
   check_equals(mo, "_root.x1", "'as_in_mc_red'");
   //at 2nd frame, actions in mc_red is executed *before* actions in _root
-  check_equals(mo, "_root.x2", "'as_in_root'");
+  xcheck_equals(mo, "_root.x2", "'as_in_root'");
   add_actions(mo, " _root.totals(); stop(); ");
   SWFMovie_nextFrame(mo); //3rd frame
 

Index: testsuite/misc-ming.all/attachMovieLoopingTest.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/attachMovieLoopingTest.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/attachMovieLoopingTest.c    24 Jan 2007 15:17:28 
-0000      1.1
+++ testsuite/misc-ming.all/attachMovieLoopingTest.c    24 Jan 2007 23:33:01 
-0000      1.2
@@ -107,11 +107,22 @@
 
        add_actions(mo,
                "if ( counter < 4 ) {"
+               "       if ( counter != undefined ) { "
                "       initObj._x = 70*counter;"
                "       attachMovie('redsquare', "
                "               'square'+counter, 70+counter, initObj);"
+               "       } else {"
+               /* We don't use an initObject for the first attachMovie call
+                * to verify that the character will be kept in DisplayList
+                * at loopback time anyway
+                */
+               "               attachMovie('redsquare', "
+               "                       'square'+counter, 70+counter);"
+               "       }"
                "       check_equals(this['square'+counter]._x, 70*counter);"
+               "       note('Depth is '+70*counter);"
                "       counter++;"
+               "       note('Next counter is '+counter);"
                "} else {"
                "       totals(); stop();"
                "}"

Index: testsuite/misc-ming.all/attachMovieLoopingTestRunner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/attachMovieLoopingTestRunner.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/attachMovieLoopingTestRunner.cpp    24 Jan 2007 
15:17:28 -0000      1.1
+++ testsuite/misc-ming.all/attachMovieLoopingTestRunner.cpp    24 Jan 2007 
23:33:01 -0000      1.2
@@ -57,7 +57,7 @@
        tester.movePointerTo(30, 30);
        check(!tester.isMouseOverMouseEntity());
 
-       tester.advance();
+       tester.advance(); check_equals(root->get_current_frame(), 1);
 
        check(tester.findDisplayItemByDepth(*root, 70) );
        check(! tester.findDisplayItemByDepth(*root, 71) );
@@ -69,8 +69,8 @@
        tester.movePointerTo(100, 30);
        check(!tester.isMouseOverMouseEntity());
 
-
-       tester.advance();
+       tester.advance(); check_equals(root->get_current_frame(), 0);
+       tester.advance(); check_equals(root->get_current_frame(), 1);
 
        check( tester.findDisplayItemByDepth(*root, 70) );
        check( tester.findDisplayItemByDepth(*root, 71) );
@@ -82,7 +82,8 @@
        tester.movePointerTo(170, 30);
        check(!tester.isMouseOverMouseEntity());
 
-       tester.advance();
+       tester.advance(); check_equals(root->get_current_frame(), 0);
+       tester.advance(); check_equals(root->get_current_frame(), 1);
 
        check( tester.findDisplayItemByDepth(*root, 70) );
        check( tester.findDisplayItemByDepth(*root, 71) );
@@ -94,7 +95,8 @@
        tester.movePointerTo(240, 30);
        check(!tester.isMouseOverMouseEntity());
 
-       tester.advance();
+       tester.advance(); check_equals(root->get_current_frame(), 0);
+       tester.advance(); check_equals(root->get_current_frame(), 1);
 
        check( tester.findDisplayItemByDepth(*root, 70) );
        check( tester.findDisplayItemByDepth(*root, 71) );




reply via email to

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