[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10032: Tests for missing Transform
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10032: Tests for missing Transform elements. |
Date: |
Tue, 21 Oct 2008 15:37:16 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10032
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-10-21 15:37:16 +0200
message:
Tests for missing Transform elements.
modified:
libcore/sprite_instance.cpp
testsuite/actionscript.all/MovieClip.as
testsuite/actionscript.all/Transform.as
------------------------------------------------------------
revno: 10029.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-10-21 14:12:11 +0200
message:
Use TWIPS_TO_PIXELS
modified:
libcore/sprite_instance.cpp
------------------------------------------------------------
revno: 10029.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Tue 2008-10-21 14:28:41 +0200
message:
Tests for more Transform elements.
modified:
testsuite/actionscript.all/MovieClip.as
testsuite/actionscript.all/Transform.as
=== modified file 'libcore/sprite_instance.cpp'
--- a/libcore/sprite_instance.cpp 2008-10-20 10:09:22 +0000
+++ b/libcore/sprite_instance.cpp 2008-10-21 12:12:11 +0000
@@ -1074,10 +1074,10 @@
if ( !bounds.is_null() )
{
// Round to the twip
- xMin = bounds.get_x_min() / 20.0;
- yMin = bounds.get_y_min() / 20.0;
- xMax = bounds.get_x_max() / 20.0;
- yMax = bounds.get_y_max() / 20.0;
+ xMin = TWIPS_TO_PIXELS(bounds.get_x_min());
+ yMin = TWIPS_TO_PIXELS(bounds.get_y_min());
+ xMax = TWIPS_TO_PIXELS(bounds.get_x_max());
+ yMax = TWIPS_TO_PIXELS(bounds.get_y_max());
}
boost::intrusive_ptr<as_object> bounds_obj(new as_object());
@@ -1726,9 +1726,9 @@
ObjPtr colors = fn.arg(1).to_object();
ObjPtr alphas = fn.arg(2).to_object();
ObjPtr ratios = fn.arg(3).to_object();
- ObjPtr SWFMatrixArg = fn.arg(4).to_object();
+ ObjPtr matrixArg = fn.arg(4).to_object();
- if ( ! colors || ! alphas || ! ratios || ! SWFMatrixArg )
+ if ( ! colors || ! alphas || ! ratios || ! matrixArg )
{
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss; fn.dump_args(ss);
@@ -1762,14 +1762,14 @@
SWFMatrix mat;
SWFMatrix input_matrix;
- if ( SWFMatrixArg->getMember(NSV::PROP_MATRIX_TYPE).to_string() == "box" )
+ if ( matrixArg->getMember(NSV::PROP_MATRIX_TYPE).to_string() == "box" )
{
- boost::int32_t valX =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_X).to_number());
- boost::int32_t valY =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_Y).to_number());
- boost::int32_t valW =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_W).to_number());
- boost::int32_t valH =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_H).to_number());
- float valR = SWFMatrixArg->getMember(NSV::PROP_R).to_number();
+ boost::int32_t valX =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_X).to_number());
+ boost::int32_t valY =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_Y).to_number());
+ boost::int32_t valW =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_W).to_number());
+ boost::int32_t valH =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_H).to_number());
+ float valR = matrixArg->getMember(NSV::PROP_R).to_number();
if ( radial )
{
@@ -1802,12 +1802,12 @@
}
else
{
- float valA = SWFMatrixArg->getMember(NSV::PROP_A).to_number() ; // xx
- float valB = SWFMatrixArg->getMember(NSV::PROP_B).to_number() ; // yx
- float valD = SWFMatrixArg->getMember(NSV::PROP_D).to_number() ; // xy
- float valE = SWFMatrixArg->getMember(NSV::PROP_E).to_number() ; // yy
- boost::int32_t valG =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_G).to_number()); // x0
- boost::int32_t valH =
PIXELS_TO_TWIPS(SWFMatrixArg->getMember(NSV::PROP_H).to_number()); // y0
+ float valA = matrixArg->getMember(NSV::PROP_A).to_number() ; // xx
+ float valB = matrixArg->getMember(NSV::PROP_B).to_number() ; // yx
+ float valD = matrixArg->getMember(NSV::PROP_D).to_number() ; // xy
+ float valE = matrixArg->getMember(NSV::PROP_E).to_number() ; // yy
+ boost::int32_t valG =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_G).to_number()); // x0
+ boost::int32_t valH =
PIXELS_TO_TWIPS(matrixArg->getMember(NSV::PROP_H).to_number()); // y0
input_matrix.sx = valA * 65536; // sx
input_matrix.shx = valB * 65536; // shy
@@ -2229,12 +2229,9 @@
o.init_property("_lockroot", &sprite_instance::lockroot_getset,
&sprite_instance::lockroot_getset); // see
MovieClip.as testcase
- // This is documented to be SWF8+ only, but the pp version9 shows it
+ // These are documented to be SWF8+ only, but the pp version9 shows them
// for SWF5 too...
o.init_member("attachBitmap", new builtin_function(sprite_attachBitmap));
-
- // This is documented to be SWF8+ only, but the pp version9 shows it
- // for SWF5 too...
o.init_property("transform", &movieClip_transform, &movieClip_transform);
// see MovieClip.as testcase
if ( target_version < 6 ) return;
=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as 2008-10-20 15:13:51 +0000
+++ b/testsuite/actionscript.all/MovieClip.as 2008-10-21 12:28:41 +0000
@@ -95,15 +95,15 @@
#endif
#if OUTPUT_VERSION == 6
- check_totals(749); // SWF6
+ check_totals(757); // SWF6
#endif
#if OUTPUT_VERSION == 7
- check_totals(766); // SWF7
+ check_totals(774); // SWF7
#endif
#if OUTPUT_VERSION >= 8
- check_totals(824); // SWF8+
+ check_totals(840); // SWF8+
#endif
play();
@@ -1053,17 +1053,33 @@
}
check_equals(draw._width, 10);
check_equals(draw._height, 20);
+
+// getRect and getBounds are the same in this case.
+
+c = draw.getRect();
+xcheck_equals(c.xMin, 10);
+xcheck_equals(c.xMax, 20);
+xcheck_equals(c.yMin, 10);
+xcheck_equals(c.yMax, 30);
+
b = draw.getBounds();
check_equals(b.xMin, 10);
check_equals(b.xMax, 20);
check_equals(b.yMin, 10);
check_equals(b.yMax, 30);
+
b = draw.getBounds(container);
check_equals(b.xMin, 10);
check_equals(b.xMax, 20);
check_equals(b.yMin, 10);
check_equals(b.yMax, 30);
+c = draw.getRect(container);
+xcheck_equals(c.xMin, 10);
+xcheck_equals(c.xMax, 20);
+xcheck_equals(c.yMin, 10);
+xcheck_equals(c.yMax, 30);
+
draw._x += 20;
b = draw.getBounds();
check_equals(b.xMin, 10);
@@ -1524,14 +1540,17 @@
_root._y = 20;
check_equals(_root.transform.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=30,
ty=20)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=27, y=27, w=799,
h=842)");
_root._xscale = -300;
check_equals(_root.transform.matrix.toString(), "(a=-3, b=0, c=0, d=1, tx=30,
ty=20)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-2361, y=27, w=2397,
h=842)");
_root._yscale = -200;
check_equals(_root.transform.matrix.toString(), "(a=-3, b=0, c=0, d=-2, tx=30,
ty=20)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-2361, y=-1671,
w=2397, h=1684)");
_root._rotation = -90;
@@ -1541,24 +1560,28 @@
check_equals(_root.transform.matrix.d, 0);
check_equals(_root.transform.matrix.tx, 30);
check_equals(_root.transform.matrix.ty, 20);
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-1663, y=16, w=1684,
h=2397)");
// TODO: test concatenatedMatrix
_root.transform.matrix.ty = 300;
check_equals(_root._y, 20); // changing the AS matrix doesn't change the
actual matrix
check_equals(_root.transform.matrix.toString(), "(a=0, b=3, c=-2, d=0, tx=30,
ty=20)");
-
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-1663, y=16, w=1684,
h=2397)");
_root._x = _root._y = _root._rotation = 0;
check_equals(_root.transform.matrix.toString(), "(a=-3, b=0, c=0, d=-2, tx=0,
ty=0)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-2391, y=-1691,
w=2397, h=1684)");
_root._xscale = 100;
check_equals(_root.transform.matrix.toString(), "(a=1, b=0, c=0, d=-2, tx=0,
ty=0)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-2, y=-1691, w=799,
h=1684)");
_root._yscale = 100;
check_equals(_root.transform.matrix.toString(), "(a=1, b=0, c=0, d=1, tx=0,
ty=0)");
+xcheck_equals(_root.transform.pixelBounds.toString(), "(x=-2, y=7, w=799,
h=842)");
OldTransform = flash.geom.Transform;
@@ -1573,7 +1596,6 @@
flash.geom.Transform = OldTransform;
check_equals(_root.transform.toString(), "[object Object]");
-
#endif
//----------------------------------------------
=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as 2008-09-30 07:13:45 +0000
+++ b/testsuite/actionscript.all/Transform.as 2008-10-21 12:28:41 +0000
@@ -210,5 +210,19 @@
xcheck_equals(mcOld.transform.matrix.toString(), "(a=4, b=0.300000011920929,
c=0.300000011920929, d=1, tx=1, ty=0)");
-totals(70);
+// Concatenated transform. Does this make any sense?
+
+conc1 = _root.createEmptyMovieClip("conc1", getNextHighestDepth());
+conc2 = conc1.createEmptyMovieClip("conc2", getNextHighestDepth());
+
+conc1._x = 1.5;
+conc2._x = 0.3;
+xcheck_equals(conc1.transform.concatenatedMatrix.toString(),
"(a=0.993750035762787, b=0, c=0, d=0.993750035762787, tx=1.5, ty=2)");
+xcheck_equals(conc2.transform.concatenatedMatrix.toString(),
"(a=0.993750035762787, b=0, c=0, d=0.993750035762787, tx=1.75, ty=2)");
+conc2._width = 3;
+conc1._height = 0.6;
+xcheck_equals(conc1.transform.concatenatedMatrix.toString(), "(a=0, b=0, c=0,
d=0, tx=1.5, ty=2)");
+xcheck_equals(conc2.transform.concatenatedMatrix.toString(), "(a=0, b=0, c=0,
d=0, tx=1.5, ty=2)");
+
+totals(74);
#endif
- [Gnash-commit] /srv/bzr/gnash/trunk r10032: Tests for missing Transform elements.,
Benjamin Wolsey <=