[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test... |
Date: |
Tue, 12 Dec 2006 17:33:20 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/12 17:33:20
Modified files:
. : ChangeLog
server : sprite_instance.cpp
testsuite/actionscript.all: MovieClip.as
Log message:
* server/sprite_instance.cpp: stubbed MovieClip.getBounds().
* testsuite/actionscript.all/MovieClip.as: added incomplete
test for MovieClip.getBounds().
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1918&r2=1.1919
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.19&r2=1.20
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1918
retrieving revision 1.1919
diff -u -b -r1.1918 -r1.1919
--- ChangeLog 12 Dec 2006 16:58:31 -0000 1.1918
+++ ChangeLog 12 Dec 2006 17:33:19 -0000 1.1919
@@ -1,5 +1,11 @@
2006-12-12 Sandro Santilli <address@hidden>
+ * server/sprite_instance.cpp: stubbed MovieClip.getBounds().
+ * testsuite/actionscript.all/MovieClip.as: added incomplete
+ test for MovieClip.getBounds().
+
+2006-12-12 Sandro Santilli <address@hidden>
+
* server/as_object.h: added get_primitive_value() virtual
functions.
* server/as_value.{cpp,h}: added to_primitive().
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- server/sprite_instance.cpp 12 Dec 2006 16:59:25 -0000 1.101
+++ server/sprite_instance.cpp 12 Dec 2006 17:33:19 -0000 1.102
@@ -44,6 +44,7 @@
#include "builtin_function.h"
#include "smart_ptr.h"
#include "VM.h"
+#include "Range2d.h" // for getBounds
#include <vector>
#include <string>
@@ -758,6 +759,49 @@
log_error("FIXME: MovieClip.getURL() not implemented yet");
}
+// getBounds(targetCoordinateSpace:Object) : Object
+static void
+sprite_getBounds(const fn_call& fn)
+{
+ sprite_instance* sprite = dynamic_cast<sprite_instance*>(fn.this_ptr);
+ if (sprite == NULL)
+ {
+ // Handle programming errors
+ IF_VERBOSE_ASCODING_ERRORS (
+ log_error("getBounds called against an object"
+ " which is NOT a MovieClip (%s), "
+ "returning undefined", typeid(fn.this_ptr).name());
+ );
+ fn.result->set_undefined();
+ return;
+ }
+
+ boost::intrusive_ptr<as_object> target;
+ if ( fn.nargs > 0 )
+ {
+ target = fn.arg(0).to_object();
+ }
+
+ // TODO: implement 'Range2d<float> character::getBounds(character*
ref=NULL)'
+ geometry::Range2d<float> bounds(0, 0, 0, 0); // =
sprite->getBounds(target.get());
+
+ double xMin = bounds.getMinX();
+ double yMin = bounds.getMinY();
+ double xMax = bounds.getMaxX();
+ double yMax = bounds.getMaxY();
+
+ boost::intrusive_ptr<as_object> bounds_obj(new as_object());
+ bounds_obj->set_member("xMin", as_value(xMin));
+ bounds_obj->set_member("yMin", as_value(yMin));
+ bounds_obj->set_member("xMax", as_value(xMax));
+ bounds_obj->set_member("yMax", as_value(yMax));
+
+ // xMin, xMax, yMin, and yMax
+ log_error("FIXME: MovieClip.getBounds() not implemented yet (just
stubbed)");
+
+ fn.result->set_as_object(bounds_obj.get());
+}
+
// startDrag([lockCenter:Boolean], [left:Number], [top:Number],
// [right:Number], [bottom:Number]) : Void`
static void
@@ -803,6 +847,7 @@
o.set_member("startDrag", &sprite_startDrag);
o.set_member("stopDrag", &sprite_stopDrag);
o.set_member("getURL", &sprite_getURL);
+ o.set_member("getBounds", &sprite_getBounds);
if ( target_version < 6 ) return;
// SWF6 or higher
@@ -2743,11 +2788,10 @@
_target_dot = "_level0" + getTargetPath();
std::string::size_type current=0;
- for (int i=0; i<_target_dot.length(); ++i)
+ for (std::string::size_type i=0; i<_target_dot.length(); ++i)
{
if ( _target_dot[i] == '/' ) _target_dot[i] = '.';
}
- //if ( _target_dot.back() == '.' ) _target_dot.pop_back();
return _target_dot.c_str();
}
Index: testsuite/actionscript.all/MovieClip.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- testsuite/actionscript.all/MovieClip.as 12 Dec 2006 16:58:31 -0000
1.19
+++ testsuite/actionscript.all/MovieClip.as 12 Dec 2006 17:33:19 -0000
1.20
@@ -22,7 +22,7 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: MovieClip.as,v 1.19 2006/12/12 16:58:31 strk Exp $";
+rcsid="$Id: MovieClip.as,v 1.20 2006/12/12 17:33:19 strk Exp $";
#include "check.as"
@@ -46,7 +46,24 @@
check(mc.attachMovie);
check(mc.getBytesLoaded);
check(mc.getBytesTotal);
-xcheck(mc.getBounds);
+check(mc.getBounds);
+
+
+//
+// Test getBounds (simple test)
+//
+var bounds = mc.getBounds();
+check_equals(typeof(bounds), "object");
+// Checking for real values would be a bit hard
+// atm, as the loaded Dejagnu.swf file might
+// write stuff all around thus making bounds
+// change often... we'll check it later, with
+// a user defined movieclip (more control over
+// it's bounds)
+check(bounds.xMin != undefined);
+check(bounds.yMin != undefined);
+check(bounds.xMax != undefined);
+check(bounds.yMax != undefined);
// This seems unavailable
// when targetting SWF > 6
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...,
Sandro Santilli <=