gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h server/bu...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h server/bu...
Date: Wed, 18 Oct 2006 18:16:01 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   06/10/18 18:16:01

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp gui.h 
        server         : button_character_instance.cpp character.h 
                         dlist.cpp edit_text_character.cpp 
                         generic_character.h movie_interface.h 
                         sprite_instance.cpp 

Log message:
        Reviewed invalidated bounds detection method

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1306&r2=1.1307
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/generic_character.h?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_interface.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.66&r2=1.67

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.1306
retrieving revision 1.1307
diff -u -b -r1.1306 -r1.1307
--- ChangeLog   18 Oct 2006 17:35:33 -0000      1.1306
+++ ChangeLog   18 Oct 2006 18:16:00 -0000      1.1307
@@ -1,3 +1,13 @@
+2006-10-18 Udo Giacomozzi <address@hidden>
+
+       * gnash/server/button_character_instance.cpp, 
+       gnash/server/character.h, gnash/server/dlist.cpp,
+       gnash/server/edit_text_character.cpp,
+       gnash/server/generic_character.h,
+       gnash/server/movie_interface.h, 
+       gnash/server/sprite_instance.cpp: Invalidated region 
+       detection reviewed
+
 2006-10-18 Sandro Santilli <address@hidden>
 
        * macros/agg.m4: make sure agg_include_dir is an absolute path.

Index: gui/gui.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- gui/gui.cpp 18 Oct 2006 15:46:59 -0000      1.34
+++ gui/gui.cpp 18 Oct 2006 18:16:01 -0000      1.35
@@ -220,8 +220,7 @@
 bool
 Gui::display(gnash::movie_interface* m)
 {
-       rect changed_bounds;  // new bounds for the current frame
-       rect draw_bounds;     // redraw bounds (union of current and previous 
frame)
+       rect changed_bounds;  // area of the stage that must be updated 
        bool redraw_flag;
 
        // Should the frame be rendered completely, even if it did not change?
@@ -231,29 +230,19 @@
        // have been updated.
        m->get_invalidated_bounds(&changed_bounds, false);
 
-
        if (redraw_flag)
        {
                // TODO: use more meaningful ordinate values ?
-               draw_bounds = rect(-1e10f, -1e10f, +1e10f, +1e10f);
-       }
-       else
-       {
-               // Union it with the previous frame (when a character moved,
-               // we also need to redraw it's previous position).
-               draw_bounds = changed_bounds;
-               draw_bounds.expand_to_rect(_last_invalidated_bounds);
-      
+               changed_bounds = rect(-1e10f, -1e10f, +1e10f, +1e10f);
        }
   
   
        // Avoid drawing of stopped movies
-       if ( ! draw_bounds.is_null() )
+       if ( ! changed_bounds.is_null() )
        {
-  
                // Tell the GUI that we only need to update this region
                // (it may ignore this information)
-               set_invalidated_region(draw_bounds);
+               set_invalidated_region(changed_bounds);
 
                // render the frame      
                m->display();
@@ -262,10 +251,10 @@
                // (Flash debug style)
                IF_DEBUG_REGION_UPDATES (
                        point corners[4];
-                       float xmin = draw_bounds.get_x_min();
-                       float xmax = draw_bounds.get_x_max();
-                       float ymin = draw_bounds.get_y_min();
-                       float ymax = draw_bounds.get_y_max();
+                       float xmin = changed_bounds.get_x_min();
+                       float xmax = changed_bounds.get_x_max();
+                       float ymin = changed_bounds.get_y_min();
+                       float ymax = changed_bounds.get_y_max();
 
                        corners[0].m_x = xmin;
                        corners[0].m_y = ymin;
@@ -284,9 +273,8 @@
                // show frame on screen
                renderBuffer();
        
-       }
+       };
   
-       _last_invalidated_bounds = changed_bounds;
   
        return true;
 }

Index: gui/gui.h
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/gui.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- gui/gui.h   17 Oct 2006 15:32:47 -0000      1.26
+++ gui/gui.h   18 Oct 2006 18:16:01 -0000      1.27
@@ -211,8 +211,6 @@
     unsigned int    _interval;
     /// The handler which is called to update the client area of our window.
     render_handler* _renderer;
