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_style.h


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg_style.h
Date: Thu, 02 Nov 2006 10:53:47 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   06/11/02 10:53:47

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg_style.h 

Log message:
        Correct and faster implementation of radial gradient fills

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1475&r2=1.1476
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg_style.h?cvsroot=gnash&r1=1.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.1475
retrieving revision 1.1476
diff -u -b -r1.1475 -r1.1476
--- ChangeLog   2 Nov 2006 09:59:42 -0000       1.1475
+++ ChangeLog   2 Nov 2006 10:53:47 -0000       1.1476
@@ -2,6 +2,8 @@
 
        * testsuite/samples/gradients-test.swf: Added a extensive
          test for gradient rendering.
+       * backend/render_handler_agg_style.h: correct and faster
+         implementation of radial fills
 
 2006-11-02 Hiroyuki Ikezoe <address@hidden>
 

Index: backend/render_handler_agg_style.h
===================================================================
RCS file: /cvsroot/gnash/gnash/backend/render_handler_agg_style.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- backend/render_handler_agg_style.h  31 Oct 2006 09:30:07 -0000      1.8
+++ backend/render_handler_agg_style.h  2 Nov 2006 10:53:47 -0000       1.9
@@ -89,22 +89,6 @@
 #define image_accessor_clip_transp agg::image_accessor_clone
 
 
-/// Quick hack to make radial gradients work properly. For some strange reason
-/// the xform matrix leads to incorrect results even if it is the same for
-/// linear gradients (which work). This implementation is sub-optimal because
-/// it adds two addition operations for each pixel(?), so this needs to be
-/// solved in another way (ie. calculate correct matrix)   
-class my_gradient_radial
-{
-  public:
-  static AGG_INLINE int calculate(int x, int y, int d)
-  {
-    x-=512; 
-    y-=512; 
-    return int(sqrt(x*x + y*y));
-  }
-};
-
 /// AGG bitmap fill style. There are quite a few combinations possible and so
 /// the class types are defined outside. The bitmap can be tiled or clipped.
 /// It can have any transformation matrix and color transform. Any pixel format
@@ -590,8 +574,7 @@
       typedef agg::rgba8 color_type;            
       typedef agg::span_allocator<color_type> span_allocator_type;
       typedef agg::span_interpolator_linear<agg::trans_affine> 
interpolator_type;
-      //typedef agg::gradient_radial gradient_func_type;
-      typedef my_gradient_radial gradient_func_type;
+      typedef agg::gradient_radial gradient_func_type;
       typedef gradient_func_type gradient_adaptor_type;
       typedef agg::gradient_lut<agg::color_interpolator<agg::rgba8>, 256> 
color_func_type;
       typedef agg::span_gradient<color_type,
@@ -603,7 +586,12 @@
         interpolator_type, gradient_func_type, gradient_adaptor_type, 
         color_func_type, sg_type> st_type;
       
-      st_type* st = new st_type(fs, mat, cx, 64/2);  // div 2 because of 
my_gradient_radial     
+      // move the center of the radial fill to where it should be
+      gnash::matrix transl;
+      transl.concatenate_translation(-32.0f, -32.0f);
+      transl.concatenate(mat);    
+      
+      st_type* st = new st_type(fs, transl, cx, 64/2);  // div 2 because we 
need radius, not diameter     
         
       // NOTE: The value 64 is based on the bitmap texture used by other
       // Gnash renderers which is normally 64x64 pixels for linear gradients.  
     




reply via email to

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