gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
Date: Wed, 23 Apr 2008 07:24:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/04/23 07:24:11

Modified files:
        .              : ChangeLog 
        server         : sprite_instance.cpp sprite_instance.h 
        server/swf     : PlaceObject2Tag.cpp 

Log message:
        * server/swf/PlaceObject2Tag.cpp: execute(), use the DLIST tag directly
         instead of passing every single field.
        * server/sprite_instance.{h,cpp}: add_display_object(), 
move_display_object(),
          replace_display_object(), pass the DLIST tag directly instead of the 
verbose
          interface. still a halfway work.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6352&r2=1.6353
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.510&r2=1.511
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.181&r2=1.182
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.38&r2=1.39

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6352
retrieving revision 1.6353
diff -u -b -r1.6352 -r1.6353
--- ChangeLog   23 Apr 2008 06:02:00 -0000      1.6352
+++ ChangeLog   23 Apr 2008 07:24:07 -0000      1.6353
@@ -5,6 +5,14 @@
 
 2008-04-23 Zou Lunkai <address@hidden>
 
+       * server/swf/PlaceObject2Tag.cpp: execute(), use the DLIST tag directly
+         instead of passing every single field.
+       * server/sprite_instance.{h,cpp}: add_display_object(), 
move_display_object(),
+         replace_display_object(), pass the DLIST tag directly instead of the 
verbose
+         interface. still a halfway work.
+         
+2008-04-23 Zou Lunkai <address@hidden>
+
        * server/swf/PlaceObject2Tag.h: add some member functions
          to access the private data.
          

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.510
retrieving revision 1.511
diff -u -b -r1.510 -r1.511
--- server/sprite_instance.cpp  22 Apr 2008 23:55:00 -0000      1.510
+++ server/sprite_instance.cpp  23 Apr 2008 07:24:10 -0000      1.511
@@ -54,6 +54,7 @@
 #include "DynamicShape.h" // for composition
 #include "namedStrings.h"
 #include "fill_style.h" // for beginGradientFill
+#include "PlaceObject2Tag.h" 
 
 #ifdef USE_SWFTREE
 # include "tree.hh"
@@ -3190,29 +3191,23 @@
 }
 
 character*
-sprite_instance::add_display_object(
-    boost::uint16_t character_id,
-    const std::string* name,
-    const std::vector<swf_event*>& event_handlers,
-    int depth, 
-    const cxform& color_transform, const matrix& mat,
-    int ratio, int clip_depth)
+sprite_instance::add_display_object(const SWF::PlaceObject2Tag* tag)
 {
-//GNASH_REPORT_FUNCTION;
     assert(m_def != NULL);
+    assert(tag != NULL);
 
-    character_def*  cdef = m_def->get_character_def(character_id);
+    character_def*  cdef = m_def->get_character_def(tag->getID());
     if (cdef == NULL)
     {
         IF_VERBOSE_MALFORMED_SWF(
             log_swferror(_("sprite_instance::add_display_object(): "
-                "unknown cid = %d"), character_id);
+                "unknown cid = %d"), tag->getID());
         );
         return NULL;
     }
   
   DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
-    character* existing_char = dlist.get_character_at_depth(depth);
+    character* existing_char = dlist.get_character_at_depth(tag->getDepth());
     
     if(existing_char)
     {
@@ -3220,11 +3215,11 @@
     }
   else
   {
-    boost::intrusive_ptr<character> ch = cdef->create_character_instance(this, 
character_id);
+        boost::intrusive_ptr<character> ch = 
cdef->create_character_instance(this, tag->getID());
     
-    if(name)
+        if(tag->hasName())
         {
-            ch->set_name(*name);
+            ch->set_name(tag->getName());
         }
     else if(ch->wantsInstanceName())
         {
@@ -3233,6 +3228,7 @@
         }
       
     // Attach event handlers (if any).
+        const std::vector<swf_event*>& event_handlers = 
tag->getEventHandlers();
         for (size_t i = 0, n = event_handlers.size(); i < n; i++)
         {
             swf_event* ev = event_handlers[i];
@@ -3241,65 +3237,70 @@
 
     dlist.place_character(
             ch.get(),
-            depth,
-            color_transform,
-            mat,
-            ratio,
-            clip_depth);
+            tag->getDepth(),
+            tag->getCxform(),
+            tag->getMatrix(),
+            tag->getRatio(),
+            tag->getClipDepth());
 
         return ch.get();
   }
 }
 
 void
-sprite_instance::replace_display_object(
-        boost::uint16_t character_id,
-        const std::string* name,
-        int depth,
-        const cxform* color_transform,
-        const matrix* mat,
-        int ratio,
-        int clip_depth)
+sprite_instance::move_display_object(const SWF::PlaceObject2Tag* tag)
+{
+    DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
+    dlist.move_display_object(
+        tag->getDepth(), 
+        tag->hasCxform() ? &tag->getCxform() : NULL,
+        tag->hasMatrix() ? &tag->getMatrix() : NULL,
+        tag->getRatio(), 
+        tag->getClipDepth());
+}
+
+void sprite_instance::replace_display_object(const SWF::PlaceObject2Tag* tag)
 {
     assert(m_def != NULL);
+    assert(tag != NULL);
 
-    character_def*  cdef = m_def->get_character_def(character_id);
+    character_def*  cdef = m_def->get_character_def(tag->getID());
     if (cdef == NULL)
     {
         log_error(_("sprite::replace_display_object(): "
-            "unknown cid = %d"), character_id);
+            "unknown cid = %d"), tag->getID());
         return;
     }
     assert(cdef);
 
     DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
