gnash-commit
[Top][All Lists]
Advanced

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

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


From: zou lunkai
Subject: Re: [Gnash-commit] gnash ChangeLog server/character.h server/dlist...
Date: Sat, 12 May 2007 14:00:30 +0800

comments in  sprite_instance::restoreDisplayList(size_t tgtFrame) is cheating:)

+    // 1. Remove from current DisplayList any timeline instance constructed
+     //    after target frame and still found at the same depth it had at
+     //    time of placement.

you removed more than that!  See
"http://www.gnashdev.org/wiki/index.php/TimelineControl#Implementation_details_2";
I guess the comments should be "Find the instances currently in
DisplayList that need to be removed ", which is more correct, although
abstract.

Great and wonderful implementation, I love that.

On 5/12/07, Sandro Santilli <address@hidden> wrote:
CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/11 17:53:30

Modified files:
       .              : ChangeLog
       server         : character.h dlist.cpp dlist.h
                        sprite_instance.cpp sprite_instance.h
       testsuite      : MovieTester.cpp
       testsuite/misc-ming.all: displaylist_depths_test4.c
                                displaylist_depths_test5.c
                                displaylist_depths_test6.c
                                displaylist_depths_test7.c
                                displaylist_depths_test8.c

Log message:
               * server/dlist.{cpp,h}: Add another DisplayList mass-removal
                 function taking a vector of gnash::characters to remove.
               * server/character.h: Add support for attaching TimelineInfo
                 records to (timeline) instances.
               * server/sprite_instance.cpp:
                 (add_display_object, replace_display_object):
                 add TimelineInfo record to placed timeline instance.
                 (restoreDisplayList): implemented DisplayList reconstruction
                 algorithm as defined on the "Timeline control" wiki page.
                 (goto_frame): use restoreDisplayList when jumping-back, 
properly
                 set m_current_frame when jumping-forward, for proper 
TimelineInfo
                 construction.
               * testsuite/misc-ming.all/: displaylist_depths_test4.c,
                 displaylist_depths_test5.c, displaylist_depths_test6.c,
                 displaylist_depths_test7.c, displaylist_depths_test8.c:
                 Most new Timeline-focused testcases pass now.
                 PLEASE HELP MAKING MORE !!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3168&r2=1.3169
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.269&r2=1.270
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.108&r2=1.109
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test4.c?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test5.c?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test6.c?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test7.c?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test8.c?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3168
retrieving revision 1.3169
diff -u -b -r1.3168 -r1.3169
--- ChangeLog   11 May 2007 14:20:00 -0000      1.3168
+++ ChangeLog   11 May 2007 17:53:29 -0000      1.3169
@@ -1,3 +1,23 @@
+2007-05-11 Sandro Santilli <address@hidden>
+
+       * server/dlist.{cpp,h}: Add another DisplayList mass-removal
+         function taking a vector of gnash::characters to remove.
+       * server/character.h: Add support for attaching TimelineInfo
+         records to (timeline) instances.
+       * server/sprite_instance.cpp:
+         (add_display_object, replace_display_object):
+         add TimelineInfo record to placed timeline instance.
+         (restoreDisplayList): implemented DisplayList reconstruction
+         algorithm as defined on the "Timeline control" wiki page.
+         (goto_frame): use restoreDisplayList when jumping-back, properly
+         set m_current_frame when jumping-forward, for proper TimelineInfo
+         construction.
+       * testsuite/misc-ming.all/: displaylist_depths_test4.c,
+         displaylist_depths_test5.c, displaylist_depths_test6.c,
+         displaylist_depths_test7.c, displaylist_depths_test8.c:
+         Most new Timeline-focused testcases pass now.
+         PLEASE HELP MAKING MORE !!
+
 2007-05-11  Rob Savoye  <address@hidden>

       * macros/curl.m4, sdl.m4: Drop extraneous results.

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- server/character.h  26 Apr 2007 10:56:50 -0000      1.73
+++ server/character.h  11 May 2007 17:53:29 -0000      1.74
@@ -18,7 +18,7 @@
 //
 //

