gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9643: Fix the matrix regression (yo


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9643: Fix the matrix regression (youtube, potlatch and friends).
Date: Tue, 26 Aug 2008 15:05:56 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9643
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2008-08-26 15:05:56 +0200
message:
  Fix the matrix regression (youtube, potlatch and friends).
  See bug #24094 and bug #21756.
modified:
  libcore/character.cpp
  libcore/matrix.cpp
  libcore/matrix.h
  testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9642.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Tue 2008-08-26 11:33:36 +0200
    message:
      Add more tests for matrix-to-caches (gnash fails on extracting rotation)
    modified:
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9642.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Tue 2008-08-26 14:26:38 +0200
    message:
      Add more hardcoded-to-caches matrix tests, change matrix::get_rotation
      to give more successes in the matrix_test.c file 
    modified:
      libcore/matrix.cpp
      libcore/matrix.h
      testsuite/misc-ming.all/matrix_test.c
    ------------------------------------------------------------
    revno: 9642.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Tue 2008-08-26 15:02:17 +0200
    message:
      Fix _width setter (the youtube broker typo)
    modified:
      libcore/character.cpp
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-08-21 10:06:20 +0000
+++ b/libcore/character.cpp     2008-08-26 13:02:17 +0000
@@ -466,6 +466,7 @@
                }
 
                const double newwidth = PIXELS_TO_TWIPS(fn.arg(0).to_number());
+
                if ( newwidth <= 0 )
                {
                        IF_VERBOSE_ASCODING_ERRORS(
@@ -474,7 +475,7 @@
                        );
                }
 
-               ptr->set_x_scale( newwidth / oldwidth );
+               ptr->set_x_scale( 100 * (newwidth / oldwidth) );
        }
        return rv;
 }