-    /// Invalidated bounds of previous frame
-    rect            _last_invalidated_bounds;
 
 private:
 

Index: server/button_character_instance.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/button_character_instance.cpp        17 Oct 2006 10:55:10 -0000      
1.7
+++ server/button_character_instance.cpp        18 Oct 2006 18:16:01 -0000      
1.8
@@ -719,6 +719,8 @@
 {
   if (!m_visible) return; // not visible anyway
 
+  bounds->expand_to_rect(m_old_invalidated_bounds);
+
   // TODO: Instead of using these for loops again and again, wouldn't it be a
   // good idea to have a generic "get_record_character()" method?
        for (unsigned int i = 0; i < m_def->m_button_records.size(); i++)

Index: server/character.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/character.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/character.h  12 Oct 2006 21:47:52 -0000      1.21
+++ server/character.h  18 Oct 2006 18:16:01 -0000      1.22
@@ -36,7 +36,7 @@
 //
 //
 
-/* $Id: character.h,v 1.21 2006/10/12 21:47:52 strk Exp $ */
+/* $Id: character.h,v 1.22 2006/10/18 18:16:01 udog Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -131,14 +131,14 @@
     void       set_matrix(const matrix& m)
        {
            assert(m.is_valid());
-           m_matrix = m;
            set_invalidated();
+           m_matrix = m;
        }
     const cxform&      get_cxform() const { return m_color_transform; }
     void       set_cxform(const cxform& cx) 
     { 
-      m_color_transform = cx;
       set_invalidated(); 
+      m_color_transform = cx;
     }
     void       concatenate_cxform(const cxform& cx) { 
m_color_transform.concatenate(cx); }
     void       concatenate_matrix(const matrix& m) { m_matrix.concatenate(m); }

Index: server/dlist.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- server/dlist.cpp    12 Oct 2006 16:37:25 -0000      1.28
+++ server/dlist.cpp    18 Oct 2006 18:16:01 -0000      1.29
@@ -174,12 +174,12 @@
 
        assert(ch);
        
+       ch->set_invalidated();
        ch->set_depth(depth);
        ch->set_cxform(color_xform);
        ch->set_matrix(mat);
        ch->set_ratio(ratio);
        ch->set_clip_depth(clip_depth);
-       ch->set_invalidated();
 
        container_type::iterator it = find_if(
                        _characters.begin(), _characters.end(),
@@ -215,12 +215,12 @@
 {
        //GNASH_REPORT_FUNCTION;
 
+       ch->set_invalidated();
        ch->set_depth(depth);
        ch->set_cxform(color_xform);
        ch->set_matrix(mat);
        ch->set_ratio(ratio);
        ch->set_clip_depth(clip_depth);
-       ch->set_invalidated();
        ch->restart();
 
        container_type::iterator it = find_if(

Index: server/edit_text_character.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/edit_text_character.cpp      17 Oct 2006 12:37:46 -0000      1.20
+++ server/edit_text_character.cpp      18 Oct 2006 18:16:01 -0000      1.21
@@ -3,7 +3,7 @@
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
 
-/* $Id: edit_text_character.cpp,v 1.20 2006/10/17 12:37:46 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.21 2006/10/18 18:16:01 udog Exp $ */
 
 #include "utf8.h"
 #include "log.h"
@@ -157,6 +157,8 @@
        
     if (!force && !m_invalidated) return; // no need to redraw 
        
+    bounds->expand_to_rect(m_old_invalidated_bounds);  
+       
     bounds->expand_to_transformed_rect(get_world_matrix(), 
       m_def->get_bound());            
          
@@ -295,6 +297,8 @@
                return;
        }
 
+       set_invalidated();
+
        m_text = new_text;
        if (m_def->get_max_length() > 0
            && m_text.length() > m_def->get_max_length() )
@@ -304,7 +308,6 @@
 
        format_text();
        
-       set_invalidated();
 }
 
 void

