gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/swf/DisplayListTag.h ser...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog server/swf/DisplayListTag.h ser...
Date: Mon, 28 Apr 2008 06:44:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/04/28 06:44:52

Modified files:
        .              : ChangeLog 
        server/swf     : DisplayListTag.h PlaceObject2Tag.cpp 
                         PlaceObject2Tag.h RemoveObjectTag.h 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6424&r2=1.6425
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DisplayListTag.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/PlaceObject2Tag.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/RemoveObjectTag.h?cvsroot=gnash&r1=1.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6424
retrieving revision 1.6425
diff -u -b -r1.6424 -r1.6425
--- ChangeLog   27 Apr 2008 22:16:29 -0000      1.6424
+++ ChangeLog   28 Apr 2008 06:44:50 -0000      1.6425
@@ -1,3 +1,12 @@
+2008-04-28 Zou Lunkai <address@hidden>
+       
+       * server/swf/DisplayListTag.h: isRmove(), isPlace(), isReplace(), 
isMove(),
+         drop this four virtual functions, no longer needed.
+       * server/swf/RemoveObjectTag.h: drop isRemove().
+       * server/PlaceObject2Tag.{h, cpp}: keep all swf defined flags, add 
interfaces
+         to extract the information from those flags. Drop some unncessary 
members. The
+         rational is not discarding any definitions.     
+       
 2008-04-28 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.cpp (get_member): our own properties

Index: server/swf/DisplayListTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DisplayListTag.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/swf/DisplayListTag.h 5 Mar 2008 03:56:03 -0000       1.10
+++ server/swf/DisplayListTag.h 28 Apr 2008 06:44:51 -0000      1.11
@@ -61,18 +61,6 @@
                execute(m);
        }
 
-       /// Return true if this tag removes a character
-       virtual bool isRemove() const { return false; }
-
-       /// Return true if this tag places a character
-       virtual bool isPlace() const { return false; }
-
-       /// Return true if this tag replaces a character
-       virtual bool isReplace() const { return false; }
-
-       /// Return true if this tag transforms a character
-       virtual bool isMove() const { return false; }
-
        /// Return the depth affected by this DisplayList tag
        //
        /// NOTE: the returned depth is always in the

Index: server/swf/PlaceObject2Tag.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/swf/PlaceObject2Tag.cpp      23 Apr 2008 07:24:11 -0000      1.39
+++ server/swf/PlaceObject2Tag.cpp      28 Apr 2008 06:44:51 -0000      1.40
@@ -192,50 +192,38 @@
     in.ensureBytes(1 + 2); // PlaceObject2, depth
 
     // PlaceObject2 specific flags
-    boost::uint8_t has_flags2 = in.read_u8();
-
-    bool    has_actions    = has_flags2 & (1 << 7); 
-    bool    has_clip_depth = has_flags2 & (1 << 6); 
-    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);
-    bool    has_char       = has_flags2 & (1 << 1);
-    bool    flag_move      = has_flags2 & (1 << 0); 
+    m_has_flags2 = in.read_u8();
 
     m_depth = in.read_u16()+character::staticDepthOffset;
 
-    if (has_char)
+    if ( hasCharacter( ))
     {
         in.ensureBytes(2);
         m_character_id = in.read_u16();
     }
 
-    if (has_matrix)
+    if ( hasMatrix() )
     {
-        m_has_matrix = true;
         m_matrix.read(in);
     }
 
-    if (has_cxform)
+    if ( hasCxform() )
     {
-        m_has_cxform = true;
         m_color_transform.read_rgba(in);
     }
 
-    if (has_ratio)
+    if ( hasRatio() )
     {
         in.ensureBytes(2);
         m_ratio = in.read_u16();
     }
-    else
+
+    if ( hasName() ) 
     {
-        m_ratio = character::noRatioValue;
+        in.read_string(m_name);
     }
 
-    if (m_has_name) in.read_string(m_name);
-
-    if (has_clip_depth)
+    if ( hasClipDepth() )
     {
         in.ensureBytes(2);
         m_clip_depth = in.read_u16() + character::staticDepthOffset;
@@ -245,48 +233,28 @@
         m_clip_depth = character::noClipDepthValue;
     }
 
-    if (has_actions)
+    if ( hasClipActions() )
     {
         readPlaceActions(in);
     }
 
