gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/server character.cpp character.h sprite_i...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash/server character.cpp character.h sprite_i...
Date: Tue, 13 Feb 2007 14:21:01 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   07/02/13 14:21:01

Modified files:
        server         : character.cpp character.h sprite_instance.cpp 

Log message:
        distinguish between own and child's invalidation state to avoid useless 
redrawing (should be a big performance gain in certain cases)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.159&r2=1.160

Patches:
Index: character.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/character.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- character.cpp       8 Feb 2007 13:14:36 -0000       1.18
+++ character.cpp       13 Feb 2007 14:21:01 -0000      1.19
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: character.cpp,v 1.18 2007/02/08 13:14:36 strk Exp $ */
+/* $Id: character.cpp,v 1.19 2007/02/13 14:21:01 udog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -171,7 +171,12 @@
 void
 character::set_invalidated()
 {
-       if ( m_parent ) m_parent->set_invalidated();
+  // Set the invalidated-flag of the parent. Note this does not mean that
+  // the parent must re-draw itself, it just means that one of it's childs
+  // needs to be re-drawn.
+       //if ( m_parent ) m_parent->set_invalidated();  
+       if ( m_parent ) m_parent->set_child_invalidated(); 
+  
   
        // Ok, at this point the instance will change it's
        // visual aspect after the
@@ -189,6 +194,16 @@
 
 }
 
+void
+character::set_child_invalidated()
+{
+  if ( ! m_child_invalidated ) 
+  {
+    m_child_invalidated=true;
+       if ( m_parent ) m_parent->set_child_invalidated();
+  } 
+}
+
 //---------------------------------------------------------------------
 //
 // Shared ActionScript getter-setters

Index: character.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/character.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- character.h 13 Feb 2007 11:01:21 -0000      1.48
+++ character.h 13 Feb 2007 14:21:01 -0000      1.49
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: character.h,v 1.48 2007/02/13 11:01:21 udog Exp $ */
+/* $Id: character.h,v 1.49 2007/02/13 14:21:01 udog Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -104,6 +104,12 @@
        bool m_invalidated;
 
 
+       /// Just like m_invalidated but set when a child is invalidated instead
+  /// of this character instance. m_invalidated and m_child_invalidated
+  /// can be set at the same time. 
+       bool m_child_invalidated;
+
+
        /// \brief
        /// Bounds of this character instance before first invalidation
        /// since last call to clear_invalidated().
@@ -184,6 +190,7 @@
        m_visible(true),
        m_parent(parent),
        m_invalidated(true),
+       m_child_invalidated(true),
        m_old_invalidated_bounds(),
        _scriptTransformed(false),
        _dynamicallyCreated(false)
@@ -534,9 +541,16 @@
        ///
        void set_invalidated();
   
+       /// Called by a child to signalize it has changed visibily. The
+       /// difference to set_invalidated() is that *this* character does
+       /// not need to redraw itself completely. This function will 
+  /// recursively inform all it's parents of the change.
+  void set_child_invalidated();
+  
        /// Clear invalidated flag and reset m_old_invalidated_bounds to null.
        void clear_invalidated() {
                m_invalidated = false;    
+    m_child_invalidated = false;    
                // Is it correct to set old bounds to null ?
                // Why are we doing so ?
                m_old_invalidated_bounds.set_null();

Index: sprite_instance.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -b -r1.159 -r1.160
--- sprite_instance.cpp 12 Feb 2007 19:24:48 -0000      1.159
+++ sprite_instance.cpp 13 Feb 2007 14:21:01 -0000      1.160
@@ -3278,7 +3278,7 @@
 
        // nothing to do if this sprite's bounds are
        // not invalidated (unless *forced*)
-       if ( ! m_invalidated && ! force )
+       if ( ! m_invalidated && ! m_child_invalidated && ! force )
        {
 #ifdef DEBUG_INVALIDATED_BOUNDS
                log_msg("Not invalidated and not forced, bounds untouched");




reply via email to

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