-/* $Id: character.h,v 1.73 2007/04/26 10:56:50 zoulunkai Exp $ */
+/* $Id: character.h,v 1.74 2007/05/11 17:53:29 strk Exp $ */

 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -55,6 +55,46 @@

 namespace gnash {

+/// Informations about timeline instances creation
+//
+/// See: 
http://www.gnashdev.org/wiki/index.php/TimelineControl#Timeline_instances
+///
+class TimelineInfo
+{
+
+public:
+
+       /// Construct a TimelineInfo
+       //
+       /// @param depth
+       ///     Depth at which the instance was placed
+       ///
+       /// @param frame
+       ///     Frame number in which the instance was placed (0-based)
+       ///
+       TimelineInfo(int depth, int frame)
+               :
+               _depth(depth),
+               _frame(frame)
+       {
+       }
+
+
+       /// Return depth of initial placement
+       int placedAtDepth() const { return _depth; }
+
+       /// Return frame number of initial placement (0-based)
+       size_t placedInFrame() const { return _frame; }
+
+private:
+
+       /// Original depth
+       int _depth;
+
+       /// Frame of placement, 0-based
+       size_t _frame;
+};
+
 /// Character is a live, stateful instance of a character_def.
 //
 /// It represents a single active element in a movie.
@@ -91,6 +131,12 @@
       /// Build the _target member recursive on parent
       std::string computeTargetPath() const;

+       /// Timeline info, for timeline instances
+       //
+       /// For dynamically-created instances this is always NULL
+       ///
+       std::auto_ptr<TimelineInfo> _timelineInfo;
+
 protected:

       const Events& get_event_handlers() const
@@ -620,6 +666,8 @@
       /// "Dynamically created" means created trough ActionScript
       ///
       bool isDynamic() const {
+               // TODO: return _timelineInfo.get() == NULL
+               assert(_timelineInfo.get() ? !_dynamicallyCreated : 
_dynamicallyCreated);
               return _dynamicallyCreated;
       }

@@ -627,7 +675,11 @@
       //
       /// "Dynamically created" means created trough ActionScript
       ///
+       /// TODO: deprecate this function, all characters should be
+       ///       dynamic by default Unless setTimelineInfo is called.
+       ///
       void setDynamic() {
+               assert(_timelineInfo.get() == NULL);
               _dynamicallyCreated = true;
               //assert(get_depth() > 0);
       }
@@ -835,7 +887,7 @@

       bool isUnloaded() { return _unloaded; }

-public:
+public: // istn't this 'public' reduntant ?

       /// Return full path to this object, in slash notation
       //
@@ -849,6 +901,40 @@
       ///
       std::string getTarget() const;

+       /// Set timeline information for this instance
+       //
+       /// Timeline info should be set only once, right after creation
+       /// of a timeline instance. If this function is called twice
+       /// Gnash will abort.
+       /// Once timeline informations are added to a character, the
+       /// character become a "timeline instance". If not timeline info
+       /// is available, this is a dynamically-created character.
+       /// See isDynamic();
+       ///
+       /// @param depth
+       ///     Depth of first placement.
+       ///
+       /// @param frame
+       ///     Frame of first placement. 0-based.
+       ///
+       /// NOTE: if we want to compute TimelineInfo records once at
+       ///       parse time and reuse pointers we'll just need to take
+       ///       a TimelineInfo pointer as parameter, externally owned.
+       ///       For now, we'll use a new object for each instance.
+       ///
+       void setTimelineInfo(int depth, int frame)
+       {
+               assert(_timelineInfo.get()==NULL); // don't call twice !
+               _timelineInfo.reset(new TimelineInfo(depth, frame));
+       }
+
+       /// Return timeline information, if this is a timeline instance
+       //
+       /// For dynamic instances, NULL is returned.
+       /// Ownership of the returned object belong to this character.
+       ///
+       TimelineInfo* getTimelineInfo() { return _timelineInfo.get(); }
+
  // override from as_object
       virtual std::string get_text_value() const;


Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- server/dlist.cpp    11 May 2007 07:35:11 -0000      1.62
+++ server/dlist.cpp    11 May 2007 17:53:29 -0000      1.63
@@ -302,7 +302,7 @@
               // replace existing char
               *it = di;

-               // Shouldn't we construct the new object here too ?
+               // TODO: check: Shouldn't we construct the new object here too ?
               //ch->construct();
       }