-    if (has_char == true && flag_move == true)
-    {
-        // Remove whatever's at m_depth, and put m_character there.
-        m_place_type = REPLACE;
-    }
-    else if (has_char == false && flag_move == true)
-    {
-        // Moves the object at m_depth to the new location.
-        m_place_type = MOVE;
-    }
-    else if (has_char == true && flag_move == false)
-    {
-        // Put m_character at m_depth.
-        m_place_type = PLACE;
-    }
-    else if (has_char == false && flag_move == false)
-    {
-        m_place_type = REMOVE;
-    }
-
     IF_VERBOSE_PARSE (
         log_parse(_("  PLACEOBJECT2: depth = %d (%d)"), m_depth, 
m_depth-character::staticDepthOffset);
-        if ( has_char ) log_parse(_("  char id = %d"), m_character_id);
-        if ( has_matrix )
+        if ( hasCharacter() ) log_parse(_("  char id = %d"), m_character_id);
+        if ( hasMatrix() )
         {
             log_parse(_("  mat:"));
             m_matrix.print();
         }
-        if ( has_cxform )
+        if ( hasCxform() )
         {
             log_parse(_("  cxform:"));
             m_color_transform.print();
         }
-        if ( has_ratio ) log_parse(_("  ratio: %d"), m_ratio);
-        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);
+        if ( hasRatio() ) log_parse(_("  ratio: %d"), m_ratio);
+        if ( hasName() ) log_parse(_("  name = %s"), m_name.c_str());
+        if ( hasClipDepth() ) log_parse(_("  clip_depth = %d (%d)"), 
m_clip_depth, m_clip_depth-character::staticDepthOffset);
+        log_parse(_(" m_place_type: %d"), getPlaceType() );
     );
 
     //log_debug("place object at depth %i", m_depth);
@@ -301,25 +269,10 @@
     in.ensureBytes(1 + 1 + 2); // PlaceObject2, PlaceObject3, depth
 
     // PlaceObject2 specific flags
-    boost::uint8_t has_flags2 = in.read_u8();
-
-    bool    has_actions    = has_flags2 & (1 << 7); 
-    bool    has_clip_depth = has_flags2 & (1 << 6); 
-    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);
-    bool    has_char       = has_flags2 & (1 << 1);
-    bool    flag_move      = has_flags2 & (1 << 0); 
+    m_has_flags2 = in.read_u8();
 
     // PlaceObject3 specific flags, first 3 bits are unused
-    boost::uint8_t has_flags3 = in.read_u8();
-
-    bool    hasImage           = has_flags3 & (1 << 4); 
-    bool    hasClassName       = has_flags3 & (1 << 3); 
-    bool    has_bitmap_caching = has_flags3 & (1 << 2); 
-    bool    has_blend_mode     = has_flags3 & (1 << 1); 
-    bool    has_filters        = has_flags3 & (1 << 0);
+    m_has_flags3 = in.read_u8();
 
     boost::uint8_t blend_mode = 0;
     boost::uint8_t bitmask = 0;
@@ -332,7 +285,7 @@
     // TODO: add more info here
     );
 
-    if (has_char)
+    if ( hasCharacter() )
     {
         in.ensureBytes(2);
         m_character_id = in.read_u16();
@@ -341,7 +294,7 @@
         );
     }
 
-    if (hasClassName || (hasImage && has_char) )
+    if ( hasClassName() || ( hasImage() && hasCharacter() ) )
     {
         log_unimpl("PLACEOBJECT3 with associated class name");
         in.read_string(className);
@@ -350,32 +303,28 @@
         );
     }
 
-    if (has_matrix)
+    if ( hasMatrix() )
     {
-        m_has_matrix = true;
         m_matrix.read(in);
-
     }
 
-    if (has_cxform)
+    if ( hasCxform() )
     {
-        m_has_cxform = true;
         m_color_transform.read_rgba(in);
     }
 
-    if (has_ratio) 
+    if ( hasRatio() ) 
     {
         in.ensureBytes(2);
         m_ratio = in.read_u16();
     }
-    else
+    
+    if ( hasName() )
     {
-        m_ratio = character::noRatioValue;
+        in.read_string(m_name);
     }
     
