gnash-commit
[Top][All Lists]
Advanced

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

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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
Date: Fri, 16 Feb 2007 12:27:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/02/16 12:27:28

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp dlist.h sprite_instance.cpp 
        testsuite/misc-ming.all: action_execution_order_test.c 

Log message:
                * server/dlist.{h,cpp}: don't dispatch UNLOAD event
                  unless explicitly requested by caller.
                * server/sprite_instance.cpp: properly dispatch
                  UNLOAD event on just-removed chars.
                * testsuite/misc-ming.all/action_execution_order_test.c:
                  Added an additional test for order of onLoad event call.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2378&r2=1.2379
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.165&r2=1.166
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/action_execution_order_test.c?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2378
retrieving revision 1.2379
diff -u -b -r1.2378 -r1.2379
--- ChangeLog   16 Feb 2007 11:30:34 -0000      1.2378
+++ ChangeLog   16 Feb 2007 12:27:27 -0000      1.2379
@@ -1,5 +1,14 @@
 2007-02-16 Sandro Santilli <address@hidden>
 
+       * server/dlist.{h,cpp}: don't dispatch UNLOAD event
+         unless explicitly requested by caller. 
+       * server/sprite_instance.cpp: properly dispatch
+         UNLOAD event on just-removed chars.
+       * testsuite/misc-ming.all/action_execution_order_test.c:
+         Added an additional test for order of onLoad event call.
+
+2007-02-16 Sandro Santilli <address@hidden>
+
        * server/sprite_instance.cpp: 
          Warn only once about unsupported stuff; Provide
          the *unimplemented* MovieClip.moveTo method.

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/dlist.cpp    16 Feb 2007 10:39:55 -0000      1.48
+++ server/dlist.cpp    16 Feb 2007 12:27:27 -0000      1.49
@@ -375,14 +375,6 @@
 
        if ( new_end != _characters.end() )
        {
-               // UNLOAD event in DisplayList::clear() it is not caused,
-               // since character is removed already
-               DisplayItem& di = *new_end;
-               if (new_end->get())
-               {
-                       di->on_event(event_id::UNLOAD);
-               }
-
                _characters.erase(new_end, _characters.end());
 
        }
@@ -398,17 +390,21 @@
        
 // clear the display list.
 void
-DisplayList::clear()
+DisplayList::clear(bool call_unload)
 {
        //GNASH_REPORT_FUNCTION;
 
+       // This might eventually become obsoleted
+       if ( call_unload )
+       {
        for (iterator it = _characters.begin(),
                        itEnd = _characters.end();
                it != itEnd; ++it)
        {
                DisplayItem& di = *it;
                if ( ! it->get() ) continue;
-               di->on_event(event_id::UNLOAD);
+                       di->on_event(event_id::UNLOAD); // if call_unload
+               }
        }
                
        _characters.clear();
@@ -425,7 +421,7 @@
        }
 }
        
-void DisplayList::clear_unaffected(std::vector<uint16>& affected_depths)
+void DisplayList::clear_unaffected(std::vector<uint16>& affected_depths, bool 
call_unload)
 {
        //GNASH_REPORT_FUNCTION;
 
@@ -448,7 +444,7 @@
 
                if (is_affected == false)
                {
-                       di->on_event(event_id::UNLOAD);
+                       if ( call_unload ) di->on_event(event_id::UNLOAD);
                        it = _characters.erase(it);
                        continue;
                }
@@ -547,18 +543,6 @@
        }
 }
        
-// reset the references to the display list.
-void
-DisplayList::reset()
-{
-       // GNASH_REPORT_FUNCTION;
-
-       // We just clear the container, but
-       // might eventually keep it allocated
-       // to reduce allocation costs.
-       _characters.clear();
-}
-       
 void
 DisplayList::advance(float delta_time)
 // advance referenced characters.

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/dlist.h      16 Feb 2007 10:36:21 -0000      1.26
+++ server/dlist.h      16 Feb 2007 12:27:27 -0000      1.27
@@ -120,12 +120,18 @@
                uint16_t clip_depth);
 
        /// Removes the object at the specified depth.
+       //
+       /// Does *not* calls UNLOAD event 
+       ///
        void    remove_display_object(uint16_t depth);
 