@@ -575,6 +575,35 @@
 }

 void
+DisplayList::clear(std::vector<character*>& which, bool call_unload)
+{
+       //GNASH_REPORT_FUNCTION;
+
+       for (iterator it = _characters.begin(), itEnd = _characters.end(); it 
!= itEnd; )
+       {
+               DisplayItem& di = *it;
+
+               bool is_affected = false;
+               for (size_t i=0, n=which.size(); i<n; ++i)
+               {
+                       if (which[i] == di.get())
+                       {
+                               is_affected = true;
+                               break;
+                       }
+               }
+
+               if (is_affected)
+               {
+                       if ( call_unload ) di->unload();
+                       it = _characters.erase(it);
+                       continue;
+               }
+               it++;
+       }
+}
+
+void
 DisplayList::clear(const DisplayList& from, bool call_unload)
 {
       //GNASH_REPORT_FUNCTION;

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/dlist.h      11 May 2007 13:39:45 -0000      1.38
+++ server/dlist.h      11 May 2007 17:53:29 -0000      1.39
@@ -184,6 +184,20 @@
       void clear(const DisplayList& from, bool call_unload=false);

       /// \brief
+       /// Clear all characters in the display list also found in the given 
vector.
+       //
+       /// @param which
+       ///     A vector containing character instances to remove.
+       ///     Any instance found in the vector will be removed
+       ///     from this DisplayList.
+       ///
+       /// @param call_unload
+       ///     If true, UNLOAD event will be invoked on the characters being
+       ///     removed. False by default.
+       ///
+       void clear(std::vector<character*>& which, bool call_unload=false);
+
+       /// \brief
       /// Clear all characters in the display list except the ones
       /// contained in the given vector.
       //

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.269
retrieving revision 1.270
diff -u -b -r1.269 -r1.270
--- server/sprite_instance.cpp  11 May 2007 07:35:11 -0000      1.269
+++ server/sprite_instance.cpp  11 May 2007 17:53:29 -0000      1.270
@@ -62,6 +62,10 @@
 namespace gnash {

 //#define GNASH_DEBUG 1
+//#define GNASH_DEBUG_TIMELINE 1
+#define NEW_TIMELINE_DESIGN 1
+
+

 // Forward declarations
 static as_object* getMovieClipInterface();
@@ -1692,6 +1696,109 @@
       }
 };

