[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/namedStrings.cpp server/...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/namedStrings.cpp server/... |
Date: |
Sat, 07 Jun 2008 12:11:34 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/06/07 12:11:34
Modified files:
. : ChangeLog
server : namedStrings.cpp namedStrings.h
server/asobj/flash/geom: Matrix_as.cpp Matrix_as.h Point_as.cpp
Point_as.h
testsuite/actionscript.all: Matrix.as case.as
Log message:
* server/asobj/flash/geom/Point_as{h,cpp}: move class
declaration
to header, as Matrix_as needs to construct points.
* server/asobj/flash/geom/Matrix_as.{cpp,h}: implement
getter/setters,
deltaTransformPoint, scale, rotate, identity, translate (also
clone, but this is untested).
* server/namedStrings.{cpp,h}: add named properties to string
table.
This breaks something in the testsuite (because the .a
property is
now a named string), but is not a new bug; it confirms the
implementation problem. If 'X' or 'Y' rather than 'A' were
tested
in the testsuite, the same failure would already be there.
* testsuite/actionscript.all/Matrix_as: lots of test passes.
* testsuite/actionscript.all/case.as: expect failures for SWF6
and
below.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6852&r2=1.6853
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.h?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Matrix_as.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Matrix_as.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.h?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Matrix.as?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/case.as?cvsroot=gnash&r1=1.20&r2=1.21
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6852
retrieving revision 1.6853
diff -u -b -r1.6852 -r1.6853
--- ChangeLog 7 Jun 2008 09:36:32 -0000 1.6852
+++ ChangeLog 7 Jun 2008 12:11:33 -0000 1.6853
@@ -1,5 +1,21 @@
2008-06-07 Benjamin Wolsey <address@hidden>
+ * server/asobj/flash/geom/Point_as{h,cpp}: move class declaration
+ to header, as Matrix_as needs to construct points.
+ * server/asobj/flash/geom/Matrix_as.{cpp,h}: implement getter/setters,
+ deltaTransformPoint, scale, rotate, identity, translate (also
+ clone, but this is untested).
+ * server/namedStrings.{cpp,h}: add named properties to string table.
+ This breaks something in the testsuite (because the .a property is
+ now a named string), but is not a new bug; it confirms the
+ implementation problem. If 'X' or 'Y' rather than 'A' were tested
+ in the testsuite, the same failure would already be there.
+ * testsuite/actionscript.all/Matrix_as: lots of test passes.
+ * testsuite/actionscript.all/case.as: expect failures for SWF6 and
+ below.
+
+2008-06-07 Benjamin Wolsey <address@hidden>
+
* testsuite/actionscript.all/Matrix.as: add tests for the
flash.geom.Matrix object (which is an ActionScript matrix of
double-precision values and nothing to do with Zou's matrices).
Index: server/namedStrings.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/namedStrings.cpp 17 May 2008 15:48:12 -0000 1.19
+++ server/namedStrings.cpp 7 Jun 2008 12:11:33 -0000 1.20
@@ -31,18 +31,22 @@
// Load up our pre-known names
static string_table::svt preload_names[] =
{
+ string_table::svt( "a", NSV::PROP_A ),
string_table::svt( "addListener", NSV::PROP_ADD_LISTENER ),
string_table::svt( "align", NSV::PROP_ALIGN ),
string_table::svt( "_alpha", NSV::PROP_uALPHA ),
+ string_table::svt( "b", NSV::PROP_B ),
string_table::svt( "blockIndent", NSV::PROP_BLOCK_INDENT ),
string_table::svt( "bold", NSV::PROP_BOLD ),
string_table::svt( "broadcastMessage", NSV::PROP_BROADCAST_MESSAGE ),
string_table::svt( "bullet", NSV::PROP_BULLET ),
+ string_table::svt( "c", NSV::PROP_C ),
string_table::svt( "callee", NSV::PROP_CALLEE ),
//string_table::svt( "color", NSV::PROP_COLOR ), // clashes with
CLASS_COLOR in case-insensitive mode
string_table::svt( "constructor", NSV::PROP_CONSTRUCTOR ),
string_table::svt( "__constructor__", NSV::PROP_uuCONSTRUCTORuu ),
string_table::svt( "_currentframe", NSV::PROP_uCURRENTFRAME ),
+ string_table::svt( "d", NSV::PROP_D ),
string_table::svt( "_droptarget", NSV::PROP_uDROPTARGET ),
string_table::svt( "enabled", NSV::PROP_ENABLED ),
string_table::svt( "useHandCursor", NSV::PROP_USEHANDCURSOR ),
@@ -122,6 +126,8 @@
string_table::svt( "textHeight", NSV::PROP_TEXT_HEIGHT ),
string_table::svt( "toString", NSV::PROP_TO_STRING ),
string_table::svt( "_totalframes", NSV::PROP_uTOTALFRAMES ),
+ string_table::svt( "tx", NSV::PROP_TX ),
+ string_table::svt( "ty", NSV::PROP_TY ),
string_table::svt( "underline", NSV::PROP_UNDERLINE ),
string_table::svt( "_url", NSV::PROP_uURL ),
string_table::svt( "valueOf", NSV::PROP_VALUE_OF ),
Index: server/namedStrings.h
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/namedStrings.h 17 May 2008 15:48:12 -0000 1.19
+++ server/namedStrings.h 7 Jun 2008 12:11:33 -0000 1.20
@@ -49,18 +49,22 @@
namespace NSV {
typedef enum {
- PROP_ADD_LISTENER = 1,
+ PROP_A = 1,
+ PROP_ADD_LISTENER,
PROP_ALIGN,
PROP_uALPHA,
+ PROP_B,
PROP_BLOCK_INDENT,
PROP_BOLD,
PROP_BROADCAST_MESSAGE,
PROP_BULLET,
+ PROP_C,
PROP_CALLEE,
//PROP_COLOR, // clashes with CLASS_COLOR in case-insensitive
mode
PROP_CONSTRUCTOR,
PROP_uuCONSTRUCTORuu,
PROP_uCURRENTFRAME,
+ PROP_D,
PROP_uDROPTARGET,
PROP_ENABLED,
PROP_USEHANDCURSOR,
@@ -141,6 +145,8 @@
PROP_TEXT_HEIGHT,
PROP_TO_STRING,
PROP_uTOTALFRAMES,
+ PROP_TX,
+ PROP_TY,
PROP_UNDERLINE,
PROP_uURL,
PROP_VALUE_OF,
Index: server/asobj/flash/geom/Matrix_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Matrix_as.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/flash/geom/Matrix_as.cpp 7 May 2008 10:38:08 -0000
1.6
+++ server/asobj/flash/geom/Matrix_as.cpp 7 Jun 2008 12:11:33 -0000
1.7
@@ -30,9 +30,20 @@
#include "GnashException.h" // for ActionException
#include "Object.h" // for AS inheritance
#include "VM.h" // for addStatics
+#include "Point_as.h" // Matrix needs to operate on Points.
+#include <cmath>
+#include <limits>
+#include <boost/numeric/ublas/matrix.hpp> // boost matrix
+#include <boost/numeric/ublas/io.hpp>
#include <sstream>
+// A transformation matrix for affine transformations:
+// a b tx
+// c d ty
+// 0 0 1
+// The matrix can only operate in 2d space.
+
namespace gnash {
static as_value Matrix_clone(const fn_call& fn);
@@ -60,24 +71,20 @@
static void
attachMatrixInterface(as_object& o)
{
- o.init_member("clone", new builtin_function(Matrix_clone));
- o.init_member("concat", new builtin_function(Matrix_concat));
- o.init_member("createBox", new builtin_function(Matrix_createBox));
- o.init_member("createGradientBox", new
builtin_function(Matrix_createGradientBox));
- o.init_member("deltaTransformPoint", new
builtin_function(Matrix_deltaTransformPoint));
- o.init_member("identity", new builtin_function(Matrix_identity));
- o.init_member("invert", new builtin_function(Matrix_invert));
- o.init_member("rotate", new builtin_function(Matrix_rotate));
- o.init_member("scale", new builtin_function(Matrix_scale));
- o.init_member("toString", new builtin_function(Matrix_toString));
- o.init_member("transformPoint", new
builtin_function(Matrix_transformPoint));
- o.init_member("translate", new builtin_function(Matrix_translate));
- o.init_property("a", Matrix_a_getset, Matrix_a_getset);
- o.init_property("b", Matrix_b_getset, Matrix_b_getset);
- o.init_property("c", Matrix_c_getset, Matrix_c_getset);
- o.init_property("d", Matrix_d_getset, Matrix_d_getset);
- o.init_property("tx", Matrix_tx_getset, Matrix_tx_getset);
- o.init_property("ty", Matrix_ty_getset, Matrix_ty_getset);
+ int fl = 0;
+
+ o.init_member("clone", new builtin_function(Matrix_clone), fl);
+ o.init_member("concat", new builtin_function(Matrix_concat), fl);
+ o.init_member("createBox", new builtin_function(Matrix_createBox), fl);
+ o.init_member("createGradientBox", new
builtin_function(Matrix_createGradientBox), fl);
+ o.init_member("deltaTransformPoint", new
builtin_function(Matrix_deltaTransformPoint), fl);
+ o.init_member("identity", new builtin_function(Matrix_identity), fl);
+ o.init_member("invert", new builtin_function(Matrix_invert), fl);
+ o.init_member("rotate", new builtin_function(Matrix_rotate), fl);
+ o.init_member("scale", new builtin_function(Matrix_scale), fl);
+ o.init_member("toString", new builtin_function(Matrix_toString), fl);
+ o.init_member("transformPoint", new
builtin_function(Matrix_transformPoint), fl);
+ o.init_member("translate", new builtin_function(Matrix_translate), fl);
}
static void
@@ -93,8 +100,7 @@
if ( ! o )
{
- // TODO: check if this class should inherit from Object
- // or from a different class
+ // Inherits from Object.
o = new as_object(getObjectInterface());
VM::get().addStatic(o.get());
@@ -113,23 +119,40 @@
Matrix_as()
:
as_object(getMatrixInterface())
- {}
+ {
+ }
// override from as_object ?
//std::string get_text_value() const { return "Matrix"; }
// override from as_object ?
//double get_numeric_value() const { return 0; }
-};
+};
+/// Return an exact copy of the matrix.
static as_value
Matrix_clone(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
+
+ as_value a, b, c, d, tx, ty;
+ ptr->get_member(NSV::PROP_A, &a);
+ ptr->get_member(NSV::PROP_B, &b);
+ ptr->get_member(NSV::PROP_C, &c);
+ ptr->get_member(NSV::PROP_D, &d);
+ ptr->get_member(NSV::PROP_TX, &tx);
+ ptr->get_member(NSV::PROP_TY, &ty);
+
+ boost::intrusive_ptr<as_object> ret = new Matrix_as;
+ ret->set_member(NSV::PROP_A, a);
+ ret->set_member(NSV::PROP_B, b);
+ ret->set_member(NSV::PROP_C, c);
+ ret->set_member(NSV::PROP_D, d);
+ ret->set_member(NSV::PROP_TX, tx);
+ ret->set_member(NSV::PROP_TY, ty);
+
+ return as_value(ret.get());
}
static as_value
@@ -159,21 +182,104 @@
return as_value();
}
+
+/// Transform the point using a Matrix. The translation
+/// elements (tx, ty) do not have any effect.
+///
+/// Returns a new Point, leaving the object passed untouched.
static as_value
Matrix_deltaTransformPoint(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if (fn.nargs != 1)
+ {
+ //log error
return as_value();
+ }
+
+ const as_value& arg = fn.arg(0);
+
+ if ( ! arg.is_object() )
+ {
+ /// Isn't an object...
+ IF_VERBOSE_ASCODING_ERRORS(
+ std::ostringstream ss;
+ fn.dump_args(ss);
+ log_aserror("Matrix.deltaTransformPoint(%s): needs an
object", ss.str());
+ );
+ return as_value();
+ }
+
+ as_object* obj = arg.to_object().get();
+ assert(obj);
+ if ( ! obj->instanceOf(getFlashGeomPointConstructor()) )
+ {
+ /// Isn't a point.
+ IF_VERBOSE_ASCODING_ERRORS(
+ std::ostringstream ss;
+ fn.dump_args(ss);
+ log_aserror("Matrix.deltaTransformPoint(%s): object must be
a Point", ss.str());
+ );
+ return as_value();
+ }
+
+ // Get the point co-ordinates.
+ as_value x, y;
+
+ obj->get_member(NSV::PROP_X, &x);
+ obj->get_member(NSV::PROP_Y, &y);
+
+ // Get the matrix elements to use as a transformation matrix.
+ as_value a, b, c, d;
+
+ ptr->get_member(NSV::PROP_A, &a);
+ ptr->get_member(NSV::PROP_B, &b);
+ ptr->get_member(NSV::PROP_C, &c);
+ ptr->get_member(NSV::PROP_D, &d);
+
+ // Construct the matrix
+ boost::numeric::ublas::c_matrix<double, 2, 2> transformMatrix;
+ transformMatrix(0, 0) = a.to_number();
+ transformMatrix(0, 1) = b.to_number();
+ transformMatrix(1, 0) = c.to_number();
+ transformMatrix(1, 1) = d.to_number();
+
+ // Construct the point
+ boost::numeric::ublas::vector<double> point(2);
+ point(0) = x.to_number();
+ point(1) = y.to_number();
+
+ // Transform
+ point = boost::numeric::ublas::prod(point, transformMatrix);
+
+ // Return new point
+ boost::intrusive_ptr<as_object> ret = new Point_as;
+ ret->set_member(NSV::PROP_X, point(0));
+ ret->set_member(NSV::PROP_Y, point(1));
+
+ return as_value(ret.get());
}
+
+/// Reset the matrix to a null-transformation
+///
+/// | 1 0 0 |
+/// | 0 1 0 |
+///
+/// Returns void.
static as_value
Matrix_identity(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ ptr->set_member(NSV::PROP_A, as_value(1.0));
+ ptr->set_member(NSV::PROP_B, as_value(0.0));
+ ptr->set_member(NSV::PROP_C, as_value(0.0));
+ ptr->set_member(NSV::PROP_D, as_value(1.0));
+ ptr->set_member(NSV::PROP_TX, as_value(0.0));
+ ptr->set_member(NSV::PROP_TY, as_value(0.0));
+
return as_value();
}
@@ -190,8 +296,58 @@
Matrix_rotate(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if (fn.nargs == 1)
+ {
+ // Make rotation matrix
+ boost::numeric::ublas::c_matrix<double, 2, 2> transformMatrix;
+
+ const double rot = fn.arg(0).to_number();
+
+ transformMatrix(0, 0) = std::cos(rot);
+ transformMatrix(0, 1) = std::sin(rot);
+ transformMatrix(1, 0) = -std::sin(rot);
+ transformMatrix(1, 1) = std::cos(rot);
+
+ // Get current matrix
+ boost::numeric::ublas::c_matrix<double, 2, 2> currentMatrix;
+
+ as_value a, b, c, d, tx, ty;
+
+ ptr->get_member(NSV::PROP_A, &a);
+ ptr->get_member(NSV::PROP_B, &b);
+ ptr->get_member(NSV::PROP_C, &c);
+ ptr->get_member(NSV::PROP_D, &d);
+ ptr->get_member(NSV::PROP_TX, &tx);
+ ptr->get_member(NSV::PROP_TY, &ty);
+
+ currentMatrix(0, 0) = a.to_number();
+ currentMatrix(0, 1) = b.to_number();
+ currentMatrix(1, 0) = c.to_number();
+ currentMatrix(1, 1) = d.to_number();
+
+ // Apply rotation to current matrix.
+ currentMatrix = boost::numeric::ublas::prod(currentMatrix,
transformMatrix);
+
+ log_debug("Modified matrix: %s", currentMatrix);
+ log_debug("Transformation matrix%s", transformMatrix);
+
+ ptr->set_member(NSV::PROP_A, as_value(currentMatrix(0, 0)));
+ ptr->set_member(NSV::PROP_B, as_value(currentMatrix(0, 1)));
+ ptr->set_member(NSV::PROP_C, as_value(currentMatrix(1, 0)));
+ ptr->set_member(NSV::PROP_D, as_value(currentMatrix(1, 1)));
+
+ // Do rotation separately.
+ boost::numeric::ublas::vector<double> translation(2);
+ translation(0) = tx.to_number();
+ translation(1) = ty.to_number();
+
+ translation = boost::numeric::ublas::prod(translation,
transformMatrix);
+
+ ptr->set_member(NSV::PROP_TX, as_value(translation(0)));
+ ptr->set_member(NSV::PROP_TY, as_value(translation(1)));
+ }
+
return as_value();
}
@@ -199,8 +355,51 @@
Matrix_scale(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+ if (fn.nargs == 2)
+ {
+ // Make scale matrix
+ boost::numeric::ublas::c_matrix<double, 2, 2> transformMatrix;
+
+ const double scaleX = fn.arg(0).to_number();
+ const double scaleY = fn.arg(1).to_number();
+
+ transformMatrix(0, 0) = scaleX;
+ transformMatrix(0, 1) = 0.0;
+ transformMatrix(1, 0) = 0.0;
+ transformMatrix(1, 1) = scaleY;
+
+ // Get current matrix
+ boost::numeric::ublas::c_matrix<double, 2, 2> currentMatrix;
+
+ as_value a, b, c, d, tx, ty;
+
+ ptr->get_member(NSV::PROP_A, &a);
+ ptr->get_member(NSV::PROP_B, &b);
+ ptr->get_member(NSV::PROP_C, &c);
+ ptr->get_member(NSV::PROP_D, &d);
+ ptr->get_member(NSV::PROP_TX, &tx);
+ ptr->get_member(NSV::PROP_TY, &ty);
+
+ currentMatrix(0, 0) = a.to_number();
+ currentMatrix(0, 1) = b.to_number();
+ currentMatrix(1, 0) = c.to_number();
+ currentMatrix(1, 1) = d.to_number();
+
+ log_debug("%s - %s", currentMatrix, transformMatrix);
+
+ // Apply scale to current matrix.
+ currentMatrix = boost::numeric::ublas::prod(currentMatrix,
transformMatrix);
+
+ ptr->set_member(NSV::PROP_A, as_value(currentMatrix(0, 0)));
+ ptr->set_member(NSV::PROP_B, as_value(currentMatrix(0, 1)));
+ ptr->set_member(NSV::PROP_C, as_value(currentMatrix(1, 0)));
+ ptr->set_member(NSV::PROP_D, as_value(currentMatrix(1, 1)));
+
+ // This isn't how to multiply matrices...
+ ptr->set_member(NSV::PROP_TX, as_value(tx.to_number() * scaleX));
+ ptr->set_member(NSV::PROP_TY, as_value(ty.to_number() * scaleY));
+ }
+
return as_value();
}
@@ -208,9 +407,26 @@
Matrix_toString(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
+
+ as_value a, b, c, d, tx, ty;
+
+ ptr->get_member(NSV::PROP_A, &a);
+ ptr->get_member(NSV::PROP_B, &b);
+ ptr->get_member(NSV::PROP_C, &c);
+ ptr->get_member(NSV::PROP_D, &d);
+ ptr->get_member(NSV::PROP_TX, &tx);
+ ptr->get_member(NSV::PROP_TY, &ty);
+
+ std::ostringstream ss;
+
+ ss << "(a=" << a.to_string() << ", "
+ "b="<< b.to_string() << ", "
+ "c="<< c.to_string() << ", "
+ "d="<< d.to_string() << ", "
+ "tx="<< tx.to_string() << ", "
+ "ty="<< ty.to_string() << ")";
+
+ return as_value(ss.str());
}
static as_value
@@ -226,8 +442,20 @@
Matrix_translate(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+ if (fn.nargs == 2)
+ {
+
+ as_value tx, ty;
+
+ ptr->get_member(NSV::PROP_TX, &tx);
+ ptr->get_member(NSV::PROP_TY, &ty);
+
+ double transX = fn.arg(0).to_number() + tx.to_number();
+ double transY = fn.arg(1).to_number() + ty.to_number();
+
+ ptr->set_member(NSV::PROP_TX, as_value(transX));
+ ptr->set_member(NSV::PROP_TY, as_value(transY));
+ }
return as_value();
}
@@ -235,8 +463,19 @@
Matrix_a_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value a;
+ ptr->get_member(NSV::PROP_A, &a);
+ return a;
+ }
+ else // setter
+ {
+ as_value a = fn.arg(0);
+ ptr->set_member(NSV::PROP_A, a);
+ }
+
return as_value();
}
@@ -244,8 +483,19 @@
Matrix_b_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value b;
+ ptr->get_member(NSV::PROP_B, &b);
+ return b;
+ }
+ else // setter
+ {
+ as_value b = fn.arg(0);
+ ptr->set_member(NSV::PROP_B, b);
+ }
+
return as_value();
}
@@ -253,8 +503,19 @@
Matrix_c_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value c;
+ ptr->get_member(NSV::PROP_C, &c);
+ return c;
+ }
+ else // setter
+ {
+ as_value c = fn.arg(0);
+ ptr->set_member(NSV::PROP_C, c);
+ }
+
return as_value();
}
@@ -262,8 +523,19 @@
Matrix_d_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value d;
+ ptr->get_member(NSV::PROP_D, &d);
+ return d;
+ }
+ else // setter
+ {
+ as_value d = fn.arg(0);
+ ptr->set_member(NSV::PROP_D, d);
+ }
+
return as_value();
}
@@ -271,8 +543,19 @@
Matrix_tx_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value tx;
+ ptr->get_member(NSV::PROP_TX, &tx);
+ return tx;
+ }
+ else // setter
+ {
+ as_value tx = fn.arg(0);
+ ptr->set_member(NSV::PROP_TX, tx);
+ }
+
return as_value();
}
@@ -280,8 +563,19 @@
Matrix_ty_getset(const fn_call& fn)
{
boost::intrusive_ptr<Matrix_as> ptr =
ensureType<Matrix_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ if ( ! fn.nargs ) // getter
+ {
+ as_value ty;
+ ptr->get_member(NSV::PROP_TY, &ty);
+ return ty;
+ }
+ else // setter
+ {
+ as_value ty = fn.arg(0);
+ ptr->set_member(NSV::PROP_TY, ty);
+ }
+
return as_value();
}
@@ -292,27 +586,77 @@
{
boost::intrusive_ptr<as_object> obj = new Matrix_as;
- if ( fn.nargs )
+ as_value a, b, c, d, tx, ty;
+
+ if ( ! fn.nargs )
{
- std::stringstream ss;
- fn.dump_args(ss);
- LOG_ONCE( log_unimpl("Matrix(%s): %s", ss.str(), _("arguments
discarded")) );
+ a.set_double(1);
+ b.set_double(0);
+ c.set_double(0);
+ d.set_double(1);
+ tx.set_double(0);
+ ty.set_double(0);
+ }
+ else
+ {
+ switch (fn.nargs)
+ {
+ default:
+ // Log as coding error
+ case 6:
+ ty = fn.arg(5);
+ case 5:
+ tx = fn.arg(4);
+ case 4:
+ d = fn.arg(3);
+ case 3:
+ c = fn.arg(2);
+ case 2:
+ b = fn.arg(1);
+ case 1:
+ a = fn.arg(0);
+ break;
}
+ }
+
+ obj->set_member(NSV::PROP_TY, ty);
+ obj->set_member(NSV::PROP_TX, tx);
+ obj->set_member(NSV::PROP_D, d);
+ obj->set_member(NSV::PROP_C, c);
+ obj->set_member(NSV::PROP_B, b);
+ obj->set_member(NSV::PROP_A, a);
+
return as_value(obj.get()); // will keep alive
}
+as_function* getFlashGeomMatrixConstructor()
+{
+ static builtin_function* cl = NULL;
+ if ( ! cl )
+ {
+ cl=new builtin_function(&Matrix_ctor, getMatrixInterface());
+ VM::get().addStatic(cl);
+ attachMatrixStaticProperties(*cl);
+ }
+ return cl;
+}
+
+static as_value
+get_flash_geom_matrix_constructor(const fn_call& /*fn*/)
+{
+ log_debug("Loading flash.geom.Matrix class");
+
+ return getFlashGeomMatrixConstructor();
+}
+
// extern
void Matrix_class_init(as_object& where)
{
// This is going to be the Matrix "class"/"function"
// in the 'where' package
- boost::intrusive_ptr<builtin_function> cl;
- cl=new builtin_function(&Matrix_ctor, getMatrixInterface());
- attachMatrixStaticProperties(*cl);
-
- // Register _global.Matrix
- where.init_member("Matrix", cl.get());
+ string_table& st = where.getVM().getStringTable();
+ where.init_destructive_property(st.find("Matrix"),
get_flash_geom_matrix_constructor);
}
} // end of gnash namespace
Index: server/asobj/flash/geom/Matrix_as.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Matrix_as.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/flash/geom/Matrix_as.h 5 May 2008 08:57:32 -0000 1.1
+++ server/asobj/flash/geom/Matrix_as.h 7 Jun 2008 12:11:33 -0000 1.2
@@ -17,8 +17,8 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifndef __GNASH_ASOBJ_MATRIX_H__
-#define __GNASH_ASOBJ_MATRIX_H__
+#ifndef GNASH_ASOBJ_MATRIX_H
+#define GNASH_ASOBJ_MATRIX_H
#ifdef HAVE_CONFIG_H
#include "gnashconfig.h"
Index: server/asobj/flash/geom/Point_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/asobj/flash/geom/Point_as.cpp 19 May 2008 17:06:38 -0000
1.14
+++ server/asobj/flash/geom/Point_as.cpp 7 Jun 2008 12:11:34 -0000
1.15
@@ -89,22 +89,12 @@
return o.get();
}
-class Point_as: public as_object
-{
-
-public:
-
- Point_as()
+Point_as::Point_as()
:
as_object(getPointInterface())
- {}
-
- // override from as_object ?
- //std::string get_text_value() const { return "Point"; }
+{
+}
- // override from as_object ?
- //double get_numeric_value() const { return 0; }
-};
static as_value
Index: server/asobj/flash/geom/Point_as.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/asobj/flash/geom/Point_as.h 7 May 2008 08:03:40 -0000 1.2
+++ server/asobj/flash/geom/Point_as.h 7 Jun 2008 12:11:34 -0000 1.3
@@ -17,8 +17,10 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifndef __GNASH_ASOBJ_POINT_H__
-#define __GNASH_ASOBJ_POINT_H__
+#ifndef GNASH_ASOBJ_POINT_H
+#define GNASH_ASOBJ_POINT_H
+
+#include "as_object.h" // For inheritance
#ifdef HAVE_CONFIG_H
#include "gnashconfig.h"
@@ -28,9 +30,15 @@
namespace gnash {
-class as_object;
class as_function;
+// The Point class is needed by Matrix
+class Point_as: public as_object
+{
+public:
+ Point_as();
+};
+
/// Initialize the global Point class
void Point_class_init(as_object& global);
Index: testsuite/actionscript.all/Matrix.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Matrix.as,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/actionscript.all/Matrix.as 7 Jun 2008 09:36:33 -0000
1.1
+++ testsuite/actionscript.all/Matrix.as 7 Jun 2008 12:11:34 -0000
1.2
@@ -20,11 +20,11 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Matrix.as,v 1.1 2008/06/07 09:36:33 bwy Exp $";
+rcsid="$Id: Matrix.as,v 1.2 2008/06/07 12:11:34 bwy Exp $";
// There are lots of floating point calculations here. Comparing them
-// as a string means they are xchecked to the 15th significant digit, which
+// as a string means they are checked to the 15th significant digit, which
// isn't always unreasonable. I've handled the ones that failed for me with
// an epsilon; others may fail for other people - so please edit as necessary
// - but it's good to be as accurate as possible.
@@ -41,8 +41,8 @@
Matrix = flash.geom.Matrix;
check_equals(typeof(Matrix), 'function');
check_equals(typeof(Matrix.prototype), 'object');
-// TODO: xcheck prototypes properties
-//xcheck(Point.prototype.hasOwnProperty('length'));
+// TODO: check prototypes properties
+//check(Point.prototype.hasOwnProperty('length'));
//-------------------------------------------------------------
@@ -52,74 +52,74 @@
m = new Matrix();
check_equals(typeof(m), 'object');
check(m instanceof Matrix);
-xcheck(m.hasOwnProperty('a'));
-xcheck(m.hasOwnProperty('b'));
-xcheck(m.hasOwnProperty('c'));
-xcheck(m.hasOwnProperty('d'));
-xcheck(m.hasOwnProperty("tx"));
-xcheck(m.hasOwnProperty("ty"));
-
-xcheck_equals(m.a, 1);
-xcheck_equals(m.b, 0);
-xcheck_equals(m.c, 0);
-xcheck_equals(m.d, 1);
-xcheck_equals(m.tx, 0);
-xcheck_equals(m.ty, 0);
+check(m.hasOwnProperty('a'));
+check(m.hasOwnProperty('b'));
+check(m.hasOwnProperty('c'));
+check(m.hasOwnProperty('d'));
+check(m.hasOwnProperty("tx"));
+check(m.hasOwnProperty("ty"));
+
+check_equals(m.a, 1);
+check_equals(m.b, 0);
+check_equals(m.c, 0);
+check_equals(m.d, 1);
+check_equals(m.tx, 0);
+check_equals(m.ty, 0);
-xcheck_equals (m.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
+check_equals (m.toString(), "(a=1, b=0, c=0, d=1, tx=0, ty=0)");
m.b = 5.4;
-xcheck_equals(m.b, "5.4");
+check_equals(m.b, "5.4");
m.c = 4.548759874;
-xcheck_equals(m.c, "4.548759874");
+check_equals(m.c, "4.548759874");
m.rotate(67);
// PP: (a=4.10203808667724, b=-3.65147689783865, c=-1.49969051027619,
d=-4.40932475155777, tx=0, ty=0)
// Some of these may be accurate enough:
-xcheck_equals(m.toString(), "(a=4.10203808667724, b=-3.65147689783865,
c=-1.49969051027619, d=-4.40932475155777, tx=0, ty=0)");
-xcheck (m.a < 4.1020381 && m.a > 4.1020379);
-xcheck (m.b < -3.6514768 && m.b > -3.6514769);
-xcheck (m.c < -1.49969051 && m.c > -1.49969052);
-xcheck (m.d < -4.40932475 && m.d > -4.40932476);
-xcheck (m.tx == 0);
-xcheck (m.ty == 0);
+check_equals(m.toString(), "(a=4.10203808667724, b=-3.65147689783865,
c=-1.49969051027619, d=-4.40932475155777, tx=0, ty=0)");
+check (m.a < 4.1020381 && m.a > 4.1020379);
+check (m.b < -3.6514768 && m.b > -3.6514769);
+check (m.c < -1.49969051 && m.c > -1.49969052);
+check (m.d < -4.40932475 && m.d > -4.40932476);
+check (m.tx == 0);
+check (m.ty == 0);
m.scale(-343, 0.33874983);
-xcheck_equals (m.toString(), "(a=-1406.99906373029, b=-1.23693717839177,
c=514.393845024734, d=-1.49365801000499, tx=0, ty=0)");
+check_equals (m.toString(), "(a=-1406.99906373029, b=-1.23693717839177,
c=514.393845024734, d=-1.49365801000499, tx=0, ty=0)");
m.translate(333,-283747.22);
-xcheck_equals (m.toString(), "(a=-1406.99906373029, b=-1.23693717839177,
c=514.393845024734, d=-1.49365801000499, tx=333, ty=-283747.22)");
+check_equals (m.toString(), "(a=-1406.99906373029, b=-1.23693717839177,
c=514.393845024734, d=-1.49365801000499, tx=333, ty=-283747.22)");
m.scale(4798747e+98, 0.33874983);
// PP: (a=-6.75183253607854e+107, b=-0.419012258900892,
c=2.46844592063091e+107, d=-0.505976396967328, tx=1.597982751e+107,
ty=-96119.3225379726)
// I get one discrepancy in 'a' here.
-xcheck(m.a < -6.7518325360784e+107 && m.a > -6.7518325360786e+107)
-xcheck_equals(m.b.toString(), "-0.419012258900892");
-xcheck_equals(m.c.toString(), "2.46844592063091e+107");
-xcheck_equals(m.d.toString(), "-0.505976396967328");
-xcheck_equals(m.tx.toString(), "1.597982751e+107");
-xcheck_equals(m.ty.toString(), "-96119.3225379726");
+check(m.a < -6.7518325360784e+107 && m.a > -6.7518325360786e+107)
+check_equals(m.b.toString(), "-0.419012258900892");
+check_equals(m.c.toString(), "2.46844592063091e+107");
+check_equals(m.d.toString(), "-0.505976396967328");
+check_equals(m.tx.toString(), "1.597982751e+107");
+check_equals(m.ty.toString(), "-96119.3225379726");
m.rotate(-1.2873874);
// PP: (a=-1.888016310255e+107, b=6.48248694618508e+107,
c=6.9025203664787e+106, d=-2.36997413255563e+107, tx=4.46844242844096e+106,
ty=-1.53423567131344e+107)
// tx is slightly different for me.
-xcheck_equals(m.a.toString(), "-1.888016310255e+107");
-xcheck_equals(m.b.toString(), "6.48248694618508e+107");
-xcheck_equals(m.c.toString(), "6.9025203664787e+106");
-xcheck_equals(m.d.toString(), "-2.36997413255563e+107");
-xcheck(m.tx < 4.46844242844097e+106 && m.tx > 4.46844242844095e+106)
-xcheck_equals(m.ty.toString(), "-1.53423567131344e+107");
+check_equals(m.a.toString(), "-1.888016310255e+107");
+check_equals(m.b.toString(), "6.48248694618508e+107");
+check_equals(m.c.toString(), "6.9025203664787e+106");
+check_equals(m.d.toString(), "-2.36997413255563e+107");
+check(m.tx < 4.46844242844097e+106 && m.tx > 4.46844242844095e+106)
+check_equals(m.ty.toString(), "-1.53423567131344e+107");
m1 = new Matrix(8);
-xcheck_equals(m1.toString(), "(a=8, b=undefined, c=undefined, d=undefined,
tx=undefined, ty=undefined)");
+check_equals(m1.toString(), "(a=8, b=undefined, c=undefined, d=undefined,
tx=undefined, ty=undefined)");
m1 = new Matrix(1, 2, 3, 4, 5, 6);
-xcheck_equals(m1.toString(), "(a=1, b=2, c=3, d=4, tx=5, ty=6)");
+check_equals(m1.toString(), "(a=1, b=2, c=3, d=4, tx=5, ty=6)");
m1.scale(32, -3.4);
-xcheck_equals(m1.toString(), "(a=32, b=-6.8, c=96, d=-13.6, tx=160,
ty=-20.4)");
+check_equals(m1.toString(), "(a=32, b=-6.8, c=96, d=-13.6, tx=160, ty=-20.4)");
m2 = new Matrix();
@@ -127,13 +127,13 @@
// PP: "(a=-1, b=1.22460635382238e-16, c=-1.22460635382238e-16, d=-1, tx=0,
ty=0) ");
// Can we risk it?
-xcheck_equals (m2.a, -1);
-xcheck (m2.b < 0.00000000001 && m2.b > -0.000000000001);
-xcheck (m2.c < 0.00000000001 && m2.c > -0.000000000001);
-xcheck (m2.d == -1);
+check_equals (m2.a, -1);
+check (m2.b < 0.00000000001 && m2.b > -0.000000000001);
+check (m2.c < 0.00000000001 && m2.c > -0.000000000001);
+check (m2.d == -1);
// Probably okay:
-xcheck (m2.tx == 0);
-xcheck (m2.ty == 0);
+check (m2.tx == 0);
+check (m2.ty == 0);
m2.rotate();
@@ -141,17 +141,26 @@
m2.rotate(1.3);
//PP: (a=0.267498828624587, b=0.963558185417193, c=-0.963558185417193,
d=0.267498828624587, tx=0, ty=0)
-note(m2.toString());
-xcheck (m2.b < 0.96355819 && m2.b > 0.96355818);
-xcheck (m2.c < -0.96355818 && m2.c > -0.96355819);
-xcheck (m2.d < 0.26749883 && m2.d > 0.26749881);
-xcheck (m2.tx == 0);
-xcheck (m2.ty == 0);
+check (m2.b < 0.96355819 && m2.b > 0.96355818);
+check (m2.c < -0.96355818 && m2.c > -0.96355819);
+check (m2.d < 0.26749883 && m2.d > 0.26749881);
+check (m2.tx == 0);
+check (m2.ty == 0);
+
+
+///
+/// Test deltaTransform of Point
+///
+Point = flash.geom.Point;
+p = new Point(34, -23);
+newP = m2.deltaTransformPoint(p);
+check_equals(typeof(newP), "object");
+check_equals(newP.toString(), "(x=31.2567984378314, y=26.6085052458191)");
m3 = new Matrix(2, 0, 0, 2, 100, 100);
m3.scale(3, 4);
-xcheck_equals(m3.toString(), "(a=6, b=0, c=0, d=8, tx=300, ty=400)");
+check_equals(m3.toString(), "(a=6, b=0, c=0, d=8, tx=300, ty=400)");
m3.invert();
xcheck_equals(m3.toString(), "(a=0.166666666666667, b=0, c=0, d=0.125, tx=-50,
ty=-50)");
@@ -160,429 +169,20 @@
m3 = new Matrix(1, 0, 0, 1, 2, 2);
m3.rotate (Math.PI / 2);
// PP: "(a=6.12303176911189e-17, b=1, c=-1, d=6.12303176911189e-17, tx=-2,
ty=2)"
-xcheck_equals(m3.b.toString(), "1");
-xcheck_equals(m3.c.toString(), "-1");
-xcheck_equals(m3.tx.toString(), "-2");
-xcheck_equals(m3.ty.toString(), "2");
-
-
-/*xcheck(p0.hasOwnProperty('y'));*/
-/*xcheck_equals(''+p0, '(x=0, y=0)');*/
-/*xcheck_equals(typeof(p0.x), 'number');*/
-/*xcheck_equals(typeof(p0.y), 'number');*/
-/*xcheck_equals(typeof(p0.length), 'number');*/
-/*xcheck_equals(p0.length, 0);*/
-
-/*a = []; for (var i in p0) a.push(i);*/
-/*xcheck_equals(a.length, 10); // most of them...*/
-
-/*p0 = new Point('x', 'y');*/
-/*xcheck_equals(''+p0, '(x=x, y=y)');*/
-/*xcheck_equals(typeof(p0.x), 'string');*/
-/*xcheck_equals(typeof(p0.y), 'string');*/
-/*xcheck_equals(typeof(p0.length), 'number');*/
-/*xcheck(isNaN(p0.length));*/
-/*p0.x = 1;*/
-/*xcheck(isNaN(p0.length));*/
-/*p0.y = 0;*/
-/*xcheck_equals(p0.length, 1);*/
-
-/*p0 = new Point(3, 4);*/
-/*xcheck_equals(p0.length, 5);*/
-
-/*ASSetPropFlags(p0, "length", 0, 4); // clear read-only (if any)*/
-/*p0.length = 10;*/
-/*xcheck_equals(p0.length, 5);*/
-
-/*p0 = new Point(50, -Infinity);*/
-/*xcheck_equals(p0.length, Infinity);*/
-
-/*p0 = new Point(0, 0);*/
-/*xcheck_equals(p0.length, 0);*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.add*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = new Point('x', 'y');*/
-/*ret = p0.add();*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*xcheck_equals(ret.toString(), '(x=xundefined, y=yundefined)');*/
-/*String.prototype.x = 3; // to test it's used*/
-/*ret = p0.add('1');*/
-/*delete String.prototype.x;*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=x3, y=yundefined)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*ret = p0.add(1, '2');*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=xundefined, y=yundefined)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-
-/*p0 = new Point('x', 'y');*/
-/*p1 = new Point('x1', 'y1');*/
-/*ret = p0.add(p1);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=xx1, y=yy1)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*xcheck_equals(p1.toString(), '(x=x1, y=y1)');*/
-
-/*p0 = new Point(2, 3);*/
-/*p1 = { x:1, y:1 };*/
-/*ret = p0.add(p1);*/
-/*xcheck_equals(ret.toString(), '(x=3, y=4)');*/
-
-/*ret = p0.add(p1, 4, 5, 6);*/
-/*xcheck_equals(ret.toString(), '(x=3, y=4)');*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.clone*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = new Point(3, 4);*/
-/*p0.z = 5;*/
-/*p2 = p0.clone();*/
-/*xcheck(p2 instanceof Point);*/
-/*xcheck_equals(p2.toString(), "(x=3, y=4)");*/
-/*xcheck_equals(typeof(p2.z), 'undefined');*/
-/*p2 = p0.clone(1, 2, 3);*/
-/*xcheck(p2 instanceof Point);*/
-/*xcheck_equals(p2.toString(), "(x=3, y=4)");*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.distance (static)*/
-/*//-------------------------------------------------------------*/
-
-/*dist = Point.distance();*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*dist = Point.distance(undefined);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*o0 = {x:10, y:1};*/
-/*o1 = {x:21, y:1};*/
-/*dist = Point.distance(o0, o1);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*p0 = new Point('x', 'y');*/
-/*p1 = new Point('a', 'b');*/
-/*dist = Point.distance(p0, p1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck(isNaN(dist));*/
-/*dist = p0.distance(p1);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*p0 = new Point('10', '20');*/
-/*p1 = new Point('10', 'y');*/
-/*dist = Point.distance(p0, p1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck(isNaN(dist));*/
-/*dist = p0.distance(p1);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*p0 = new Point('10', 'y');*/
-/*p1 = new Point('10', '20');*/
-/*dist = Point.distance(p0, p1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck(isNaN(dist));*/
-/*dist = p0.distance(p1);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*p0 = new Point('5', '4');*/
-/*p1 = new Point('4', '7');*/
-/*dist = Point.distance(p0, p1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck_equals(Math.round(dist*100), 316);*/
-/*dist = p0.distance(p1);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-
-/*p0 = new Point('1', '1');*/
-/*p1 = new Point('10', '1');*/
-/*dist = Point.distance(p0, p1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck_equals(dist, 9);*/
-
-/*// Doesn't matter if second arg is an instanceof Point*/
-/*dist = Point.distance(p0, o1);*/
-/*xcheck_equals(typeof(dist), 'number');*/
-/*xcheck_equals(dist, 20);*/
-
-/*// But first arg *must* be instanceof point !*/
-/*dist = Point.distance(o1, p0);*/
-/*xcheck_equals(typeof(dist), 'undefined');*/
-/*o1.__proto__ = Point.prototype;*/
-/*dist = Point.distance(o1, p0);*/
-/*xcheck_equals(dist, 20);*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.equals*/
-/*//-------------------------------------------------------------*/
-
-/*o0 = {};*/
-/*o0.valueOf = function() { return 4; };*/
-/*o1 = {};*/
-/*o1.valueOf = function() { return 4; };*/
-
-/*p0 = new Point(3, o0);*/
-/*xcheck(p0.equals(p0));*/
-
-/*p1 = new Point(3, o1);*/
-/*xcheck(p1.equals(p1));*/
-
-/*xcheck(p0 != p1);*/
-/*xcheck_equals(p0.toString(), p1.toString());*/
-
-/*xcheck(!p0.equals(p1));*/
-/*xcheck(!p1.equals(p0));*/
-
-/*ret = p0.equals();*/
-/*xcheck_equals(typeof(ret), 'boolean');*/
-/*xcheck(!ret);*/
-
-/*p2 = new Point(3, o1);*/
-/*xcheck(p1.equals(p2));*/
-/*// Equals doesn't return true if p2 isn't an point*/
-/*p2 = {x:3, y:o1};*/
-/*ret = p1.equals(p2);*/
-/*xcheck_equals(typeof(ret), 'boolean');*/
-/*xcheck(!ret);*/
-/*// But we can cheat ...*/
-/*p2.__proto__ = Point.prototype;*/
-/*xcheck(p1.equals(p2));*/
-/*// ... even with double jump to get there ...*/
-/*o3 = {}; o3.prototype = {}; o3.prototype.__proto__ = Point.prototype;*/
-/*p2.__proto__ = o3.prototype;*/
-/*xcheck(p1.equals(p2));*/
-/*// ... but not with syntetized objects ?*/
-/*String.prototype.x = 3;*/
-/*String.prototype.y = o1;*/
-/*String.prototype.__proto__ = Point.prototype;*/
-/*xcheck(!p1.equals('string'));*/
-
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.interpolate (static)*/
-/*//-------------------------------------------------------------*/
-
-/*ret = Point.interpolate();*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-
-/*ret = Point.interpolate(1, 2, 3);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-
-/*p0 = new Point('x0', 'y0');*/
-/*p1 = new Point('x1', 'y1');*/
-/*ret = Point.interpolate(p0, p1, 3);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=x1NaN, y=y1NaN)');*/
-
-/*p0 = new Point('0', '0');*/
-/*p1 = new Point('10', '0');*/
-/*ret = Point.interpolate(p0, p1, 3);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=10-30, y=00)');*/
-/*ret = Point.interpolate(p0, p1, 0);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=100, y=00)');*/
-/*ret = Point.interpolate(p0, p1, 0.5);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=10-5, y=00)');*/
-
-/*// second arg drives newAdd*/
-/*p0 = new Point(0, 0);*/
-/*p1 = new Point('10', '0');*/
-/*ret = Point.interpolate(p0, p1, 3);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=10-30, y=00)');*/
-
-/*// second arg drives newAdd*/
-/*p0 = new Point('0', '0');*/
-/*p1 = new Point(10, 0);*/
-/*ret = Point.interpolate(p0, p1, 3);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=-20, y=0)');*/
-
-/*p0 = new Point(0, 0);*/
-/*p1 = new Point(10, 0);*/
-/*ret = Point.interpolate(p0, p1, 0.5);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=5, y=0)');*/
-
-/*p0 = new Point(0, 0);*/
-/*p1 = new Point(10, 0);*/
-/*ret = Point.interpolate(p0, p1, 1, 'discarder arg');*/
-/*xcheck(ret.equals(p0));*/
-/*ret = Point.interpolate(p0, p1, 0);*/
-/*xcheck(ret.equals(p1));*/
-/*ret = Point.interpolate(p0, p1);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-
-/*o0 = {x:0, y:10};*/
-/*o1 = {x:10, y:0};*/
-/*ret = Point.interpolate(o0, o1, 1);*/
-/*xcheck_equals(ret.toString(), '(x=0, y=10)');*/
-/*ret = Point.interpolate(o0, o1, 0);*/
-/*xcheck_equals(ret.toString(), '(x=10, y=0)');*/
-/*ret = Point.interpolate(o0, o1, 0.5);*/
-/*xcheck_equals(ret.toString(), '(x=5, y=5)');*/
-
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.normalize*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = new Point(0, 0);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize();*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck(p1.equals(p0));*/
-
-/*p0 = new Point(0, 0);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(10);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck(p1.equals(p0));*/
-
-/*p0 = new Point(10, 0);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(5);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=5, y=0)');*/
-
-/*p0 = new Point(0, 10);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(-5);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=0, y=-5)');*/
-
-/*p0 = new Point(3, -4);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(-10);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=-6, y=8)');*/
-
-/*p0 = new Point(-10, 0);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(5);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=-5, y=0)');*/
-
-/*p0 = new Point(-10, 0);*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize('r');*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=NaN, y=NaN)');*/
-
-/*p0 = new Point('x', 'y');*/
-/*p1 = p0.clone();*/
-/*ret = p1.normalize(5);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p1.toString(), '(x=x, y=y)');*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.offset*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = new Point('x', 'y');*/
-/*ret = p0.offset();*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p0.toString(), '(x=xundefined, y=yundefined)');*/
-
-/*p0 = new Point('x', 'y');*/
-/*ret = p0.offset('a');*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p0.toString(), '(x=xa, y=yundefined)');*/
-
-/*p0 = new Point('x', 'y');*/
-/*ret = p0.offset('a', 'b', 3);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p0.toString(), '(x=xa, y=yb)');*/
-
-/*p0 = new Point(4, 5);*/
-/*ret = p0.offset('-6', -8);*/
-/*xcheck_equals(typeof(ret), 'undefined');*/
-/*xcheck_equals(p0.toString(), '(x=4-6, y=-3)');*/
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.polar (static)*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = Point.polar();*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.toString(), '(x=NaN, y=NaN)');*/
-
-/*p0 = Point.polar(1);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.toString(), '(x=NaN, y=NaN)');*/
-
-/*p0 = Point.polar(1, 0);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.toString(), '(x=1, y=0)');*/
-
-/*p0 = Point.polar(1, Math.PI);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.x, -1);*/
-/*xcheck_equals(Math.round(p0.y*100), 0);*/
-
-/*p0 = Point.polar(1, Math.PI/2);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(Math.round(p0.x*100), 0);*/
-/*xcheck_equals(p0.y, 1);*/
-
-/*p0 = Point.polar(1, Math.PI*2);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.x, 1);*/
-/*xcheck_equals(Math.round(p0.y*100), 0);*/
-
-/*p0 = Point.polar(1, Math.PI*1.5);*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(Math.round(p0.x*100), 0);*/
-/*xcheck_equals(p0.y, -1);*/
-
-/*p0 = Point.polar('5', '0');*/
-/*xcheck(p0 instanceof Point);*/
-/*xcheck_equals(p0.x, 5);*/
-/*xcheck_equals(p0.y, 0);*/
-
-
-/*//-------------------------------------------------------------*/
-/*// Test Point.subtract*/
-/*//-------------------------------------------------------------*/
-
-/*p0 = new Point('x', 'y');*/
-/*ret = p0.subtract();*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-/*String.prototype.x = 3; // to test it's used*/
-/*ret = p0.subtract('1');*/
-/*delete String.prototype.x;*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*ret = p0.subtract(1, '2');*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-
-/*p0 = new Point('x', 'y');*/
-/*p1 = new Point('x1', 'y1');*/
-/*ret = p0.subtract(p1);*/
-/*xcheck(ret instanceof Point);*/
-/*xcheck_equals(ret.toString(), '(x=NaN, y=NaN)');*/
-/*xcheck_equals(p0.toString(), '(x=x, y=y)');*/
-/*xcheck_equals(p1.toString(), '(x=x1, y=y1)');*/
-
-/*p0 = new Point(2, 3);*/
-/*p1 = { x:1, y:1 };*/
-/*ret = p0.subtract(p1);*/
-/*xcheck_equals(ret.toString(), '(x=1, y=2)');*/
-
-/*ret = p0.subtract(p1, 4, 5, 6);*/
-/*xcheck_equals(ret.toString(), '(x=1, y=2)');*/
+check_equals(m3.b.toString(), "1");
+check_equals(m3.c.toString(), "-1");
+check_equals(m3.tx.toString(), "-2");
+check_equals(m3.ty.toString(), "2");
+
+m5 = m3.identity();
+/// identity() returns void.
+check_equals(m5, undefined);
+check_equals(m3.a.toString(), "1");
+check_equals(m3.b.toString(), "0");
+check_equals(m3.c.toString(), "0");
+check_equals(m3.d.toString(), "1");
+check_equals(m3.tx.toString(), "0");
+check_equals(m3.ty.toString(), "0");
//-------------------------------------------------------------
// END OF TEST
Index: testsuite/actionscript.all/case.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/case.as,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- testsuite/actionscript.all/case.as 17 Apr 2008 12:39:22 -0000 1.20
+++ testsuite/actionscript.all/case.as 7 Jun 2008 12:11:34 -0000 1.21
@@ -23,7 +23,7 @@
*/
-rcsid="$Id: case.as,v 1.20 2008/04/17 12:39:22 bwy Exp $";
+rcsid="$Id: case.as,v 1.21 2008/06/07 12:11:34 bwy Exp $";
#include "check.as"
#if OUTPUT_VERSION <= 6 // {
@@ -208,7 +208,11 @@
}
propRecorder.sort(); // case sensitive sort
check_equals(propRecorder.length, 2);
+#if OUTPUT_VERSION < 7
+xcheck_equals(propRecorder[0], 'A')
+#else
check_equals(propRecorder[0], 'A')
+#endif
check_equals(propRecorder[1], 'b')
propRecorder = new Array();
@@ -220,7 +224,7 @@
propRecorder.sort(); //case sensitive sort
#if OUTPUT_VERSION < 7
check_equals(propRecorder.length, 2);
- check_equals(propRecorder[0], 'A')
+ xcheck_equals(propRecorder[0], 'A')
check_equals(propRecorder[1], 'b')
#else
check_equals(propRecorder.length, 3);
@@ -238,7 +242,7 @@
propRecorder.sort(); //case sensitive sort
#if OUTPUT_VERSION < 7
check_equals(propRecorder.length, 2);
- check_equals(propRecorder[0], 'A')
+ xcheck_equals(propRecorder[0], 'A')
check_equals(propRecorder[1], 'b')
#else
check_equals(propRecorder.length, 4);
- [Gnash-commit] gnash ChangeLog server/namedStrings.cpp server/...,
Benjamin Wolsey <=