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_styl...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg_styl...
Date: Fri, 20 Jun 2008 06:36:59 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/06/20 06:36:58

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg_style.h 
        server         : fill_style.cpp sprite_instance.cpp 
        testsuite/server: MatrixTest.cpp 

Log message:
                * backend/render_handler_agg_style.h,
                  server/fill_style.cpp, server/sprite_instance.cpp:
                  tirval cleanups, indent, fix compiler warnings.
                * testsuite/server/MatrixTest.cpp: more tests for 
matrix::invert().

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6992&r2=1.6993
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg_style.h?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.cpp?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.554&r2=1.555
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/MatrixTest.cpp?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6992
retrieving revision 1.6993
diff -u -b -r1.6992 -r1.6993
--- ChangeLog   20 Jun 2008 03:43:39 -0000      1.6992
+++ ChangeLog   20 Jun 2008 06:36:57 -0000      1.6993
@@ -1,5 +1,12 @@
 2008-06-20 Zou Lunkai <address@hidden>
 
+       * backend/render_handler_agg_style.h,
+         server/fill_style.cpp, server/sprite_instance.cpp:
+         tirval cleanups, indent, fix compiler warnings.
+       * testsuite/server/MatrixTest.cpp: more tests for matrix::invert().
+        
+2008-06-20 Zou Lunkai <address@hidden>
+
        * server/matrix.cpp: invert(), fix overflows, should also fix regression
         bug#23621.
 

Index: backend/render_handler_agg_style.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg_style.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- backend/render_handler_agg_style.h  5 Jun 2008 03:26:31 -0000       1.32
+++ backend/render_handler_agg_style.h  20 Jun 2008 06:36:58 -0000      1.33
@@ -626,7 +626,7 @@
       
       // move the center of the radial fill to where it should be
       gnash::matrix transl;
-      transl.concatenate_translation(-32.0f, -32.0f);
+      transl.set_translation(-32, -32);
       transl.concatenate(mat);    
       
       st_type* st = new st_type(fs, transl, cx, 64/2);  // div 2 because we 
need radius, not diameter     
@@ -655,7 +655,7 @@
       // move the center of the focal fill (not it's focal point) to where it 
       // should be.
       gnash::matrix transl;      
-      transl.concatenate_translation(-32.0f, -32.0f);
+      transl.set_translation(-32, -32);
       transl.concatenate(mat);
       
       st_type* st = new st_type(fs, transl, cx, 64/2); 

Index: server/fill_style.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- server/fill_style.cpp       12 Jun 2008 03:13:41 -0000      1.37
+++ server/fill_style.cpp       20 Jun 2008 06:36:58 -0000      1.38
@@ -44,12 +44,9 @@
     m_color.read(in, tag_type);
 }
 
-
 //
 // fill_style
 //
-
-
 fill_style::fill_style()
     :
     m_type(SWF::FILL_SOLID),
@@ -71,10 +68,11 @@
     in->ensureBytes(1);
     m_type = in->read_u8();
        if (is_morph)
+    {
                pOther->m_type = m_type;
+    }
 
-               IF_VERBOSE_PARSE
-               (
+    IF_VERBOSE_PARSE(
     log_parse("  fill_style read type = 0x%X", m_type);
                );
 
@@ -85,14 +83,12 @@
                        || tag_type == SWF::DEFINESHAPE4_ || is_morph)
         {
             m_color.read_rgba(in);
-                       if (is_morph)
-                               pOther->m_color.read_rgba(in);
+            if (is_morph)   pOther->m_color.read_rgba(in);
         }
         else 
         {
             // For DefineMorphShape tags we should use morph_fill_style 
-            assert( tag_type == SWF::DEFINESHAPE
-               || tag_type == SWF::DEFINESHAPE2 );
+            assert( tag_type == SWF::DEFINESHAPE || tag_type == 
SWF::DEFINESHAPE2 );
             m_color.read_rgb(in);
         }
 
