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: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
Date: Tue, 12 Feb 2008 20:56:30 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/02/12 20:56:30

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

Log message:
                * server/sprite_instance.{cpp,h}: take a pointer to string in
                  add_display_object and replace_display_object, so that NULL 
gets
                  back to having a meaning.
                * server/swf/PlaceObject2Tag.{cpp,h}: pass NULL to 
add_display_object
                  and replace_display_object if a name wasn't specified by user.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5627&r2=1.5628
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.471&r2=1.472
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.167&r2=1.168
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.h?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5627
retrieving revision 1.5628
diff -u -b -r1.5627 -r1.5628
--- ChangeLog   12 Feb 2008 20:25:54 -0000      1.5627
+++ ChangeLog   12 Feb 2008 20:56:29 -0000      1.5628
@@ -1,5 +1,13 @@
 2008-02-12 Sandro Santilli <address@hidden>
 
+       * server/sprite_instance.{cpp,h}: take a pointer to string in
+         add_display_object and replace_display_object, so that NULL gets
+         back to having a meaning.
+       * server/swf/PlaceObject2Tag.{cpp,h}: pass NULL to add_display_object
+         and replace_display_object if a name wasn't specified by user.
+
+2008-02-12 Sandro Santilli <address@hidden>
+
        * testsuite/gnashrc.in: force sound enabled.
 
 2008-02-12 Benjamin Wolsey <address@hidden>

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.471
retrieving revision 1.472
diff -u -b -r1.471 -r1.472
--- server/sprite_instance.cpp  12 Feb 2008 18:52:32 -0000      1.471
+++ server/sprite_instance.cpp  12 Feb 2008 20:56:29 -0000      1.472
@@ -3060,7 +3060,7 @@
 character*
 sprite_instance::add_display_object(
     boost::uint16_t character_id,
-    const std::string& name,
+    const std::string* name,
     const std::vector<swf_event*>& event_handlers,
     int depth, 
     const cxform& color_transform, const matrix& mat,
@@ -3090,9 +3090,9 @@
   {
     boost::intrusive_ptr<character> ch = cdef->create_character_instance(this, 
character_id);
     
-    if(!name.empty())
+    if(name)
         {
-            ch->set_name(name);
+            ch->set_name(*name);
         }
     else if(ch->wantsInstanceName())
         {
@@ -3122,7 +3122,7 @@
 void
 sprite_instance::replace_display_object(
         boost::uint16_t character_id,
-        const std::string& name,
+        const std::string* name,
         int depth,
         const cxform* color_transform,
         const matrix* mat,
@@ -3173,7 +3173,7 @@
 
 void sprite_instance::replace_display_object(
         character* ch,
-        const std::string& name,
+        const std::string* name,
         int depth,
         const cxform* color_transform,
         const matrix* mat,
@@ -3184,9 +3184,14 @@
 
     assert(ch != NULL);
 
-    if (!name.empty())
+    if (name)
     {
-        ch->set_name(name);
+       ch->set_name(*name);
+    }
+    else if(ch->wantsInstanceName())
+    {
+       std::string instance_name = getNextUnnamedInstanceName();
+       ch->set_name(instance_name);
     }
 
   DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
@@ -4077,7 +4082,7 @@
 
     save_extern_movie(extern_movie.get());
 
-    const char* name = get_name().c_str();
+    const std::string& name = get_name();
     int depth = get_depth();
     bool use_cxform = false;
     cxform color_transform = get_cxform();
@@ -4092,7 +4097,7 @@
     assert(parent_sp);
     parent_sp->replace_display_object(
            extern_movie.get(),
-           name,
+           name.empty() ? NULL : &name, // TODO: check empty != none...
            depth,
            use_cxform ? &color_transform : NULL,
            use_matrix ? &mat : NULL,

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- server/sprite_instance.h    12 Feb 2008 18:52:32 -0000      1.167
+++ server/sprite_instance.h    12 Feb 2008 20:56:29 -0000      1.168
@@ -394,7 +394,7 @@
        ///       
        character* add_display_object(
                boost::uint16_t character_id,
-               const std::string& name,
+               const std::string* name,
                const SWFEventsVector& event_handlers,
                int depth,
                const cxform& color_transform,
@@ -480,13 +480,19 @@
        ///     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,
+                       const std::string* name,
                        int depth,
                        const cxform* color_xform,
                        const matrix* mat,
@@ -498,14 +504,23 @@
        /// @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 std::string* name,
                        int depth,
                        const cxform* color_xform,
                        const matrix* mat,

Index: server/swf/PlaceObject2Tag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/swf/PlaceObject2Tag.cpp      12 Feb 2008 18:52:32 -0000      1.32
+++ server/swf/PlaceObject2Tag.cpp      12 Feb 2008 20:56:30 -0000      1.33
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: PlaceObject2Tag.cpp,v 1.32 2008/02/12 18:52:32 bwy Exp $ */
+/* $Id: PlaceObject2Tag.cpp,v 1.33 2008/02/12 20:56:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -193,7 +193,7 @@
 
     bool    has_actions    = has_flags2 & (1 << 7); 
     bool    has_clip_depth = has_flags2 & (1 << 6); 
-    bool    has_name       = has_flags2 & (1 << 5); 
+    m_has_name       = has_flags2 & (1 << 5); 
     bool    has_ratio      = has_flags2 & (1 << 4); 
     bool    has_cxform     = has_flags2 & (1 << 3); 
     bool    has_matrix     = has_flags2 & (1 << 2);
@@ -221,7 +221,7 @@
     else
         m_ratio = character::noRatioValue;
 
-    if (has_name) in.read_string(m_name);
+    if (m_has_name) in.read_string(m_name);
 
     if (has_clip_depth)
         m_clip_depth = in.read_u16()+character::staticDepthOffset;
@@ -267,7 +267,7 @@
             m_color_transform.print();
         }
         if ( has_ratio ) log_parse(_("  ratio: %d"), m_ratio);
-        if ( has_name ) log_parse(_("  name = %s"), m_name.empty() ? "<null>" 
: m_name.c_str());
+        if ( m_has_name ) log_parse(_("  name = %s"), m_name.c_str());
         if ( has_clip_depth ) log_parse(_("  clip_depth = %d (%d)"), 
m_clip_depth, m_clip_depth-character::staticDepthOffset);
         log_parse(_(" m_place_type: %d"), m_place_type);
     );
@@ -286,7 +286,7 @@
 
     bool    has_actions    = has_flags2 & (1 << 7); 
     bool    has_clip_depth = has_flags2 & (1 << 6); 
-    bool    has_name       = has_flags2 & (1 << 5); 
+    m_has_name       = has_flags2 & (1 << 5); 
     bool    has_ratio      = has_flags2 & (1 << 4); 
     bool    has_cxform     = has_flags2 & (1 << 3); 
     bool    has_matrix     = has_flags2 & (1 << 2);
@@ -336,7 +336,7 @@
     else
         m_ratio = character::noRatioValue;
 
-    if (has_name) in.read_string(m_name);
+    if (m_has_name) in.read_string(m_name);
 
     if (has_clip_depth)
         m_clip_depth = in.read_u16()+character::staticDepthOffset;
@@ -400,7 +400,7 @@
             m_color_transform.print();
         }
         if ( has_ratio ) log_parse(_("  ratio: %d"), m_ratio);
-        if ( has_name ) log_parse(_("  name = %s"), m_name.empty() ? "<null>": 
m_name.c_str());
+        if ( m_has_name ) log_parse(_("  name = %s"), m_name.c_str());
         if ( hasClassName ) log_parse(_("  class name = %s"), 
className.c_str());
         if ( has_clip_depth ) log_parse(_("  clip_depth = %d (%d)"), 
m_clip_depth, m_clip_depth-character::staticDepthOffset);
         log_parse(_(" m_place_type: %d"), m_place_type);
@@ -438,7 +438,7 @@
       case PLACE:
           m->add_display_object(
              m_character_id,
-             m_name.c_str(),
+             m_has_name ? &m_name : NULL,
              m_event_handlers,
              m_depth,
              m_color_transform,
@@ -459,7 +459,7 @@
       case REPLACE:
          m->replace_display_object(
              m_character_id,
-             m_name,
+             m_has_name ? &m_name : NULL,
              m_depth,
              m_has_cxform ? &m_color_transform : NULL,
              m_has_matrix ? &m_matrix : NULL,

Index: server/swf/PlaceObject2Tag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/swf/PlaceObject2Tag.h        12 Feb 2008 16:48:38 -0000      1.18
+++ server/swf/PlaceObject2Tag.h        12 Feb 2008 20:56:30 -0000      1.19
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: PlaceObject2Tag.h,v 1.18 2008/02/12 16:48:38 bwy Exp $ */
+/* $Id: PlaceObject2Tag.h,v 1.19 2008/02/12 20:56:30 strk Exp $ */
 
 #ifndef GNASH_SWF_PLACEOBJECT2TAG_H
 #define GNASH_SWF_PLACEOBJECT2TAG_H
@@ -110,6 +110,7 @@
        matrix  m_matrix;
        bool    m_has_matrix;
        bool    m_has_cxform;
+       bool    m_has_name;
        boost::uint16_t m_character_id;
        int     m_clip_depth;
        boost::uint32_t all_event_flags; 




reply via email to

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