gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/render_handler.h backen...


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler.h backen...
Date: Sat, 25 Nov 2006 16:00:21 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   06/11/25 16:00:21

Modified files:
        .              : ChangeLog 
        backend        : render_handler.h render_handler_agg.cpp 

Log message:
        Don't start drawing a character when it's outside the clipping rectangle

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1765&r2=1.1766
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.42&r2=1.43

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.1765
retrieving revision 1.1766
diff -u -b -r1.1765 -r1.1766
--- ChangeLog   25 Nov 2006 14:56:43 -0000      1.1765
+++ ChangeLog   25 Nov 2006 16:00:21 -0000      1.1766
@@ -1,3 +1,10 @@
+2006-11-25 Udo Giacomozzi <address@hidden>
+
+       * backend/render_handler.h, backend/render_handler_agg.cpp:
+       Don't start drawing a character when it's outside the clipping
+       rectangle.
+
+
 2006-11-25 Sandro Santilli <address@hidden>
 
        * server/asobj/Global.cpp, testsuite/actionscript.all/Global.as:

Index: backend/render_handler.h
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- backend/render_handler.h    7 Nov 2006 13:09:38 -0000       1.21
+++ backend/render_handler.h    25 Nov 2006 16:00:21 -0000      1.22
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: render_handler.h,v 1.21 2006/11/07 13:09:38 udog Exp $ */
+/* $Id: render_handler.h,v 1.22 2006/11/25 16:00:21 udog Exp $ */
 
 #ifndef RENDER_HANDLER_H
 #define RENDER_HANDLER_H
@@ -344,9 +344,21 @@
        virtual void draw_shape_character(shape_character_def *def, 
     character *inst) {
     
+    // check if the character needs to be rendered at all
+    rect cur_bounds;
+    
+    cur_bounds.expand_to_transformed_rect(inst->get_world_matrix(), 
+                       def->get_bound());
+                       
+               if (!bounds_in_clipping_area(cur_bounds)) {
+                 return; // no need to draw
+               }
+               
+    
     // TODO: I don't like that there is a draw_shape_character() version with
     // arbitrary fill and line styles as this may break caching...
   
+    // render the character
     draw_shape_character(def, 
       inst->get_world_matrix(), 
       inst->get_world_cxform(),
@@ -356,6 +368,17 @@
 
   }
 
+  /// Checks if the given bounds are (partially) in the current drawing 
clipping
+  /// area. A render handler implementing invalidated bounds should implement
+  /// this method to avoid rendering of characters that are not visible anyway.
+  /// By default this method always returns true, which will ensure correct
+  /// rendering. If possible, it should be re-implemented by the renderer 
+  /// handler for better performance.
+  /// 'bounds' contains TWIPS coordinates.
+  virtual bool bounds_in_clipping_area(const rect& bounds) {
+    return true;
+  }
+
   /// \brief
   /// Draws the given character definition with the given transformations and
   /// styles. 

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- backend/render_handler_agg.cpp      15 Nov 2006 11:03:28 -0000      1.42
+++ backend/render_handler_agg.cpp      25 Nov 2006 16:00:21 -0000      1.43
@@ -16,7 +16,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.42 2006/11/15 11:03:28 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.43 2006/11/25 16:00:21 udog Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -1357,6 +1357,19 @@
   
   }
 
+  virtual bool bounds_in_clipping_area(const rect& bounds) {    
+    int bxmin, bxmax, bymin, bymax;
+    
+    world_to_pixel(&bxmin, &bymin, bounds.get_x_min(), bounds.get_y_min()); 
+    world_to_pixel(&bxmax, &bymax, bounds.get_x_max(), bounds.get_y_max());
+    
+    return
+      (bxmin <= m_clip_xmax) &&
+      (bxmin <= m_clip_xmax) &&
+      (bymax >= m_clip_ymin) && 
+      (bymax >= m_clip_ymin); 
+  }
+
   void get_pixel(rgba& color_return, float world_x, float world_y) {
     int x, y;
     




reply via email to

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