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: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...
Date: Sun, 02 Sep 2007 17:01:59 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/09/02 17:01:59

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp 
                         render_handler_agg_style.h 
        server         : fill_style.cpp fill_style.h 

Log message:
        More work on DefineShape4 -- this time on gradient focal fills.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4190&r2=1.4191
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.104&r2=1.105
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg_style.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.h?cvsroot=gnash&r1=1.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4190
retrieving revision 1.4191
diff -u -b -r1.4190 -r1.4191
--- ChangeLog   2 Sep 2007 12:57:00 -0000       1.4190
+++ ChangeLog   2 Sep 2007 17:01:58 -0000       1.4191
@@ -1,3 +1,11 @@
+2007-09-03 Chad Musick <address@hidden>
+
+       * server/fill_style.h,.cpp -- Add recording of focal point for focal
+         gradient fill.
+       * backend/render_handler_agg.cpp, backend/render_handler_agg_style.h
+         Adding gradient focal fill. I'm not sure if I've done this correctly,
+         but it didn't break anything.
+
 2007-09-02 Chad Musick <address@hidden>
 
        * server/fill_style.cpp -- Update the allow focal gradient fill style,

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- backend/render_handler_agg.cpp      29 Aug 2007 22:20:10 -0000      1.104
+++ backend/render_handler_agg.cpp      2 Sep 2007 17:01:59 -0000       1.105
@@ -17,7 +17,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.104 2007/08/29 22:20:10 nihilus Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.105 2007/09/02 17:01:59 cmusick Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -1464,6 +1464,18 @@
           break;
         } 
 
+       case SWF::FILL_FOCAL_GRADIENT:
+       {
+           matrix m = fill_styles[fno].get_gradient_matrix();
+           matrix cm;
+           cm.set_inverse(fillstyle_matrix);
+           m.concatenate(cm);
+           m.concatenate(inv_stage_matrix);
+
+           sh.add_gradient_focal(fill_styles[fno], m, cx);
+           break;
+       }
+
         case SWF::FILL_TILED_BITMAP:
         case SWF::FILL_CLIPPED_BITMAP:
         smooth=true;  // continue with next case!

Index: backend/render_handler_agg_style.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg_style.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- backend/render_handler_agg_style.h  18 Jul 2007 23:09:05 -0000      1.21
+++ backend/render_handler_agg_style.h  2 Sep 2007 17:01:59 -0000       1.22
@@ -628,6 +628,31 @@
       m_styles.push_back(st);
     }
     
+void add_gradient_focal(const gnash::fill_style& fs, gnash::matrix mat, 
gnash::cxform cx)
+{
+       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_focus gradient_func_type;
+    typedef gradient_func_type gradient_adaptor_type;
+    typedef agg::gradient_lut<agg::color_interpolator<color_type>, 256> 
color_func_type;
+    typedef agg::span_gradient<color_type, interpolator_type,
+               gradient_adaptor_type, color_func_type> sg_type;
+
+       typedef agg_style_gradient<color_type, span_allocator_type,
+               interpolator_type, gradient_func_type, gradient_adaptor_type,
+               color_func_type, sg_type> st_type;
+
+    // move the focal fill to where it should be.
+    gnash::matrix transl;
+       // TODO: Is this right?
+    transl.concatenate_translation(fs.get_focal_point() * 32.0f, 0.0f);
+       transl.concatenate(mat);
+
+       st_type* st = new st_type(fs, transl, cx, 64/2);
+
+       m_styles.push_back(st);
+}
 
     /// Returns the color of a certain fill style (solid)
     const agg::rgba8& color(unsigned style) const 

Index: server/fill_style.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/fill_style.cpp       2 Sep 2007 12:57:00 -0000       1.8
+++ server/fill_style.cpp       2 Sep 2007 17:01:59 -0000       1.9
@@ -124,12 +124,14 @@
         {
             m_gradient_matrix.concatenate_translation(32.f, 32.f);
             m_gradient_matrix.concatenate_scale(1.0f / 512.0f);
-                       // TODO: Obviously, a focal gradient isn't a radial
-                       // gradient, but how _should_ this be handled?
+                       // A focal gradient also has a focal point.
                        if (m_type == SWF::FILL_FOCAL_GRADIENT)
                        {
-                               /* float focal_point = */
-                               static_cast<void>(in->read_short_sfixed());
+                               m_focal_point = in->read_short_sfixed();
+                               if (m_focal_point < -1.0f)
+                                       m_focal_point = -1.0f;
+                               else if (m_focal_point > 1.0f)
+                                       m_focal_point = 1.0f;
                        }
         }
 
@@ -148,8 +150,8 @@
                return;
        }
 
-        if ( num_gradients > 8 ) // SWF::DEFINESHAPE4 should support up to 15 !
-                                // and we don't have this limitation anyway
+        if ( num_gradients > 8 + (tag_type == SWF::DEFINESHAPE4 ||
+                       tag_type == SWF::DEFINESHAPE4_) ? 7 : 0)
         {
             // see: http://sswf.sourceforge.net/SWFalexref.html#swf_gradient
             log_error(_("Unexpected num gradients (%d), expected 1 to 8"),

Index: server/fill_style.h
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/fill_style.h 7 Aug 2007 20:53:10 -0000       1.8
+++ server/fill_style.h 2 Sep 2007 17:01:59 -0000       1.9
@@ -17,7 +17,7 @@
 
 // Based on work of Thatcher Ulrich <address@hidden> 2003
 
-/* $Id: fill_style.h,v 1.8 2007/08/07 20:53:10 strk Exp $ */
+/* $Id: fill_style.h,v 1.9 2007/09/02 17:01:59 cmusick Exp $ */
 
 #ifndef GNASH_FILL_STYLE_H
 #define GNASH_FILL_STYLE_H
@@ -120,6 +120,12 @@
        /// Returns the color stop value at a specified index
        const gradient_record& get_color_stop(int index) const;
        
+       /// Get and set the focal point for gradient focal fills.
+       /// This should be from -1.0 to 1.0, representing the left
+       /// and right edges of the rectangle.
+       float get_focal_point() const { return m_focal_point; }
+       void set_focal_point(float f) { m_focal_point = f; }
+
 #ifdef GNASH_USE_GC
        /// Mark reachable resources (for the GC)
        //
@@ -147,6 +153,7 @@
        int     m_type;
        rgba    m_color;
        matrix  m_gradient_matrix;
+    float m_focal_point; // For focal fill gradients.
        std::vector<gradient_record>    m_gradients;
        boost::intrusive_ptr<gnash::bitmap_info>        m_gradient_bitmap_info;
        boost::intrusive_ptr<bitmap_character_def>      m_bitmap_character;




reply via email to

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