+/// A DisplayList visitor used to extract timeline instances that
+/// should be removed when rewinding playhead to a given frame
+///
+///
+/// See http://www.gnashdev.org/wiki/index.php/TimelineControl for
+/// more informations.
+///
+class TimelineInstanceFinder {
+
+       std::vector<character*> _toRemove;
+
+       // target frame, 0-based
+       size_t _frame;
+
+public:
+
+       /// @param tgtFrame
+       ///     The frame to which we're rewinding. 0-based.
+       ///
+       TimelineInstanceFinder(size_t tgtFrame)
+               :
+               _frame(tgtFrame)
+       {
+       }
+
+       /// Return a vector of characters to remove
+       std::vector<character*>& toRemove() { return _toRemove; }
+
+       bool operator() (character* ch)
+       {
+               int depth = ch->get_depth();
+
+               // Timeline instances are always initially placed
+               // at negative depths and we don't want to remove those
+               // moved to different depths, so when depth 0 is
+               // reached our scan is complete.
+               if ( depth >= 0 )
+               {
+#ifdef GNASH_DEBUG_TIMELINE
+                       cout << this << "] Char at depth " << depth << " reached, end 
scan" << endl;
+#endif
+                       return false;
+               }
+
+               TimelineInfo* info = ch->getTimelineInfo();
+               if ( ! info )
+               {
+#ifdef GNASH_DEBUG_TIMELINE
+                       cout << this << "] Char at depth " << depth
+                               << " is not a timeline, will remove" << endl;
+#endif
+                       // non-timeline instances in static depth zone
+                       // needs to be removed
+                       _toRemove.push_back(ch);
+               }
+               else
+               {
+#ifdef GNASH_DEBUG_TIMELINE
+                       cout << this << "] Char at depth " << depth
+                               << " is a timeline instance, placed originally in 
frame "
+                               << info->placedInFrame() << " at depth "
+                               << info->placedAtDepth() << endl;
+#endif
+
+                       // timeline instances created after the target frame
+                       // are always removed (those in the 'dynamic depth zone'
+                       // won't get to this point)
+                       if ( info->placedInFrame() > _frame )
+                       {
+#ifdef GNASH_DEBUG_TIMELINE
+                               cout << this << "] will remove "
+                                       << "(placed after target frame "
+                                       << _frame << ")" << endl;
+#endif
+                               _toRemove.push_back(ch);
+                       }
+
+                       // timeline instances created before or at the target 
frame
+                       // are only removed if they are no more at the original 
depth
+                       else if ( info->placedAtDepth() != depth )
+                       {
+#ifdef GNASH_DEBUG_TIMELINE
+                               cout << this << "] will remove "
+                                       << "(originally at a different depth)"
+                                       << endl;
+#endif
+                               _toRemove.push_back(ch);
+                       }
+
+#ifdef GNASH_DEBUG_TIMELINE
+                       else
+                       {
+                               cout << this << "] will keep "
+                                       << "(none of the above applied)"
+                                       << endl;
+                       }
+#endif
+               }
+
+               return true;
+       }
+};
+
 /// A DisplayList visitor used to extract all characters
 //
 /// Script characters are characters created or transformed
@@ -2338,6 +2445,7 @@
               // First time execute_frame_tags(0) executed in dlist.cpp(child) 
or movie_def_impl(root)
               if (m_current_frame != (size_t)prev_frame)
               {
+                       // TODO: Make sure m_current_frame is 0-based during 
execution of DLIST tags
                       execute_frame_tags(m_current_frame, 
TAG_DLIST|TAG_ACTION);
               }
       }
@@ -2484,6 +2592,69 @@
       };
 }

