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_agg.cpp


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp
Date: Mon, 05 Nov 2007 10:00:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     07/11/05 10:00:11

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp 

Log message:
                * backend/render_handler_agg.cpp: Use agg::renderer_mclip 
instead
                of agg::renderer_base, since the latter supports multiple 
clipping
                boxes. This allows us to apply all the clipping regions at 
once. A
                performance gain should be expected for movies with multiple
                clipping regions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4767&r2=1.4768
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.113&r2=1.114

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4767
retrieving revision 1.4768
diff -u -b -r1.4767 -r1.4768
--- ChangeLog   5 Nov 2007 09:04:07 -0000       1.4767
+++ ChangeLog   5 Nov 2007 10:00:09 -0000       1.4768
@@ -1,3 +1,11 @@
+2007-11-05 Bastiaan Jacques <address@hidden>
+
+       * backend/render_handler_agg.cpp: Use agg::renderer_mclip instead
+       of agg::renderer_base, since the latter supports multiple clipping
+       boxes. This allows us to apply all the clipping regions at once. A
+       performance gain should be expected for movies with multiple
+       clipping regions.
+
 2007-11-05 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/TextField.as: add more test for

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -b -r1.113 -r1.114
--- backend/render_handler_agg.cpp      30 Oct 2007 18:55:40 -0000      1.113
+++ backend/render_handler_agg.cpp      5 Nov 2007 10:00:11 -0000       1.114
@@ -17,7 +17,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.113 2007/10/30 18:55:40 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.114 2007/11/05 10:00:11 bjacques Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -152,6 +152,7 @@
 //#endif
 #include <agg_rasterizer_scanline_aa.h>
 #include <agg_rasterizer_compound_aa.h>
+#include <agg_renderer_mclip.h>
 #include <agg_span_allocator.h>
 #include <agg_path_storage.h>
 #include <agg_conv_curve.h>
@@ -513,7 +514,7 @@
     img_source_type img_src(img_pixf);
     
     // renderer base for the stage buffer (not the frame image!)
-    renderer_base rbase(*m_pixf);
+    agg::renderer_mclip<PixelFormat> rbase(*m_pixf);
         
     // nearest neighbor method for scaling
     typedef agg::span_image_filter_rgb_nn<img_source_type, interpolator_type>
@@ -537,23 +538,22 @@
     path.line_to(d.m_x, d.m_y);
     path.line_to(a.m_x, a.m_y);
 
+    for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+      add_clip_box(rbase, *_clipbounds_selected[cno]);
+    }
+
     if (m_alpha_mask.empty()) {
     
       // No mask active
 
       agg::scanline_u8 sl;
   
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {    
-      
-        const geometry::Range2d<int>& cbounds = _clipbounds[cno];
-        apply_clip_box<ras_type> (ras, cbounds);
-  
         // <Udo>: AFAIK add_path() rewinds the vertex list (clears previous
         // path), so there should be no problem with multiple clipbounds.      
         ras.add_path(path);     
            
         agg::render_scanlines_aa(ras, sl, rbase, sa, sg);
-      }
+
       
     } else {
     
@@ -564,17 +564,12 @@
       typedef agg::scanline_u8_am<agg::alpha_mask_gray8> scanline_type;
       scanline_type sl(m_alpha_mask.back()->get_amask());
   
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {    
-      
-        const geometry::Range2d<int>& cbounds = _clipbounds[cno];
-        apply_clip_box<ras_type> (ras, cbounds);
-  
         // <Udo>: AFAIK add_path() rewinds the vertex list (clears previous
         // path), so there should be no problem with multiple clipbounds.      
         ras.add_path(path);     
            
         agg::render_scanlines_aa(ras, sl, rbase, sa, sg);
-      }
+
       
     
     } // if alpha mask
@@ -761,21 +756,18 @@
     log_msg("apply_color(); called - NOT IMPLEMENTED");
   }
 
-
-  template <class ras_type>
-  void apply_clip_box(ras_type& ras, 
-    const geometry::Range2d<int>& bounds)
+  template <typename clip_type>
+  void add_clip_box(clip_type& renderer,
+    const geometry::Range2d<int>& bounds) const
   {
     assert(bounds.isFinite());
-    ras.clip_box(
-      (double)bounds.getMinX(),
-      (double)bounds.getMinY(),
-      (double)bounds.getMaxX()+1,
-      (double)bounds.getMaxY()+1);  
+    renderer.add_clip_box(
+      bounds.getMinX(),
+      bounds.getMinY(),
+      bounds.getMaxX()+1,
+      bounds.getMaxY()+1);
   }
 