Index: server/generic_character.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/generic_character.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/generic_character.h  12 Oct 2006 21:47:52 -0000      1.11
+++ server/generic_character.h  18 Oct 2006 18:16:01 -0000      1.12
@@ -126,6 +126,7 @@
   }
     
        void get_invalidated_bounds(rect* bounds, bool force) {
+         bounds->expand_to_rect(m_old_invalidated_bounds);
     if (m_visible && (m_invalidated||force)) {
       bounds->expand_to_transformed_rect(get_world_matrix(), 
         m_def->get_bound());            

Index: server/movie_interface.h
===================================================================
RCS file: /cvsroot/gnash/gnash/server/movie_interface.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/movie_interface.h    17 Oct 2006 15:32:48 -0000      1.12
+++ server/movie_interface.h    18 Oct 2006 18:16:01 -0000      1.13
@@ -35,7 +35,7 @@
 // 
 //
 
-/* $Id: movie_interface.h,v 1.12 2006/10/17 15:32:48 strk Exp $ */
+/* $Id: movie_interface.h,v 1.13 2006/10/18 18:16:01 udog Exp $ */
 
 #ifndef GNASH_MOVIE_INTERFACE_H
 #define GNASH_MOVIE_INTERFACE_H
@@ -49,11 +49,11 @@
 #include <cstdarg>     // for va_list arg to 
movie_interface::call_method_args()
 
 #include "as_object.h" // for inheritance
+#include "rect.h"
 
 // Forward declarations
 namespace gnash {
        class sprite_instance;
-       class rect;
 }
 
 namespace gnash {
@@ -208,18 +208,27 @@
        
   /// This method must be called whenever the visual aspect of this 
   /// character/movie did change. 
+  /// VERY IMPORTANT!! This function *must* be called *before* the changes are
+  /// applied!
        void set_invalidated() {
        
          if (m_invalidated) return; // flag already set, don't do anything
        
          m_invalidated = true;
-         /*if (m_parent)
-           m_parent->set_child_invalidated();*/    
+         
+         // Ok, at this point the instance will change it's visual aspect 
after the
+         // call to set_invalidated(). We save the *current* position of the 
+    // instance because this region must be updated even (or first of all) if 
+    // the character moves away from here.
+    
+    get_invalidated_bounds(&m_old_invalidated_bounds, true);
+     
   }
   
   // Should be called by display()
   void clear_invalidated() {
     m_invalidated = false;
+    m_old_invalidated_bounds.set_null();
   }
   
   
@@ -231,6 +240,11 @@
   /// is set.  
   virtual void get_invalidated_bounds(rect* bounds, bool force) = 0;
        
+protected:
+
+  /// Bounds of character instance before invalidating it
+  rect m_old_invalidated_bounds;
+       
 };
 
 }      // namespace gnash

Index: server/sprite_instance.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- server/sprite_instance.cpp  16 Oct 2006 20:41:35 -0000      1.66
+++ server/sprite_instance.cpp  18 Oct 2006 18:16:01 -0000      1.67
@@ -1515,6 +1515,8 @@
                        // for 1-st frame therefore we should do it for it :-)
                        if (m_current_frame == 0 && frame_count > 1)
                        {
+                               set_invalidated();
+
                                // affected depths
                                const std::vector<execute_tag*>&        
playlist = m_def->get_playlist(0);
                                std::vector<uint16> affected_depths;
@@ -1536,7 +1538,6 @@
                                        m_display_list.clear();
                                }
                                
-                               set_invalidated();
                        }
                        execute_frame_tags(m_current_frame);
                }
@@ -1779,10 +1780,10 @@
 
 void sprite_instance::swap_characters(character* ch1, character* ch2)
 {
-       m_display_list.swap_characters(ch1, ch2);
-       
        ch1->set_invalidated();
        ch2->set_invalidated();
+
+       m_display_list.swap_characters(ch1, ch2);       
 }
 
 character*
@@ -1927,6 +1928,8 @@
            ch->set_name(name);
        }
 
+        set_invalidated();
+
     m_display_list.replace_character(
        ch,
        depth,
@@ -1937,7 +1940,6 @@
        ratio,
        clip_depth);
        
-        set_invalidated();
 }
 
 int sprite_instance::get_id_at_depth(int depth)
@@ -2262,8 +2264,11 @@
 void 
 sprite_instance::get_invalidated_bounds(rect* bounds, bool force) {
   
+  bounds->expand_to_rect(m_old_invalidated_bounds);
+  
   if (!m_visible) return;
   // TODO: check if alpha=0 (return if so)
+  
   m_display_list.get_invalidated_bounds(bounds, force||m_invalidated);
 }
 




reply via email to

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