gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9866: Reset yscale sign on setting


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9866: Reset yscale sign on setting _width
Date: Mon, 29 Sep 2008 12:22:44 -0400
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9866
committer: Sandro Santilli <address@hidden>
branch nick: gnash-head
timestamp: Mon 2008-09-29 12:22:44 -0400
message:
  Reset yscale sign on setting _width
modified:
  libcore/character.cpp
  testsuite/actionscript.all/MovieClip.as
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-09-29 13:30:44 +0000
+++ b/libcore/character.cpp     2008-09-29 16:22:44 +0000
@@ -504,10 +504,15 @@
        const double oldwidth = bounds.width();
        assert(oldwidth >= 0); // can't be negative can it?
 
-       double newscale = 100*(newwidth/oldwidth);
-       //if ( _xscale < 0 ) newscale = -newscale;
-       log_debug("setting xscale from %g to %g", _xscale, newscale);
-       set_x_scale( newscale );
+        double yscale = fabs(_yscale / 100.0); // see MovieClip.as. TODO: this 
is likely same as m.get_y_scale..
+        double xscale = (newwidth / oldwidth);
+        double rotation = _rotation * PI / 180.0;
+
+        log_debug("setting xscale from %g to %g", _xscale, xscale*100);
+
+        matrix m = get_matrix();
+        m.set_scale_rotation(xscale, yscale, rotation);
+        set_matrix(m, true); // let caches be updated
 }
 
 as_value
@@ -556,10 +561,15 @@
        const double oldheight = bounds.height();
        assert(oldheight >= 0); // can't be negative can it?
 
-       double newscale = 100 * (newheight / oldheight);
-       //if ( _yscale < 0 ) newscale = -newscale;
-       log_debug("setting yscale from %g to %g", _yscale, newscale);
-       set_y_scale( newscale );
+        double yscale = (newheight / oldheight);
+        double xscale = _xscale / 100.0;
+        double rotation = _rotation * PI / 180.0;
+
+        log_debug("setting yscale from %g to %g", _yscale, yscale*100);
+
+        matrix m = get_matrix();
+        m.set_scale_rotation(xscale, yscale, rotation);
+        set_matrix(m, true); // let caches be updated
 }
 
 as_value

=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as   2008-09-29 14:40:03 +0000
+++ b/testsuite/actionscript.all/MovieClip.as   2008-09-29 16:22:44 +0000
@@ -1187,16 +1187,16 @@
 draw._width = 10;
 check_equals(draw._width, 10);
 check_equals(draw._xscale, 100); // reset to positive on setting _width
-xcheck_equals(draw._yscale, 50); // reset to positive on setting _width !
+check_equals(draw._yscale, 50); // reset to positive on setting _width !
 
 #if OUTPUT_VERSION >= 8
-xcheck_equals(printMatrix(draw.transform.matrix, 2), "(a=1, b=0, c=0, d=0.5, 
tx=0, ty=0)");
+check_equals(printMatrix(draw.transform.matrix, 2), "(a=1, b=0, c=0, d=0.5, 
tx=0, ty=0)");
 #endif
 b = draw.getBounds(container); // these are transformed by container draw 
matrix
-xcheck_equals(b.xMin, 10);
-xcheck_equals(b.xMax, 20);
-xcheck_equals(b.yMin, 5);
-xcheck_equals(b.yMax, 15);
+check_equals(b.xMin, 10);
+check_equals(b.xMax, 20);
+check_equals(b.yMin, 5);
+check_equals(b.yMax, 15);
 
 draw._height = 10; // TODO: dumb check, it's 10 already !!
 check_equals(draw._yscale, 50); // was already positive


reply via email to

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