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: Wed, 23 May 2007 16:30:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/23 16:30:11

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp dlist.h 

Log message:
                * server/dlist.{cpp,h}: Add new reset() method taking
                  enough parameters (I hope) to remove what needs to
                  on jump-back; drop obsoleted clear_unaffected function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3317&r2=1.3318
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.40&r2=1.41

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3317
retrieving revision 1.3318
diff -u -b -r1.3317 -r1.3318
--- ChangeLog   23 May 2007 15:54:30 -0000      1.3317
+++ ChangeLog   23 May 2007 16:30:10 -0000      1.3318
@@ -1,5 +1,8 @@
 2007-05-23 Sandro Santilli <address@hidden>
 
+       * server/dlist.{cpp,h}: Add new reset() method taking
+         enough parameters (I hope) to remove what needs to
+         on jump-back; drop obsoleted clear_unaffected function.
        * testsuite/misc-ming.all/: replace_shapes1test.c,
          replace_sprites1test.c: Fix implementation (don't
          use Ming internal methods); add new tests and comments

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- server/dlist.cpp    22 May 2007 14:23:51 -0000      1.66
+++ server/dlist.cpp    23 May 2007 16:30:10 -0000      1.67
@@ -496,34 +496,87 @@
 
 }
        
-void DisplayList::clear_unaffected(std::vector<int>& affected_depths, bool 
call_unload)
+void DisplayList::reset(movie_definition& movieDef, size_t tgtFrame, bool 
call_unload)
 {
        //GNASH_REPORT_FUNCTION;
 
+       // 1. Find all "timeline depth" for the target frame, querying the
+       //    Timeline object in the sprite/movie definition (see 
implementation details)
+       std::vector<int> save;
+       movieDef.getTimelineDepths(tgtFrame, save);
+
+#define GNASH_DEBUG_TIMELINE 1
+#ifdef GNASH_DEBUG_TIMELINE
+       cout << "Depths found to save: " << endl;
+       std::ostream_iterator<int> ostrIter(cout, "," ) ;
+       std::copy(save.begin(), save.end(), ostrIter);
+       cout << endl;
+       cout << "Current DisplayList: " << *this << endl;
+#endif
+
+
+       typedef std::vector<int>::iterator SeekIter;
+
+       SeekIter startSeek = save.begin();
+        SeekIter endSeek = save.end();
+
        for (iterator it = _characters.begin(), itEnd = _characters.end(); it 
!= itEnd; )
        {
                DisplayItem& di = *it;
 
-               int di_depth = di.get()->get_depth();
-               bool is_affected = false;
+               int di_depth = di->get_depth();
 
-               for (size_t i=0, n=affected_depths.size(); i<n; ++i)
-               {
-                       if (affected_depths[i] != di_depth)
+               /// We won't scan chars in the dynamic depth zone
+               if ( di_depth >= 0 ) return;
+
+               /// Always remove non-timeline instances ?
+               /// Seems so, at least for duplicateMovieClip
+               TimelineInfo* info = di->getTimelineInfo();
+               //if ( di->getTimelineInfo() == NULL )
+               //if ( di->isDynamic() )
+               if ( ! info )
                        {
+                       // Not to be saved, killing
+                       if ( call_unload ) di->unload();
+                       it = _characters.erase(it);
                                continue;
                        }
-                       is_affected = true;
-                       break;
+
+#if 0 // let's handle this at PlaceObject2 execution time... an instance 
placed by REPLACE tag
+      // in a subsequent frame will be replaced again rather then left 
untouched.
+      // This is to allow later fixing of REPLACE tag to avoid creation of a 
new instance
+      // (see replace_shapes1test.swf and replace_sprites1test.swf)
+
+               // Remove if placed by REPLACE tag in a later frame
+               if ( info->placedByReplaceTag() && info->placedInFrame() > 
tgtFrame )
+               {
+                       // Not to be saved, killing
+                       // [ replace_sprites1test.swf and 
replace_shapes1test.swf seems to not want the replace ... ]
+                       if ( call_unload ) di->unload();
+                       it = _characters.erase(it);
+                       continue;
                }
+#endif
 
-               if (is_affected == false)
+               /// Only remove if not in the save vector
+               SeekIter match = std::find(startSeek, endSeek, di_depth);
+               if ( match == save.end() )
                {
+                       // Not to be saved, killing
                        if ( call_unload ) di->unload();
                        it = _characters.erase(it);
                        continue;
                }
-               it++;
+
+               // To be saved, don't kill
+
+               // IFF the 'save' vector is known to be sorted
+               // we can let next seek start to next seek item
+               // We can't assume this here, unless we request
+               // by caller, in the dox.
+               //startSeek = ++match;
+
+               ++it;
        }
 }
 

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/dlist.h      18 May 2007 16:33:42 -0000      1.40
+++ server/dlist.h      23 May 2007 16:30:10 -0000      1.41
@@ -250,23 +250,31 @@
        ///
        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.
-       // Deletes the display objects created during execution 
-       // of frames 2,... and not displayed in the 1-st frame.
-       // Macromedia Flash does not call remove display object tag
-       // for 1-st frame
-       //
-       // @deprecated
-       //
-       // TODO: remove this method
+       /// \brief
+       /// Reset the list removing any static character not supposed to be 
there
+       /// in the given target frame.
        //
+       /// Only instances in static depth are candidates for removal, and not 
all
+       /// of them are removed. Dynamic instances in static depth zone are 
always
+       /// removed. Timeline instances are only removed if not supposed to be
+       /// there in the target frame. This information is extracted from the
+       /// Timeline object associated with the given movie_definition 
(movieDef).
+       ///
+       /// This method implements steps 1 and 2 of 3rd redesign attempt for
+       /// display list reconstruction. 
+       /// See: http://www.gnashdev.org/wiki/index.php/TimelineControl
+       ///
+       /// @param movieDef
+       ///     Movie definition from which to extract Timeline information.
+       ///
+       /// @param targetFrame
+       ///     0-based frame number we are jumping back to.
+       ///
        /// @param call_unload
        ///     If true, UNLOAD event will be invoked on the characters being
-       ///     removed. False by default.
+       ///     removed. 
        ///
-       void clear_unaffected(std::vector<int>& affected_depths, bool 
call_unload=false);
+       void reset(movie_definition& movieDef, size_t targetFrame, bool 
call_unload);
 
        /// Just an alias for clear()
        void reset() {




reply via email to

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