+/*private*/
+void
+sprite_instance::restoreDisplayList(size_t tgtFrame)
+{
+       // This is not tested as usable for jump-forwards (yet)...
+       // TODO: I guess just moving here the code currently in goto_frame
+       //       for jump-forwards would do
+       assert(tgtFrame <= m_current_frame);
+
+       // 1. Remove from current DisplayList any timeline instance constructed
+       //    after target frame and still found at the same depth it had at
+       //    time of placement.
+
+       TimelineInstanceFinder finder(tgtFrame);
+#ifdef GNASH_DEBUG_TIMELINE
+       cout << "TimelineInstanceFinder " << &finder << " created for target frame " << tgtFrame << 
" from frame " << m_current_frame << endl;
+#endif
+       const_cast<DisplayList&>(m_display_list).visitForward(finder);
+       std::vector<character*>& toRemove = finder.toRemove();
+
+#ifdef GNASH_DEBUG_TIMELINE
+       cout << toRemove.size() << " chars found to remove." << endl;
+#endif
+       if ( ! toRemove.empty() )
+       {
+#ifdef GNASH_DEBUG_TIMELINE
+               cout << "Found to remove: " << endl;
+               std::ostream_iterator<as_value> ostrIter(cout, "," ) ;
+               std::copy(toRemove.begin(), toRemove.end(), ostrIter);
+               cout << "Current DisplayList: " << m_display_list << endl;
+#endif
+
+               set_invalidated();
+               m_display_list.clear(toRemove, true); // call onUnload
+
+#ifdef GNASH_DEBUG_TIMELINE
+               cout << "DisplayList after removal: " << m_display_list << endl;
+#endif
+       }
+
+       // 2. Execute all displaylist tags from first to target frame
+
+       // we're going to change this during frame tags execution
+       //size_t currentFrameBackup = m_current_frame;
+
+       for (size_t f = 0; f<=tgtFrame; ++f)
+       {
+               //
+               // Set m_current_frame so it is correct (0-based) during
+               // execute_frame_tags and thus timeline objects placement
+               // (need to correctly set TimelineInfo record).
+               //
+               m_current_frame = f;
+               execute_frame_tags(f, TAG_DLIST);
+       }
+
+       // Set current frame back to the backed-up value
+       // TODO: this is likely NOT needed, just documenting that we're going
+       //       to modify m_current_frame could be enough (would be the 
caller's
+       //       responsibility to do what they think is needed).
+       //m_current_frame = currentFrameBackup;
+}
+
 // 0-based frame number !
 void
 sprite_instance::execute_frame_tags(size_t frame, int typeflags)