-    character* existing_char = dlist.get_character_at_depth(depth);
+    character* existing_char = dlist.get_character_at_depth(tag->getDepth());
 
     if (existing_char)
     {
         // if the existing character is not a shape, move it instead of replace
         if ( existing_char->isActionScriptReferenceable() )
         {
-            move_display_object(depth, color_transform, mat, ratio, 
clip_depth);
+            move_display_object(tag);
             return;
         }
         else
         {
-            boost::intrusive_ptr<character> ch = 
cdef->create_character_instance(this, character_id);
+            boost::intrusive_ptr<character> ch = 
cdef->create_character_instance(this, tag->getID());
    
             replace_display_object(
                 ch.get(), 
-               name, 
-               depth,
-                color_transform,
-                mat,
-                ratio, 
-        clip_depth);
+                tag->hasName() ? &tag->getName() : NULL,
+                tag->getDepth(),
+                tag->hasCxform() ? &tag->getCxform() : NULL,
+                tag->hasMatrix() ? &tag->getMatrix() : NULL,
+                tag->getRatio(), 
+                tag->getClipDepth());
         }
     }
     else // non-existing character
     {
-    log_error("sprite_instance::replace_display_object: could not find any 
character at depth %d", depth);
+        log_error("sprite_instance::replace_display_object: could not find any 
character at depth %d", tag->getDepth());
     } 
 }
 

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -b -r1.181 -r1.182
--- server/sprite_instance.h    22 Apr 2008 23:55:00 -0000      1.181
+++ server/sprite_instance.h    23 Apr 2008 07:24:10 -0000      1.182
@@ -25,7 +25,6 @@
 #include "gnashconfig.h" // GNASH_USE_GC, USE_SWFTREE
 #endif
 
-//#include "edit_text_character.h" // temp hack
 #include "movie_definition.h" // for inlines
 #include "dlist.h" // DisplayList 
 #include "log.h"
@@ -52,6 +51,9 @@
        class LoadVariablesThread;
        class gradient_record;
        class edit_text_character;
+       namespace SWF{
+               class PlaceObject2Tag;
+       }
 }
 
 namespace gnash
@@ -356,30 +358,30 @@
        /// instance's LOAD event.
        ///
        ///
-       /// @param character_id
+       /// character_id
        ///     The ID of the character to be added.
        ///     It will be seeked in the CharacterDictionary
        ///
-       /// @param name
+       /// name
        ///     The name to give to the newly created instance.
        ///     If NULL, the new instance will be assigned a sequential
        ///     name in the form 'instanceN', where N is incremented
        ///     at each call, starting from 1.
        ///
-       /// @param event_handlers
+       /// event_handlers
        ///
-       /// @param depth
+       /// depth
        ///     The depth to assign to the newly created instance.
        ///
-       /// @param color_transform
+       /// color_transform
        ///     The color transform to apply to the newly created instance.
        ///
-       /// @param matrix
+       /// matrix
        ///     The matrix transform to apply to the newly created instance.
        ///
-       /// @param ratio
+       /// ratio
        ///
-       /// @param clip_depth
+       /// clip_depth
        ///     If != character::noClipDepthValue, mark the created instance
        ///     as a clipping layer. The shape of the placed character will be
        ///     used as a mask for all higher depths up to this value.
@@ -390,16 +392,55 @@
        ///     if this call results in a move of an existing character 
        ///     or in a no-op due to is_jumping_back being false. 
        ///       