-
-  
   void  draw_line_strip(const void* coords, int vertex_count, const rgba& 
color)
   // Draw the line strip formed by the sequence of points.
   {
@@ -789,13 +781,13 @@
 
     point pnt;
     
-    renderer_base rbase(*m_pixf);
+    agg::renderer_mclip<PixelFormat> rbase(*m_pixf);
     
     typedef agg::rasterizer_scanline_aa<> ras_type;
 
     ras_type ras;    
     agg::renderer_scanline_aa_solid<
-      agg::renderer_base<PixelFormat> > ren_sl(rbase);
+      agg::renderer_mclip<PixelFormat> > ren_sl(rbase);
       
     // -- create path --
     agg::path_storage path;
@@ -815,6 +807,10 @@
       path.line_to(pnt.m_x, pnt.m_y);
     }
     
+    for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+      add_clip_box(rbase, *_clipbounds_selected[cno]);
+    }
+    
     // -- render --
     
     if (m_alpha_mask.empty()) {
@@ -823,11 +819,6 @@
       
       agg::scanline_p8 sl;      
       
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
-      
-        const geometry::Range2d<int>& bounds = _clipbounds[cno];
-              
-        apply_clip_box<ras_type> (ras, bounds);
         
         // The vectorial pipeline
         ras.add_path(stroke);
@@ -837,8 +828,6 @@
         
         agg::render_scanlines(ras, sl, ren_sl);     
         
-      }
-      
     } else {
     
       // Mask is active!
@@ -847,12 +836,6 @@
       
       sl_type sl(m_alpha_mask.back()->get_amask());      
       
-      for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
-      
-        const geometry::Range2d<int>& bounds = _clipbounds[cno];
-              
-        apply_clip_box<ras_type> (ras, bounds);
-        
         // The vectorial pipeline
         ras.add_path(stroke);
     
@@ -863,8 +846,6 @@
         
       }
     
-    }
-
   } // draw_line_strip
 
 
@@ -1570,10 +1551,10 @@
 
     // AGG stuff
     typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl> ras_type;
-    renderer_base rbase(*m_pixf);
+    agg::renderer_mclip<PixelFormat> rbase(*m_pixf);
     ras_type rasc;  // flash-like renderer
     agg::renderer_scanline_aa_solid<
-      agg::renderer_base<PixelFormat> > ren_sl(rbase); // solid fills
+      agg::renderer_mclip<PixelFormat> > ren_sl(rbase); // solid fills
     agg::span_allocator<agg::rgba8> alloc;  // span allocator (?)
     
 
@@ -1583,13 +1564,11 @@
     else
       rasc.filling_rule(agg::fill_non_zero);
       
-    
     for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+      add_clip_box(rbase, *_clipbounds_selected[cno]);
+    }
     
-      const geometry::Range2d<int>* bounds = _clipbounds_selected[cno];
-      
-      apply_clip_box<ras_type> (rasc, *bounds);
-      
+    {      
       int current_subshape=0;
         
       // push paths to AGG
@@ -1811,17 +1790,17 @@
     // AGG stuff
     typedef agg::rasterizer_scanline_aa<> ras_type; 
     ras_type ras;  // anti alias
-    renderer_base rbase(*m_pixf);
+    agg::renderer_mclip<PixelFormat> rbase(*m_pixf);
     agg::renderer_scanline_aa_solid<
-      agg::renderer_base<PixelFormat> > ren_sl(rbase); // solid fills
+      agg::renderer_mclip<PixelFormat> > ren_sl(rbase); // solid fills
       
     
     for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+      add_clip_box(rbase, *_clipbounds_selected[cno]);
+    }
     
-      const geometry::Range2d<int>* bounds = _clipbounds_selected[cno];
-          
-      apply_clip_box<ras_type> (ras, *bounds);
       
+    {
       int current_subshape=0;
 
       for (size_t pno=0, pcount=paths.size(); pno<pcount; pno++) {
@@ -1890,10 +1869,10 @@
     mat.concatenate(m_current_matrix);
     
     typedef agg::rasterizer_scanline_aa<> ras_type;
-    renderer_base rbase(*m_pixf);
+    agg::renderer_mclip<PixelFormat> rbase(*m_pixf);
     ras_type ras;
     agg::renderer_scanline_aa_solid<
-      agg::renderer_base<PixelFormat> > ren_sl(rbase);
+      agg::renderer_mclip<PixelFormat> > ren_sl(rbase);
       
     // -- create path --
     agg::path_storage path;
@@ -1919,15 +1898,13 @@
     
     
     
-    // -- render --
-      
-    // iterate through clipping bounds
-    for (unsigned int cno=0; cno<_clipbounds.size(); cno++) {
-    
-      const geometry::Range2d<int>& bounds = _clipbounds[cno];         
-      apply_clip_box<ras_type> (ras, bounds);     
+    for (unsigned int cno=0; cno<_clipbounds_selected.size(); cno++) {
+      add_clip_box(rbase, *_clipbounds_selected[cno]);
+    }
             
+    // -- render --
       
+    {            
       // fill polygon
       if (fill.m_a>0) {
         ras.add_path(path);




reply via email to

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