-       /// \brief
-       /// Clear the display list, calling the UNLOAD event
-       /// on each item still present
-       void clear();
+       /// Clear the display list.
+       //
+       /// @param call_unload
+       ///     If true, UNLOAD event will be invoked on the characters being
+       ///     removed. False by default.
+       ///
+       void clear(bool call_unload=false);
 
        /// \brief
        /// Clear all characters in this DisplayList that are also found
@@ -189,12 +195,16 @@
        //
        // TODO: remove this method
        //
-       void clear_unaffected(std::vector<uint16>& affected_depths);
+       /// @param call_unload
+       ///     If true, UNLOAD event will be invoked on the characters being
+       ///     removed. False by default.
+       ///
+       void clear_unaffected(std::vector<uint16>& affected_depths, bool 
call_unload=false);
 
-       /// \brief
-       /// Clear the display list, w/out calling the UNLOAD event
-       /// on the items.
-       void reset();
+       /// Just an alias for clear()
+       void reset() {
+               clear();
+       }
 
        /// advance referenced characters.
        void advance(float delta_time);

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -b -r1.165 -r1.166
--- server/sprite_instance.cpp  16 Feb 2007 11:30:34 -0000      1.165
+++ server/sprite_instance.cpp  16 Feb 2007 12:27:27 -0000      1.166
@@ -2549,6 +2549,10 @@
        //log_msg("Executing actions in %s timeline", getTargetPath().c_str());
        do_actions();
 
+       // Call UNLOAD event of just removed chars !
+       DisplayList justRemoved = oldDisplayList;
+       justRemoved.clear_except(m_display_list, true);
+
        // Finally, execute actions in newly added childs
        //
        // These are elements in the current DisplayList, cleared

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.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/action_execution_order_test.c       16 Feb 2007 
11:09:41 -0000      1.6
+++ testsuite/misc-ming.all/action_execution_order_test.c       16 Feb 2007 
12:27:27 -0000      1.7
@@ -70,6 +70,11 @@
   mc_blu = newSWFMovieClip();
   sh_blu = make_fill_square (20, 320, 20, 20, 0, 0, 255, 0, 0, 255);
   SWFMovieClip_add(mc_blu, (SWFBlock)sh_blu);  
+  add_clip_actions(mc_blu, " onUnload = function () { "
+                 "_root.note('onUnload of mc_blu'); "
+                 "_root.mc_unload_executed = 1; "
+                 "_root.x3 = 'as_in_mc_blu_unload'; "
+                 "};");
   add_clip_actions(mc_blu, " _root.note('as in frame1 of mc_blu'); _root.x1 = 
\"as_in_mc_blu\"; ");
   SWFMovieClip_nextFrame(mc_blu); /* 1st frame */
   add_clip_actions(mc_blu, " _root.note('as in frame2 of mc_blu'); _root.x2 = 
\"as_in_mc_blu\"; stop(); ");
@@ -85,7 +90,8 @@
   add_clip_actions(mc_red, " _root.note('as in frame1 of mc_red'); _root.x1 = 
\"as_in_mc_red\"; ");
   add_clip_actions(mc_red, " func = function() {}; ");
   SWFMovieClip_nextFrame(mc_red); /* 1st frame */
-  add_clip_actions(mc_red, " _root.note('as in frame2 of mc_red'); _root.x2 = 
\"as_in_mc_red\"; stop(); ");
+  add_clip_actions(mc_red, " _root.note('as in frame2 of mc_red'); _root.x2 = 
'as_in_mc_red'; _root.x3 = 'as_in_mc_red_frame2'; stop(); ");
+  SWFDisplayItem_remove(it_blu);
   SWFMovieClip_nextFrame(mc_red); /* 2nd frame */
   
   /* Add mc_red to _root and name it as "mc_red" */
@@ -110,6 +116,8 @@
   check_equals(mo, "_root.x1", "'as_in_mc_blu'");
   /* In subsequent frames, actions in mc_red is executed *before* actions in 
_root */
   check_equals(mo, "_root.x2", "'as_in_root'");
+  check_equals(mo, "_root.x3", "'as_in_mc_blu_unload'");
+  check_equals(mo, "_root.mc_unload_executed", "1");
   add_actions(mo, " _root.totals(); stop(); ");
   SWFMovie_nextFrame(mo); /* 3rd frame */
 




reply via email to

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