-    if (m_has_name) in.read_string(m_name);
-
-    if (has_clip_depth)
+    if ( hasClipDepth() )
     {
         in.ensureBytes(2);
         m_clip_depth = in.read_u16()+character::staticDepthOffset;
@@ -387,34 +336,34 @@
 
     IF_VERBOSE_PARSE
     (
-        if (has_matrix) {
+        if ( hasMatrix() ) {
             log_parse("   matrix:");
         m_matrix.print();
     }
-        if (has_cxform) {
+        if ( hasCxform() ) {
             log_parse("   cxform:");
             m_color_transform.print();
     }
-        if (has_ratio)  log_parse("   ratio:%d", m_ratio);
-        if (m_has_name) log_parse("   name:%s", m_name.c_str());
+        if ( hasRatio() )  log_parse("   ratio:%d", m_ratio);
+        if ( hasName() ) log_parse("   name:%s", m_name.c_str());
 
-        if (has_clip_depth)
+        if ( hasClipDepth() )
         log_parse("   clip_depth:%d(%d)", m_clip_depth, 
m_clip_depth-character::staticDepthOffset);
     );
 
-    if (has_filters)
+    if ( hasFilters() )
     {
         Filters v; // TODO: Attach the filters to the display object.
         filter_factory::read(in, true, &v);
     }
 
-    if (has_blend_mode)
+    if ( hasBlendMode() )
     {
         in.ensureBytes(1);
         blend_mode = in.read_u8();
     }
 
-    if (has_bitmap_caching)
+    if ( hasBitmapCaching() )
     {
         // It is not certain that this actually exists, so if this reader
         // is broken, it is probably here!
@@ -422,49 +371,29 @@
         bitmask = in.read_u8();
     }
 
-    if (has_actions)
+    if ( hasClipActions() )
     {
         readPlaceActions(in);
     }
 
-    if (has_char == true && flag_move == true)
-    {
-        // Remove whatever's at m_depth, and put m_character there.
-        m_place_type = REPLACE;
-    }
-    else if (has_char == false && flag_move == true)
-    {
-        // Moves the object at m_depth to the new location.
-        m_place_type = MOVE;
-    }
-    else if (has_char == true && flag_move == false)
-    {
-        // Put m_character at m_depth.
-        m_place_type = PLACE;
-    }
-    else if (has_char == false && flag_move == false)
-    {
-         m_place_type = REMOVE;
-    }
-
     IF_VERBOSE_PARSE (
         log_parse(_("  PLACEOBJECT3: depth = %d (%d)"), m_depth, 
m_depth-character::staticDepthOffset);
-        if ( has_char ) log_parse(_("  char id = %d"), m_character_id);
-        if ( has_matrix )
+        if ( hasCharacter() ) log_parse(_("  char id = %d"), m_character_id);
+        if ( hasMatrix() )
         {
             log_parse(_("  mat:"));
             m_matrix.print();
         }
-        if ( has_cxform )
+        if ( hasCxform() )
         {
             log_parse(_("  cxform:"));
             m_color_transform.print();
         }
-        if ( has_ratio ) log_parse(_("  ratio: %d"), m_ratio);
-        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);
+        if ( hasRatio() ) log_parse(_("  ratio: %d"), m_ratio);
+        if ( hasName() ) log_parse(_("  name = %s"), m_name.c_str());
+        if ( hasClassName() ) log_parse(_("  class name = %s"), 
className.c_str());
+        if ( hasClipDepth() ) log_parse(_("  clip_depth = %d (%d)"), 
m_clip_depth, m_clip_depth-character::staticDepthOffset);
+        log_parse(_(" m_place_type: %d"), getPlaceType());
     );
 
     //log_debug("place object at depth %i", m_depth);
@@ -494,7 +423,7 @@
 void
 PlaceObject2Tag::execute(sprite_instance* m) const
 {
-    switch (m_place_type) 
+    switch ( getPlaceType() ) 
     {
       case PLACE:
           m->add_display_object(this);

Index: server/swf/PlaceObject2Tag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/PlaceObject2Tag.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/swf/PlaceObject2Tag.h        24 Apr 2008 15:44:53 -0000      1.24
+++ server/swf/PlaceObject2Tag.h        28 Apr 2008 06:44:51 -0000      1.25
@@ -95,13 +95,12 @@
         :
         DisplayListTag(0), // why is it 0 here and -1 for RemoveObjectTag ??
         m_tag_type(0),
-        m_name(""),
-        m_ratio(0),
-        m_has_matrix(false),
-        m_has_cxform(false),
+        m_has_flags2(0),
+        m_has_flags3(0),
         m_character_id(0),
+        m_ratio(0),
+        m_name(""),
         m_clip_depth(0),
-        m_place_type(PLACE),
         _movie_def(def)
     {
     }
@@ -114,21 +113,9 @@
     /// Place/move/whatever our object in the given movie.
     void execute(sprite_instance* m) const;
 
-    /// Return true if this tag places a character
-    bool isPlace() const { return m_place_type == PLACE; }
-
-    /// Return true if this tag replaces a character
-    bool isReplace() const { return m_place_type == REPLACE; }
-
-    /// Return true if this tag transforms a character
-    bool isMove() const { return m_place_type == MOVE; }
-
-    /// Return true if this tag removes a character.
-    //  This is set by having no char and no place in the place tag.
-    bool isRemove() const { return m_place_type == REMOVE; }
-
     static void loader(stream* in, tag_type tag, movie_definition* m);
 
+    int getPlaceType() const { return m_has_flags2 & (HAS_CHARACTER_MASK | 
MOVE_MASK); } 
     int getRatio()    const { return m_ratio; }
     int getClipDepth() const { return m_clip_depth; }
     int getID() const { return m_character_id; }
@@ -137,31 +124,61 @@
     const cxform& getCxform() const { return m_color_transform; }
     const EventHandlers& getEventHandlers() const { return m_event_handlers; }
     
-    bool hasMatrix() const { return m_has_matrix; }
-    bool hasCxform() const { return m_has_cxform; }
-    bool hasName()   const { return m_has_name; }
+    bool hasClipActions() const { return m_has_flags2 & HAS_CLIP_ACTIONS_MASK; 
}
+    bool hasClipDepth()   const { return m_has_flags2 & HAS_CLIP_DEPTH_MASK; };
+    bool hasName()        const { return m_has_flags2 & HAS_NAME_MASK; }
+    bool hasRatio()       const { return m_has_flags2 & HAS_RATIO_MASK; }
+    bool hasCxform()      const { return m_has_flags2 & HAS_CXFORM_MASK; }
+    bool hasMatrix()      const { return m_has_flags2 & HAS_MATRIX_MASK; }
+    bool hasCharacter()   const { return m_has_flags2 & HAS_CHARACTER_MASK; }
+
+    bool hasImage()         const { return m_has_flags3 & HAS_IMAGE_MASK; }
+    bool hasClassName()     const { return m_has_flags3 & HAS_CLASS_NAME_MASK; 
}
+    bool hasBitmapCaching() const { return m_has_flags3 & 
HAS_BITMAP_CACHING_MASK; }
+    bool hasBlendMode()     const { return m_has_flags3 & HAS_BLEND_MODE_MASK; 
}
+    bool hasFilters()       const { return m_has_flags3 & HAS_FILTERS_MASK; }  
    
 
 private:
-
     int m_tag_type;
-    std::string m_name;
-    int     m_ratio;
+    boost::uint8_t m_has_flags2;
+    boost::uint8_t m_has_flags3;
+    boost::uint16_t m_character_id;
     cxform  m_color_transform;
     matrix  m_matrix;
-    bool    m_has_matrix;
-    bool    m_has_cxform;
-    bool    m_has_name;
-    boost::uint16_t m_character_id;
+    int     m_ratio;
+    std::string m_name;
     int     m_clip_depth;
     boost::uint32_t all_event_flags; 
 
+    /// NOTE: getPlaceType() is dependent on the enum values.
     enum place_type
     {
-        PLACE,
-        MOVE,
-        REPLACE,
-                REMOVE
-    } m_place_type;
+        REMOVE  = 0, 
+        MOVE    = 1,
+        PLACE   = 2,
+        REPLACE = 3
+    };
+
+    enum has_flags2_mask_e
+    {
+        HAS_CLIP_ACTIONS_MASK = 1 << 7,
+        HAS_CLIP_DEPTH_MASK   = 1 << 6,
+        HAS_NAME_MASK         = 1 << 5,
+        HAS_RATIO_MASK        = 1 << 4,
+        HAS_CXFORM_MASK       = 1 << 3,
+        HAS_MATRIX_MASK       = 1 << 2,
+        HAS_CHARACTER_MASK    = 1 << 1,
+        MOVE_MASK             = 1 << 0
+    };
+
+    enum has_flags3_mask_e
+    {
+        HAS_IMAGE_MASK          = 1 << 4,
+        HAS_CLASS_NAME_MASK     = 1 << 3,
+        HAS_BITMAP_CACHING_MASK = 1 << 2,
+        HAS_BLEND_MODE_MASK     = 1 << 1,
+        HAS_FILTERS_MASK        = 1 << 0
+    };
 
     const movie_definition& _movie_def;
 

Index: server/swf/RemoveObjectTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/RemoveObjectTag.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/swf/RemoveObjectTag.h        5 Mar 2008 03:56:03 -0000       1.8
+++ server/swf/RemoveObjectTag.h        28 Apr 2008 06:44:52 -0000      1.9
@@ -60,9 +60,6 @@
        /// Remove object at specified depth from sprite_instance DisplayList.
        void    execute(sprite_instance* m) const;
 
-       // See dox in ControlTag.h
-       bool isRemove() const { return true; }
-
        static void loader(stream* in, tag_type tag, movie_definition* m);
 
 private:




reply via email to

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