=== modified file 'libcore/matrix.cpp'
--- a/libcore/matrix.cpp        2008-08-18 23:53:04 +0000
+++ b/libcore/matrix.cpp        2008-08-26 12:26:38 +0000
@@ -309,6 +309,8 @@
 double
 matrix::get_rotation() const
 {
+    return atan2(shx, sx); // more successes in misc-ming.all/matrix_test.c
+
     if (determinant() < 0)
     {
         // TODO: check this.

=== modified file 'libcore/matrix.h'
--- a/libcore/matrix.h  2008-08-10 14:57:21 +0000
+++ b/libcore/matrix.h  2008-08-26 12:26:38 +0000
@@ -53,12 +53,12 @@
 {
 public:
 
-    int sx;  // Xscale, 16.16 fixed point.
-    int shx; // Xshear, 16.16 fixed point. 
-    int tx;  // Xtranslation, TWIPS.
-    int sy;  // Yscale, 16.16 fixed point.
-    int shy; // Yshear, 16.16 fixed point.
-    int ty;  // Ytranslation, TWIPS.
+    int sx;  // Xscale, 16.16 fixed point. xx in swfdec.
+    int shx; // Xshear, 16.16 fixed point. yx in swfdec.
+    int tx;  // Xtranslation, TWIPS. x0 in swfdec.
+    int sy;  // Yscale, 16.16 fixed point. yy in swfdec.
+    int shy; // Yshear, 16.16 fixed point. xy in swfdec.
+    int ty;  // Ytranslation, TWIPS. y0 in swfdec.
              
     friend bool operator== (const matrix&, const matrix&);
     friend std::ostream& operator<< (std::ostream&, const matrix&);

=== modified file 'testsuite/misc-ming.all/matrix_test.c'
--- a/testsuite/misc-ming.all/matrix_test.c     2008-06-30 08:42:13 +0000
+++ b/testsuite/misc-ming.all/matrix_test.c     2008-08-26 12:26:38 +0000
@@ -85,7 +85,7 @@
        Ming_init();
        mo = newSWFMovieWithVersion(OUTPUT_VERSION);
        SWFMovie_setDimension(mo, 800, 600);
-       SWFMovie_setRate (mo, 1);
+       SWFMovie_setRate (mo, 2);
 
        dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 
0, 0, 800, 600);
        SWFMovie_add(mo, (SWFBlock)dejagnuclip);
@@ -110,7 +110,7 @@
 
        SWFMovie_nextFrame(mo);        
 
-       SWFDisplayItem_rotate(it, -45);
+       SWFDisplayItem_rotateTo(it, -45);
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -124,7 +124,7 @@
 
        SWFMovie_nextFrame(mo);        
 
-       SWFDisplayItem_scale(it, 2, 3);
+       SWFDisplayItem_scaleTo(it, 2, 3);
 
        check_equals(mo, "staticmc._x", "50");
        check_equals(mo, "staticmc._y", "300");
@@ -138,25 +138,122 @@
 
        SWFMovie_nextFrame(mo);        
 
-       SWFDisplayItem_skewX(it, 2);
-
-       check_equals(mo, "staticmc._x", "50");
-       check_equals(mo, "staticmc._y", "300");
-       check_equals(mo, "Math.round(staticmc._xscale)", "447");
-       check_equals(mo, "Math.round(staticmc._yscale)", "300");
-       check_equals(mo, "Math.round(staticmc._rotation*1000)", "18435");
-       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
-       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'-141.25,193.75 241.25,406.25'");
-       check_equals(mo, "staticmc._width", "382.5");
-       check_equals(mo, "staticmc._height", "212.5");
+       SWFDisplayItem_skewXTo(it, 2);
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "447");
+       check_equals(mo, "Math.round(staticmc._yscale)", "300");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "18435");
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'-141.25,193.75 241.25,406.25'");
+       check_equals(mo, "staticmc._width", "382.5");
+       check_equals(mo, "staticmc._height", "212.5");
+
+       SWFMovie_nextFrame(mo);        
+
+       SWFDisplayItem_scaleTo(it, 2, -3);
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "447");
+       check_equals(mo, "Math.round(staticmc._yscale)", "300");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "18435");
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'-141.25,193.75 241.25,406.25'");
+       check_equals(mo, "staticmc._width", "382.5");
+       check_equals(mo, "staticmc._height", "212.5");
+
+       SWFMovie_nextFrame(mo);        
+
+       SWFDisplayItem_skewXTo(it, 0);
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "200");
+       check_equals(mo, "Math.round(staticmc._yscale)", "300");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "45000");
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'-56.25,193.75 156.25,406.25'");
+       check_equals(mo, "staticmc._width", "212.5");
+       check_equals(mo, "staticmc._height", "212.5");
+
+       SWFMovie_nextFrame(mo);        
+
+       SWFDisplayItem_scaleTo(it, -2, 2);
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "200");
+       check_equals(mo, "Math.round(staticmc._yscale)", "200");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "-135000");
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", "'-35,215 
135,385'");
+       check_equals(mo, "staticmc._width", "170");
+       check_equals(mo, "staticmc._height", "170");
+
+       SWFMovie_nextFrame(mo);        
+
+       SWFDisplayItem_scaleTo(it, 1, 1);
+       SWFDisplayItem_skewXTo(it, -2);
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "100");
+       check_equals(mo, "Math.round(staticmc._yscale)", "224");
+       xcheck_equals(mo, "Math.round(staticmc._rotation*1000)", "135000"); // 
gnash gives 135001
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", "'-35,257.5 
135,342.5'");
+       check_equals(mo, "staticmc._width", "170");
+       check_equals(mo, "staticmc._height", "85");
+
+       SWFMovie_nextFrame(mo);        
+       SWFDisplayItem_setMatrix(it, 1, 0, 0, 1, 50, 300); // reset to 
near-identity
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "100");
+       check_equals(mo, "Math.round(staticmc._yscale)", "100");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "0");
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'19.95,269.95 80.05,330.05'");
+       check_equals(mo, "staticmc._width", "60.1");
+       check_equals(mo, "staticmc._height", "60.1");
+
+       SWFMovie_nextFrame(mo);        
+       SWFDisplayItem_setMatrix(it, -1, 0, 0, 1, 50, 300); // negative x scale 
gets interpreted as 180 degrees rotation
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "100");
+       check_equals(mo, "Math.round(staticmc._yscale)", "100");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "180000"); // x 
scale -1 gets interpreted as a 180 degree rotation
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'19.95,269.95 80.05,330.05'");
+       check_equals(mo, "staticmc._width", "60.1");
+       check_equals(mo, "staticmc._height", "60.1");
+
+       SWFMovie_nextFrame(mo);        
+       SWFDisplayItem_setMatrix(it, 1, 0, 0, -1, 50, 300); // negative y scale 
(discarded ?)
+
+       check_equals(mo, "staticmc._x", "50");
+       check_equals(mo, "staticmc._y", "300");
+       check_equals(mo, "Math.round(staticmc._xscale)", "100");
+       check_equals(mo, "Math.round(staticmc._yscale)", "100");
+       check_equals(mo, "Math.round(staticmc._rotation*1000)", "0"); 
+       check_equals(mo, "printBounds(staticmc.getBounds())", "'-30.05,-30.05 
30.05,30.05'");
+       check_equals(mo, "printBounds(staticmc.getBounds(_root))", 
"'19.95,269.95 80.05,330.05'");
+       check_equals(mo, "staticmc._width", "60.1");
+       check_equals(mo, "staticmc._height", "60.1");
+
 
        // TODO:
        // - test more rotations and scales (corner cases too!)
        // - test 'skew' (since Ming supports it)
 
-
-
-       add_actions(mo, "_root.totals(); stop();");
+       SWFMovie_nextFrame(mo);
+
+       add_actions(mo, "_root.totals(98); stop();");
        SWFMovie_nextFrame(mo);        
 
        //Output movie


reply via email to

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