gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9957: Remove dead code (old matrix


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9957: Remove dead code (old matrix mat, non-cached matrix params)
Date: Wed, 08 Oct 2008 11:27:25 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9957
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-10-08 11:27:25 +0200
message:
  Remove dead code (old matrix mat, non-cached matrix params)
modified:
  libcore/character.cpp
  libcore/matrix.cpp
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-10-01 07:30:48 +0000
+++ b/libcore/character.cpp     2008-10-08 09:27:25 +0000
@@ -41,9 +41,6 @@
 
 #undef set_invalidated
 
-/// Undefine this to not use caches for matrix parameters
-#define USE_MATRIX_CACHES
-
 namespace gnash
 {
 
@@ -298,11 +295,7 @@
        as_value rv;
        if ( fn.nargs == 0 ) // getter
        {
-#ifdef USE_MATRIX_CACHES
                return as_value(ptr->_xscale);
-#else
-        return as_value(ptr->m_matrix.get_x_scale()*100);
-#endif
        }
        else // setter
        {
@@ -333,11 +326,7 @@
        as_value rv;
        if ( fn.nargs == 0 ) // getter
        {
-#ifdef USE_MATRIX_CACHES
                return ptr->_yscale;
-#else
-               return ptr->m_matrix.get_y_scale() * 100;
-#endif
        }
        else // setter
        {
@@ -580,11 +569,7 @@
        as_value rv;
        if ( fn.nargs == 0 ) // getter
        {
-#ifdef USE_MATRIX_CACHES
                return ptr->_rotation;
-#else
-               return ptr->m_matrix.get_rotation() * 180 / PI;
-#endif
        }
        else // setter
        {
@@ -658,11 +643,9 @@
 character::copyMatrix(const character& c)
 {
        m_matrix = c.m_matrix;
-#ifdef USE_MATRIX_CACHES
        _xscale = c._xscale;
        _yscale = c._yscale;
        _rotation = c._rotation;
-#endif
 }
 
 void
@@ -675,14 +658,12 @@
                set_invalidated(__FILE__, __LINE__);
                m_matrix = m;
 
-#ifdef USE_MATRIX_CACHES
                if ( updateCache ) // don't update caches if matrix wasn't 
updated too
                {
                        _xscale = m_matrix.get_x_scale() * 100.0;
                        _yscale = m_matrix.get_y_scale() * 100.0;
                        _rotation = m_matrix.get_rotation() * 180.0 / PI;
                }
-#endif
     }
     else
     {
@@ -819,7 +800,6 @@
 void
 character::set_x_scale(double scale_percent)
 {
-#ifdef USE_MATRIX_CACHES
     double xscale = scale_percent / 100.0;
 
     if (xscale != 0.0 && _xscale != 0.0)
@@ -843,12 +823,6 @@
     m.set_x_scale(xscale);
 
     set_matrix(m); // we updated the cache ourselves
-#else
-    double xscale = scale_percent / 100.0;
-       matrix m = get_matrix();
-    m.set_x_scale(xscale);
-       set_matrix(m); // we updated the cache ourselves
-#endif
 
        transformedByScript(); 
 }
@@ -865,10 +839,6 @@
 
        //log_debug("_rotation: %d", rot);
 
-#ifdef USE_MATRIX_CACHES
-
-       //double xscale = _xscale / 100.0;
-       //double yscale = _yscale / 100.0;
        double rotation = rot * PI / 180.0;
 
        //log_debug("xscale cached: %d, yscale cached: %d", _xscale, _yscale);
@@ -884,13 +854,6 @@
 
        _rotation = rot;
 
-#else
-    double rotation = rot * PI / 180.0;
-       matrix m = get_matrix();
-       m.set_rotation(rotation);
-       set_matrix(m); // we updated the cache ourselves
-#endif
-
        transformedByScript(); 
 }
 

=== modified file 'libcore/matrix.cpp'
--- a/libcore/matrix.cpp        2008-10-01 07:59:20 +0000
+++ b/libcore/matrix.cpp        2008-10-08 09:27:25 +0000
@@ -36,10 +36,6 @@
 #include <cmath>
 #include <iomanip>
 
-// Define this to use new math for matrix operation.
-// This is for testing, zou is still working on it
-#define NEW_MATRIX_MATH 1
-
 namespace gnash {
 
 matrix::matrix()
@@ -174,35 +170,18 @@
 void
 matrix::set_x_scale(double xscale)
 {
-#ifdef NEW_MATRIX_MATH
     double rot_x = atan2((double)shx, (double)sx);
     sx  =  DoubleToFixed16(xscale * cos(rot_x));
     shx =  DoubleToFixed16(xscale * sin(rot_x)); 
-#else
-    double angle = get_rotation();
-    double cos_v = cos(angle);
-    double sin_v = sin(angle);
-    sx  =  DoubleToFixed16(xscale * cos_v);
-    shx =  DoubleToFixed16(xscale * sin_v);
-#endif
 }
 
 void
 matrix::set_y_scale(double yscale)
 {
-#ifdef NEW_MATRIX_MATH
     double rot_y = std::atan2((double)(-shy), (double)(sy));
 
     shy = -DoubleToFixed16(yscale * std::sin(rot_y));
     sy  =  DoubleToFixed16(yscale * std::cos(rot_y));
-
-#else
-    double angle = get_rotation();
-    double cos_v = cos(angle);
-    double sin_v = sin(angle);
-    shy =  - DoubleToFixed16(yscale * sin_v);
-    sy  =  DoubleToFixed16(yscale * cos_v);
-#endif
 }
 
 void
@@ -215,7 +194,6 @@
 void
 matrix::set_rotation(double rotation)
 {   
-#ifdef NEW_MATRIX_MATH
     double rot_x = atan2((double)shx,    (double)sx);
     double rot_y = atan2((double)(-shy), (double)sy);
     double scale_x = get_x_scale();
@@ -225,11 +203,6 @@
     shx = DoubleToFixed16(scale_x * sin(rotation)); 
     shy = -DoubleToFixed16(scale_y * sin(rot_y - rot_x + rotation));
     sy  =  DoubleToFixed16(scale_y * cos(rot_y - rot_x + rotation));
-#else
-    double xscale = get_x_scale();
-    double yscale = get_y_scale();
-    set_scale_rotation(xscale, yscale, rotation);
-#endif
 }
 
 void


reply via email to

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