@@ -116,13 +112,13 @@
         m_gradient_matrix.set_identity();
         if (m_type == SWF::FILL_LINEAR_GRADIENT)
         {
-            m_gradient_matrix.concatenate_translation(128.f, 0.f);
-            m_gradient_matrix.concatenate_scale(1.0f/128, 1.0f/128);
+            m_gradient_matrix.set_translation(128, 0);
+            m_gradient_matrix.set_scale(1.0/128, 1.0/128);
         }
         else // FILL_RADIAL_GRADIENT or FILL_FOCAL_GRADIENT
         {
-            m_gradient_matrix.concatenate_translation(32.f, 32.f);
-            m_gradient_matrix.concatenate_scale(1.0f/512, 1.0f/512);
+            m_gradient_matrix.set_translation(32, 32);
+            m_gradient_matrix.set_scale(1.0/512, 1.0/512);
         }
 
         matrix m = input_matrix;
@@ -200,15 +196,18 @@
                );
         }                      
 
-               if (is_morph)
+        if (is_morph) {
                        pOther->m_gradients.resize(num_gradients);
+        }
+                
 
         m_gradients.resize(num_gradients);
            for (unsigned int i = 0; i < num_gradients; i++)    {
                    m_gradients[i].read(in, tag_type);
-                       if (is_morph)
+            if (is_morph) {
                                pOther->m_gradients[i].read(in, tag_type);
         }
+        }
 
                // A focal gradient also has a focal point.
                if (m_type == SWF::FILL_FOCAL_GRADIENT)
@@ -221,11 +220,11 @@
                                m_focal_point = 1.0f;
                }
 
-               if (is_morph)
+        if (is_morph) {
                        pOther->m_focal_point = m_focal_point;
+        }
 
-               IF_VERBOSE_PARSE
-               (
+        IF_VERBOSE_PARSE (
         log_parse("  gradients: num_gradients = %d", num_gradients);
                );
 
@@ -277,8 +276,7 @@
                                " in the Characters Dictionary."
                                " It seems common to find such "
                                " malformed SWF, so we'll only warn once "
-                               "about this."),
-                               bitmap_char_id);
+                        "about this."), bitmap_char_id);
                        warned_about_invalid_char=true;
                }
        }
@@ -305,10 +303,9 @@
     {
        std::stringstream ss;
        ss << "Unknown fill style type " << m_type;
-        //log_unimpl("Unsupported fill style type: 0x%X", m_type);
         // This is a fatal error, we'll be leaving the stream
         // read pointer in an unknown position.
-        throw ParserException(ss.str()); // "Unsupported fill style (Malformed 
SWF?)");
+        throw ParserException(ss.str()); 
     }
 }
 

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.554
retrieving revision 1.555
diff -u -b -r1.554 -r1.555
--- server/sprite_instance.cpp  19 Jun 2008 10:51:43 -0000      1.554
+++ server/sprite_instance.cpp  20 Jun 2008 06:36:58 -0000      1.555
@@ -1827,7 +1827,7 @@
       // Should be 20x20 with center at 0,0
       float g2fs = 20.0/64.0; // gnash to flash scale
       gnashToFlash.set_scale(g2fs, g2fs);
-      gnashToFlash.concatenate_translation(-32.0, -32.0);
+      gnashToFlash.concatenate_translation(-32, -32);
 
     }
     else
@@ -1841,7 +1841,7 @@
       // Gnash linear gradients are 256x1 with center at 128,0
       // Should be 20x20 with center at 0,0
       gnashToFlash.set_scale(20.0/256.0, 20.0/1);
-      gnashToFlash.concatenate_translation(-128.0, 0.0);
+      gnashToFlash.concatenate_translation(-128, 0);
 
     }
 

