gnash-commit
[Top][All Lists]
Advanced

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

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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/character.h server/dlist...
Date: Mon, 29 Oct 2007 16:38:56 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/10/29 16:38:56

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

Log message:
                * server/character.h: add setMask, getMask, isDynamiMask,
                  rename isMask to isMaskLayer, add change isMask to check both
                  dynamic and static masks.
                * server/dlist.cpp: replace isMask with isMaskLayer

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4733&r2=1.4734
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.97&r2=1.98

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4733
retrieving revision 1.4734
diff -u -b -r1.4733 -r1.4734
--- ChangeLog   29 Oct 2007 10:53:12 -0000      1.4733
+++ ChangeLog   29 Oct 2007 16:38:55 -0000      1.4734
@@ -1,5 +1,12 @@
 2007-10-27 Sandro Santilli <address@hidden>
 
+       * server/character.h: add setMask, getMask, isDynamiMask,
+         rename isMask to isMaskLayer, add change isMask to check both
+         dynamic and static masks.
+       * server/dlist.cpp: replace isMask with isMaskLayer
+
+2007-10-27 Sandro Santilli <address@hidden>
+
        * server/as_object.{cpp,h} (findUpdatableProperty): return
          static properties in inheritance chain if found, as correctly
          documented in the header file (need an ABC compiler for real 

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- server/character.h  26 Oct 2007 13:03:56 -0000      1.102
+++ server/character.h  29 Oct 2007 16:38:55 -0000      1.103
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: character.h,v 1.102 2007/10/26 13:03:56 strk Exp $ */
+/* $Id: character.h,v 1.103 2007/10/29 16:38:55 strk Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -97,7 +97,6 @@
        /// Return true if this instance replaced an other one at same depth
        bool placedByReplaceTag() const { return _replace; }
 
-
 private:
 
        /// Original depth
@@ -155,6 +154,9 @@
        ///
        std::auto_ptr<TimelineInfo> _timelineInfo;
 
+       /// The character masking this instance (if any)
+       character* _mask;
+
 protected:
 
 #ifdef GNASH_USE_GC
@@ -376,11 +378,22 @@
         return depthInRemovedZone(get_depth());
     }
     
-    /// This value is used for m_clip_depth when the value has no meaning, ie.
-    /// the character is not a mask. Depths below -16384 are illegal, so this
+    /// This value is used for m_clip_depth when 
+    /// the character is not a layer mask.
+    //
+    /// Depths below -16384 are illegal, so this
     /// value should not collide with real depths.  
+    ///
     static const int noClipDepthValue = -1000000;
        
+    /// This value is used for m_clip_depth when 
+    /// the character is a dynamic mask.
+    //
+    /// Depths below -16384 are illegal, so this
+    /// value should not collide with real depths.  
+    ///
+    static const int dynClipDepthValue = -2000000;
+
        // Maybe it's better to move all these constants to DisplayListTag
        static const int noRatioValue = -1;
 
@@ -396,6 +409,7 @@
        m_display_callback_user_ptr(NULL),
        _unloaded(false),
        _destroyed(false),
+       _mask(0),
        m_visible(true),
        m_parent(parent),
        m_invalidated(true),
@@ -491,19 +505,77 @@
     /// tells us to use the character as a mask for all the objects contained 
     /// in the display list from m_depth to m_clipping_depth inclusive.
     /// 
-    /// The value returned by get_clip_depth() is only valid when isMask()
+    /// The value returned by get_clip_depth() is only valid when isMaskLayer()
     /// returns true!
     ///  
     int get_clip_depth() const { return m_clip_depth; }
 
     /// See get_clip_depth()
-    void set_clip_depth(int d) { m_clip_depth = d; }
+       void set_clip_depth(int d)
+       {
+               m_clip_depth = d;
+               _mask = 0; // in case we're masked by some other char
+       }
     
-    /// Returns true when the character (and it's childs) are used as a mask
-    /// for other characters. isMask() does *not* return true when one of it's
+       /// Returns true when the character (and it's childs) is used as a mask
+       /// for other characters at higher depth (up to get_clip_depth).
+       /// isMaskLayer() does *not* return true when one of it's
     /// parents is a mask and the character itself is not.
     ///   
-    bool isMask() const { return m_clip_depth!=noClipDepthValue; }
+       /// See also isDynamicMask() and isMask()
+       ///   
+       bool isMaskLayer() const
+       {
+               return (m_clip_depth!=noClipDepthValue);
+       }
+
+       /// Returns true when the character (and it's childs) is used as a mask
+       /// for another character.
+       /// isDynamicMask() does *not* return true when one of it's
+       /// parents is a mask and the character itself is not.
+       ///
+       /// NOTE: there's no way to obtain the maskee from a dynamic mask
+       ///
+       /// See also isMaskLeyer() and isMask()
+       ///   
+       bool isDynamicMask() const
+       {
+               return (m_clip_depth==dynClipDepthValue);
+       }
+
+       /// Return the character masked by this instance (if any)
+       character* getMask() const
+       {
+               return _mask;
+       }
+
+       /// Register a character as a mask for this instance.
+       ///
+       /// @param mask The character to use as a mask, possibly NULL.
+       ///
+       void setMask(character* mask)
+       {
+               if ( _mask == mask ) return;
+               if ( _mask )
+               {
+                       // TODO: should we reset any original clip depth
+                       //       specified by PlaceObject tag ?
+                       _mask->set_clip_depth(noClipDepthValue);
+               }
+               _mask = mask;
+               if ( mask )
+               {
+                       /// Mark the mask as a dynamic one
+                       mask->set_clip_depth(dynClipDepthValue); 
+               }
+       }
+
+
+       /// Returns true if this character is a mask (either layer or dynamic 
mask)
+       bool isMask() const
+       {
+               return isDynamicMask() || isMaskLayer();
+       }
 
     virtual void set_name(const char* name) { _name = name; }
 
@@ -593,7 +665,7 @@
        ///
        virtual void has_mouse_event() {}
 
-       // Movie interfaces.  By default do nothing.  sprite_instance and some 
others override these.
+       /// Render this character
        virtual void    display() {}
 
        /// Returns local, untransformed height of this character in TWIPS

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- server/dlist.cpp    24 Oct 2007 12:20:05 -0000      1.97
+++ server/dlist.cpp    29 Oct 2007 16:38:55 -0000      1.98
@@ -756,28 +756,22 @@
     
     // We only advance characters which are out of the "removed" zone (or 
should we check isUnloaded?)
     iterator it = beginNonRemoved(_charsByDepth);
-    //iterator it = _charsByDepth.begin();
     for(iterator endIt = _charsByDepth.end(); it != endIt; ++it)
     {
         character* ch = it->get();
         assert(ch);
 
-  if ( ch->isUnloaded() ) // debugging
-  {
-    log_error("character at depth %d is unloaded", ch->get_depth());
-    abort();
-  }
   assert(! ch->isUnloaded() ); // we don't advance unloaded chars
 
-
         // Check if this charater or any of its parents is a mask.
-        // Characters act as masks should always be rendered to the
+               // Characters acting as masks should always be rendered to the
         // mask buffer despite their visibility.
+               //
         character * parent = ch->get_parent();
-        bool renderAsMask = ch->isMask();
+               bool renderAsMask = ch->isMaskLayer();
         while(!renderAsMask && parent)
         {
-            renderAsMask = parent->isMask();
+                   renderAsMask = parent->isMaskLayer();
             parent = parent->get_parent();
         }
         
@@ -786,7 +780,7 @@
         {
             // Avoid stale old_invalidated_rect
             ch->clear_invalidated(); 
-            // Don't display non-mask hiden characters
+                       // Don't display non-mask hidden characters
             continue;
         }
     
@@ -809,7 +803,7 @@
         ch->display();
         
         // Notify the renderer that mask drawing has finished.
-        if (ch->isMask())
+               if (ch->isMaskLayer())
         {
             render::end_submit_mask();
         }
@@ -964,7 +958,7 @@
     
     
     // Mask "drawing" has finished
-    if (dobj->isMask())
+    if (dobj->isMaskLayer())
     {
       drawing_mask = false; // end_submit_mask equivalent
     }




reply via email to

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