@@ -2619,13 +2790,19 @@
 void
 sprite_instance::goto_frame(size_t target_frame_number)
 {
-#ifdef DEBUG_GOTOFRAME
+#if defined(DEBUG_GOTOFRAME) || defined(GNASH_DEBUG_TIMELINE)
       log_msg(_("sprite %s ::goto_frame(" SIZET_FMT ") - current frame is "
               SIZET_FMT),
               getTargetPath().c_str(), target_frame_number, m_current_frame);
 #endif

-       assert(! isUnloaded() );
+       // TODO: the assertion fails against all.swf with NEW_TIMELINE_DESIGN
+       //       (swf from http://www.ferryhalim.com/orisinal/)
+       //assert(! isUnloaded() );
+       if ( isUnloaded() )
+       {
+               log_error("Sprite %s unloaded on gotoFrame call... let Gnash 
developers know please", getTarget().c_str());
+       }

       // goto_frame stops by default.
       // ActionGotoFrame tells the movieClip to go to the target frame
@@ -2687,16 +2864,22 @@
  // redraw of the whole sprite even if it doesn't change visually
  // at all.

-       set_invalidated();
-
       if (target_frame_number < m_current_frame)
       // Go backward to a previous frame
       {
+#ifdef NEW_TIMELINE_DESIGN // new design
+               // restoreDisplayList takes care of properly setting the 
m_current_frame variable
+               restoreDisplayList(target_frame_number);
+               assert(m_current_frame == target_frame_number);
+#else // old design
+               set_invalidated();
+
               resetDisplayList();
               for (size_t f = 0; f<=target_frame_number; f++)
               {
                       execute_frame_tags(f, TAG_DLIST);
               }
+#endif
       }
       else
       // Go forward to a later frame
@@ -2705,6 +2888,25 @@
               assert(target_frame_number > m_current_frame);

               // Construct the DisplayList of the target frame
+#ifdef NEW_TIMELINE_DESIGN
+               while (m_current_frame++ < target_frame_number)
+               {
+#ifdef GNASH_DEBUG_TIMELINE
+                       cout << "Executing tags in frame " << m_current_frame 
<< endl;
+#endif
+                       // 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);
+               }
+               --m_current_frame; // as we might h
+               assert(m_current_frame == target_frame_number);
+#ifdef GNASH_DEBUG_TIMELINE
+               cout << "At end of loop, m_current_frame is " << m_current_frame 
<< endl;
+#endif
+
+#else // ! defined (NEW_TIMELINE_DESIGN)
+
               for (size_t f = m_current_frame+1; f<=target_frame_number; ++f)
               {
                       // Second argument requests that only "DisplayList" tags
@@ -2712,9 +2914,14 @@
                       // pushed on m_action_list.
                       execute_frame_tags(f, TAG_DLIST);
               }
+#endif

       }

+#if defined(GNASH_DEBUG_TIMELINE)
+       cout << "At end of DisplayList reconstruction, m_current_frame is " << 
m_current_frame << endl;
+#endif
+
       /// Backup current action list, as we're going to use it
       /// to fetch actions in the target frame
       ActionList actionListBackup = m_action_list;
@@ -2727,10 +2934,14 @@
       // do this, so use execute_frame_tags instead).
       execute_frame_tags(target_frame_number, TAG_ACTION);

+#ifndef NEW_TIMELINE_DESIGN
       //FIXME: set m_current_frame to the target frame;
       //  I think it's too early to do it here! Later actions in the
       //  current frame should also be executed(Zou)
       m_current_frame = target_frame_number;
+#else
+       assert(m_current_frame == target_frame_number);
+#endif


       // After entering to advance_sprite() m_current_frame points to frame
@@ -2856,6 +3067,9 @@

               // If we already have this object on this
               // plane, then move it instead of replacing it.
+               // NOTE: move_display_object() will take care of NOT moving the
+               //       character if get_accept_anim_moves() returns false.
+               //       ... I guess it's checked inside move_display_object ...
               if ( existing_char->get_id() == character_id )
               {
                       // TODO: update name ?
@@ -2877,6 +3091,14 @@
       boost::intrusive_ptr<character> ch = 
cdef->create_character_instance(this, character_id);
       assert(ch.get() != NULL);

+       // Make a timeline instance, passing it lifetime information
+       // We're assuming m_current_frame is 0-based, and correct at time of 
tags execution
+       // TODO: make sure this is true when executing tags from goto_frame !
+#ifdef GNASH_DEBUG_TIMELINE
+       cout << " Placing timeline char " << character_id << " at depth " << depth << " in frame " << 
m_current_frame << " of sprite " << getTarget() << endl;
+#endif
+       ch->setTimelineInfo(depth, m_current_frame);
+
       if ( name )
       {
               ch->set_name(name);
@@ -2938,6 +3160,14 @@
       boost::intrusive_ptr<character> ch = 
cdef->create_character_instance(this,
                       character_id);

+       // Make a timeline instance, passing it lifetime information
+       // We're assuming m_current_frame is 0-based, and correct at time of 
tags execution
+       // TODO: make sure this is true when executing tags from goto_frame !
+#ifdef GNASH_DEBUG_TIMELINE
+       cout << " Replacing timeline char at depth " << depth << " in frame " << m_current_frame << " of sprite " 
<< getTarget() << " with char " << character_id << endl;
+#endif
+       ch->setTimelineInfo(depth, m_current_frame);
+
       replace_display_object(
               ch.get(), name, depth,
               use_cxform, color_transform,
@@ -3392,6 +3622,7 @@
       assert( oldDisplayList.empty() );

       on_event(event_id::CONSTRUCT);
+
       execute_frame_tags(0, TAG_DLIST|TAG_ACTION);

       if ( _name.empty() )

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -b -r1.108 -r1.109
--- server/sprite_instance.h    11 May 2007 07:02:01 -0000      1.108
+++ server/sprite_instance.h    11 May 2007 17:53:29 -0000      1.109
@@ -149,6 +149,7 @@
       // See dox in character.h
       bool pointInVisibleShape(float x, float y) const;

+       /// Return 0-based index to current frame
       size_t get_current_frame() const
       {
               return m_current_frame;
@@ -441,8 +442,7 @@
       /// See character::unload for more info
       void unload();

-       /// Updates the transform properties of the object at
-       /// the specified depth.
+       /// See DisplayList::move_display_object, this method is just a proxy 
to that...
       void    move_display_object(
                       int depth,
                       bool use_cxform,
@@ -814,6 +814,33 @@
       ///
       void resetDisplayList();

+       /// Reconstruct the DisplayList for proper loop-back operations
+       //
+       /// This function will:
+       ///
+       /// - Remove from current DisplayList:
+       ///     - Timeline instances constructed after target frame
+       ///     - Timeline instances constructed before or at the target frame 
but no more at the original depth
+       ///     - Dynamic instances found in the static depth zone
+       /// - Execute all displaylist tags from first to target frame, 
incrementing m_current_frame as it goes
+       ///
+       /// See: 
http://www.gnashdev.org/wiki/index.php/TimelineControl#Timeline_instances
+       ///
+       /// @param targetFrame
+       ///     The target frame for which we're willing to restore the static 
DisplayList.
+       ///     0-based.
+       //
+       /// POSTCONDITIONS:
+       ///
+       ///     - m_current_frame == targetFrame
+       ///
+       /// NOTES: resetDisplayList() above should likely just call 
restoreDisplayList(0);
+       ///
+       /// TODO: consider using this same function for jump-forward too,
+       ///       with some modifications...
+       ///
+       void restoreDisplayList(size_t targetFrame);
+
       /// Queue actions in the action list
       //
       /// The list of action will be pushed on the current
@@ -872,7 +899,7 @@

       play_state      m_play_state;

-       // the _currentframe property
+       // 0-based index to current frame
       size_t          m_current_frame;

       // true if this sprite reached the last frame and restarted

Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- testsuite/MovieTester.cpp   9 May 2007 09:54:44 -0000       1.33
+++ testsuite/MovieTester.cpp   11 May 2007 17:53:29 -0000      1.34
@@ -150,7 +150,7 @@

       // Force full redraw by using a WORLD invalidated ranges
       InvalidatedRanges ranges = _invalidatedBounds;
-       if ( _forceRedraw )
+       if ( 1 || _forceRedraw )
       {
               ranges.setWorld(); // set to world if asked a full redraw
               _forceRedraw = false; // reset to no forced redraw

Index: testsuite/misc-ming.all/displaylist_depths_test4.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test4.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/displaylist_depths_test4.c  11 May 2007 03:39:49 
-0000      1.4
+++ testsuite/misc-ming.all/displaylist_depths_test4.c  11 May 2007 17:53:29 
-0000      1.5
@@ -168,7 +168,7 @@
               "gotoAndStop(4);"

               // Static3 refers to same instance
-               "xcheck_equals(static3.myThing, 'guess');" // gnash fails by 
creating a new instance !
+               "check_equals(static3.myThing, 'guess');"
               "check_equals(static3.getDepth(), -16381);"

               // But it has now be reset to position 50,100 as specified
@@ -177,14 +177,14 @@

               // The reference still refers to the same instance
               //  (see http://www.gnashdev.org/wiki/index.php/SoftReferences)
-               "xcheck_equals(dynRef.myThing, 'guess');" // gnash fails by 
creating a new instance!
+               "check_equals(dynRef.myThing, 'guess');"
               "check_equals(dynRef.getDepth(), -16381);"
               "check_equals(typeof(dynRef), 'movieclip');"
               "check_equals(dynRef._x, 50);"
               "check_equals(dynRef, static3);"

               // A single instance is created in total
-               "xcheck_equals(depth3Constructed, 1);"  // gnash fails by 
creating a new instance!
+               "check_equals(depth3Constructed, 1);"

               "totals();"
               );

Index: testsuite/misc-ming.all/displaylist_depths_test5.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test5.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/displaylist_depths_test5.c  11 May 2007 03:50:44 
-0000      1.1
+++ testsuite/misc-ming.all/displaylist_depths_test5.c  11 May 2007 17:53:29 
-0000      1.2
@@ -162,7 +162,7 @@
               "gotoAndStop(2);"

               // Static3 refers to same instance
-               "xcheck_equals(static3.myThing, 'guess');" // gnash fails by 
creating a new instance !
+               "check_equals(static3.myThing, 'guess');"
               "check_equals(static3.getDepth(), -16381);"

               // But it has now be reset to position 10,100 as specified
@@ -175,14 +175,14 @@

               // The reference still refers to the same instance
               //  (see http://www.gnashdev.org/wiki/index.php/SoftReferences)
-               "xcheck_equals(dynRef.myThing, 'guess');" // gnash fails by 
creating a new instance!
+               "check_equals(dynRef.myThing, 'guess');"
               "check_equals(dynRef.getDepth(), -16381);"
               "check_equals(typeof(dynRef), 'movieclip');"
               "check_equals(dynRef._x, 10);"
               "check_equals(dynRef, static3);"

               // A single instance is created in total
-               "xcheck_equals(depth3Constructed, 1);"  // gnash fails by 
creating a new instance!
+               "check_equals(depth3Constructed, 1);"

               "totals();"
               );

Index: testsuite/misc-ming.all/displaylist_depths_test6.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test6.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/misc-ming.all/displaylist_depths_test6.c  11 May 2007 07:02:01 
-0000      1.5
+++ testsuite/misc-ming.all/displaylist_depths_test6.c  11 May 2007 17:53:29 
-0000      1.6
@@ -161,9 +161,9 @@
    " } "

    // Static3 refers to same instance
-    "xcheck_equals(static3.myThing, 'guess');" // gnash fails as it create a 
new instance
+    "check_equals(static3.myThing, 'guess');"
    // immune to MOVE after swap
-    "xcheck_equals(static3._x, 10);"  // gnash created a new instance instead..
+    "check_equals(static3._x, 10);"

    "check_equals(static3.getDepth(), -16381);"
    "totals();"

Index: testsuite/misc-ming.all/displaylist_depths_test7.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test7.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/displaylist_depths_test7.c  11 May 2007 11:13:31 
-0000      1.3
+++ testsuite/misc-ming.all/displaylist_depths_test7.c  11 May 2007 17:53:29 
-0000      1.4
@@ -157,8 +157,8 @@
    " } "

    // Static3 refers to same instance
-    "xcheck_equals(static3.myThing, 'guess');" // gnash fails as it create a 
new instance
-    "xcheck_equals(static3._x, 200);" // gnash fails as it create a new 
instance (at 50,200)
+    "check_equals(static3.myThing, 'guess');"
+    "xcheck_equals(static3._x, 200);" // TODO: check why does gnash fail here

    "check_equals(static3.getDepth(), -16381);"
    "totals();"

Index: testsuite/misc-ming.all/displaylist_depths_test8.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/displaylist_depths_test8.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/displaylist_depths_test8.c  11 May 2007 11:08:55 
-0000      1.1
+++ testsuite/misc-ming.all/displaylist_depths_test8.c  11 May 2007 17:53:29 
-0000      1.2
@@ -132,7 +132,7 @@
    " check_equals(static3._y, 202);"
    " _root.runs=1;"
    "} else {"
-    " xcheck_equals(static3._y, 204);"  // gnash fails as it creates a new 
instance
+    " check_equals(static3._y, 204);"
    " totals();"
    " stop();"
    "}"
@@ -159,11 +159,11 @@
    "   gotoAndPlay(2); " // The movie will be ended in frame 5

    // Static3 refers to same instance
-    "xcheck_equals(static3.myThing, 'guess');" // gnash fails as it create a 
new instance
+    "check_equals(static3.myThing, 'guess');"
    "check_equals(static3._x, 10);" // Probably PlaceObject was a no-op...

    // actions in frame 2 would be executed again, making this a 204, but only 
*after* this action block terminates..
-    "xcheck_equals(static3._y, 202);" // gnash fails as it creates a new 
instance
+    "check_equals(static3._y, 202);"

    "check_equals(static3.getDepth(), -16381);"
    );


_______________________________________________
Gnash-commit mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/gnash-commit





reply via email to

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