Index: testsuite/server/MatrixTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/MatrixTest.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/server/MatrixTest.cpp     16 Jun 2008 07:22:21 -0000      1.16
+++ testsuite/server/MatrixTest.cpp     20 Jun 2008 06:36:58 -0000      1.17
@@ -60,24 +60,22 @@
 {
     std::string label;
 
-       // Check attributes of the identity
+       // 
+    //  Test identity matrix.
+    // 
        matrix identity; 
        check(identity.is_valid());
-       identity.set_identity();
        check_equals(identity.get_x_scale(), 1);
        check_equals(identity.get_y_scale(), 1);
        check_equals(identity.get_rotation(), 0);
        check_equals(identity.get_x_translation(), 0);
        check_equals(identity.get_y_translation(), 0);
 
-       // The inverse of identity is still the identity
-       matrix mat;
-       check_equals(mat.invert(), identity);
-
-       //---------------------------------------------
-       // Test canonic parameter setting and getting
-       //---------------------------------------------
+       check_equals(identity.invert(), identity);
 
+       //
+       // Test parameter setting and getting, interfaces for AS.
+       //
        matrix m1;
        m1.set_scale_rotation(1, 3, 0);
        check_equals(m1.get_x_scale(), 1);
@@ -142,10 +140,9 @@
        check_equals(m1.get_x_translation(), 5);
        check_equals(m1.get_y_translation(), 6);
 
-       //---------------------------------------------
-       // Test concatenation
-       //---------------------------------------------
-
+       //
+       // Test matrix concatenation
+       //
        m1.concatenate_scale(2, 2);
        check_equals(D(m1.get_x_scale()), 2);
        check_equals(D(m1.get_y_scale()), 4);
@@ -167,16 +164,14 @@
        check_equals(m1.get_x_translation(), 5);
        check_equals(m1.get_y_translation(), 6);
 
-       //---------------------------------------------
-       // Test transformations
-       //---------------------------------------------
-
+       //
+       // Test matrix transformations
+       //
        point p1(0, 0);
        point p2(64, 64);
        point r;
 
        m1.set_identity();
-
        // Make a distance of 64 become a distance of 20 .. 
        m1.set_scale(20.0/64, 20.0/64);
 
@@ -200,10 +195,8 @@
        check_equals(r.x, 10);
        check_equals(r.y, 10);
 
-       // Apply a final scaling by 10 keeping
-       // the current origin (reached after
-       // translation)
-
+       //  Apply a final scaling by 10 keeping the current origin 
+    // (reached after translation)
        matrix final;
        final.set_scale(10, 10);
        final.concatenate(m1);
@@ -217,7 +210,9 @@
        check_equals(r.x, 100);
        check_equals(r.y, 100);
 
-       // test matrix invert
+    //
+       // Test matrix invertion
+    // 
     m1.set_identity();
     m1.set_translation(50*20, -30*20);
     m1.set_scale(0.5, 2);
@@ -225,9 +220,31 @@
     
     matrix m1_inverse = m1;
     m1_inverse.invert();
+    // concatenate the inverse matrix and orignial matrix.
     m1_inverse.concatenate(m1); 
+    // the result is expected to be an identity matrix. 
+    check_equals(m1_inverse, identity);
+
+    m1.sx  = 4;   // 1/16384
+    m1.shy = 0;
+    m1.tx  = 20;
+    m1.shx = 0;
+    m1.sy  = 4;   // 1/16384
+    m1.ty  = 20;
 
-    check_equals(m1_inverse.get_x_translation(), 0);    
-    check_equals(m1_inverse.get_y_translation(), 0);  
+    m1_inverse = m1;
+    m1_inverse.invert();
+    
+    check_equals(m1_inverse.sx, 16384 * 65536);
+    check_equals(m1_inverse.shy, 0);
+    check_equals(m1_inverse.tx, -327680);
+    check_equals(m1_inverse.shx, 0);
+    check_equals(m1_inverse.sy, 16384 * 65536);
+    check_equals(m1_inverse.ty, -327680);
+    
+    // concatenate the inverse matrix and orignial matrix.
+    m1_inverse.concatenate(m1);
+    // the result is expected to be an identity matrix. 
+    check_equals(m1_inverse, identity);
 }
 




reply via email to

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