-       character* add_display_object(
-               boost::uint16_t character_id,
+       character* add_display_object(const SWF::PlaceObject2Tag* tag);
+       
+       /// See DisplayList::move_display_object, this method is just a proxy 
to that...
+       //
+       void move_display_object(const SWF::PlaceObject2Tag* tag);
+
+       void replace_display_object(const SWF::PlaceObject2Tag* tag);
+
+       ///
+       /// @param color_xform
+       ///     The color tranform to assign to the new character.
+       ///     If NULL the default color transform will be kept.
+       ///
+       /// @param ch
+       ///     The character instance that should replace the old one.
+       ///
+       /// @param name
+       ///     The name to give to the new character (ch).
+       ///     If NULL, the new instance will be assigned a sequential
+       ///     name in the form 'instanceN', where N is incremented
+       ///     at each call, starting from 1.
+       ///
+       /// @param mat
+       ///     The matrix tranform to assign to the new character.
+       ///     If NULL the default matrix will be kept.
+       ///
+       void    replace_display_object(
+                       character* ch,
                const std::string* name,
-               const SWFEventsVector& event_handlers,
                int depth,
-               const cxform& color_transform,
-               const matrix& matrix,
+                       const cxform* color_xform,
+                       const matrix* mat,
                int ratio,
                int clip_depth);
 
+
+       /// \brief
+       /// Remove the object at the specified depth.
+       //
+       /// NOTE: the id parameter is unused, but currently
+       /// required to avoid break of inheritance from movie.h
+       ///
+       void    remove_display_object(int depth, int /* id */)
+       {
+           set_invalidated();
+               DisplayList& dlist = const_cast<DisplayList &>( 
getDisplayList() );
+           dlist.remove_display_object(depth);
+       }
+
        /// Attach the given character instance to current display list
        //
        /// @param newch
@@ -451,95 +492,6 @@
        ///
        void destroy();
 
-       /// See DisplayList::move_display_object, this method is just a proxy 
to that...
-       //
-       /// @param color_xform
-       ///     The color tranform to assign to the new character.
-       ///     If NULL the default color transform will be kept.
-       ///
-       /// @param mat
-       ///     The matrix tranform to assign to the new character.
-       ///     If NULL the default matrix will be kept.
-       ///
-       void    move_display_object(
-                       int depth,
-                       const cxform* color_xform,
-                       const matrix* mat,
-                       int ratio,
-                       int clip_depth)
-       {
-               DisplayList& dlist = const_cast<DisplayList &>( 
getDisplayList() );
-           dlist.move_display_object(depth, color_xform, mat, ratio, 
clip_depth);
-       }
-
-
-       ///
-       /// @param color_xform
-       ///     The color tranform to assign to the new character.
-       ///     If NULL the default color transform will be kept.
-       ///
-       /// @param name
-       ///     The name to give to the newly created instance.
-       ///     If NULL, the new instance will be assigned a sequential
-       ///     name in the form 'instanceN', where N is incremented
-       ///     at each call, starting from 1.
-       ///
-       /// @param mat
-       ///     The matrix tranform to assign to the new character.
-       ///     If NULL the default matrix will be kept.
-       ///
-       void    replace_display_object(
-                       boost::uint16_t character_id,
-                       const std::string* name,
-                       int depth,
-                       const cxform* color_xform,
-                       const matrix* mat,
-                       int ratio,
-                       int clip_depth);
-
-
-       ///
-       /// @param color_xform
-       ///     The color tranform to assign to the new character.
-       ///     If NULL the default color transform will be kept.
-       ///
-       /// @param ch
-       ///     The character instance that should replace the old one.
-       ///
-       /// @param name
-       ///     The name to give to the new character (ch).
-       ///     If NULL, the new instance will be assigned a sequential
-       ///     name in the form 'instanceN', where N is incremented
-       ///     at each call, starting from 1.
-       ///
-       /// @param mat
-       ///     The matrix tranform to assign to the new character.
-       ///     If NULL the default matrix will be kept.
-       ///
-       void    replace_display_object(
-                       character* ch,
-                       const std::string* name,
-                       int depth,
-                       const cxform* color_xform,
-                       const matrix* mat,
-                       int ratio,
-                       int clip_depth);
-
-
-       /// \brief
-       /// Remove the object at the specified depth.
-       //
-       /// NOTE: the id parameter is unused, but currently
-       /// required to avoid break of inheritance from movie.h
-       ///
-       void    remove_display_object(int depth, int /* id */)
-       {
-           set_invalidated();
-               DisplayList& dlist = const_cast<DisplayList &>( 
getDisplayList() );
-           dlist.remove_display_object(depth);
-       }
-
-
        /// Add the given action buffer to the list of action
        /// buffers to be processed at the end of the next
        /// frame advance.

Index: server/swf/PlaceObject2Tag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/swf/PlaceObject2Tag.cpp      10 Apr 2008 03:52:08 -0000      1.38
+++ server/swf/PlaceObject2Tag.cpp      23 Apr 2008 07:24:11 -0000      1.39
@@ -494,42 +494,23 @@
 void
 PlaceObject2Tag::execute(sprite_instance* m) const
 {
-    switch (m_place_type) {
-
+    switch (m_place_type) 
+    {
       case PLACE:
-          m->add_display_object(
-             m_character_id,
-             m_has_name ? &m_name : NULL,
-             m_event_handlers,
-             m_depth,
-             m_color_transform,
-             m_matrix,
-             m_ratio,
-             m_clip_depth);
+          m->add_display_object(this);
          break;
 
       case MOVE:
-         m->move_display_object(
-             m_depth,
-             m_has_cxform ? &m_color_transform : NULL,
-             m_has_matrix ? &m_matrix : NULL,
-             m_ratio,
-             m_clip_depth);
+          m->move_display_object(this);
          break;
 
       case REPLACE:
-         m->replace_display_object(
-             m_character_id,
-             m_has_name ? &m_name : NULL,
-             m_depth,
-             m_has_cxform ? &m_color_transform : NULL,
-             m_has_matrix ? &m_matrix : NULL,
-             m_ratio,
-             m_clip_depth);
+          m->replace_display_object(this);
          break;
 
       case REMOVE:
           m->remove_display_object(m_depth, 0); // 0 since it is unused.
+      break;
     }
 }
 




reply via email to

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