[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. 8fb86a47107dbfcf662d
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. 8fb86a47107dbfcf662daa1f92bd19b2b58891af |
Date: |
Sun, 05 Dec 2010 10:13:04 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 8fb86a47107dbfcf662daa1f92bd19b2b58891af (commit)
via 09124178cda380648a5a78eb024cd013829258e9 (commit)
via e1193c015b9251052e4fdd854c8fa794e1237703 (commit)
via 085f46d2e90455be71b0126b4c009e88f4805a69 (commit)
via 3e58506bcdeea8ecaa31085ad954f81781803a04 (commit)
via 8602e116b528de419cd85f41d0cd41184beaacb6 (commit)
via 38329808438e0911644c913ddf3d1d7d398935aa (commit)
via 2a7187f72076198c286fa032cffa36a84ac59cc5 (commit)
via 554e3b956aafcf9014357573138382d4e07df9be (commit)
via 4ceca991044716f1bcb8faab3485df1aaa0cc998 (commit)
from 2a5e3d60cf3f14ddcf8863785c20177799c0ad7d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=8fb86a47107dbfcf662daa1f92bd19b2b58891af
commit 8fb86a47107dbfcf662daa1f92bd19b2b58891af
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:59:45 2010 +0100
Small changes.
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index 0369820..cc8fd04 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -529,17 +529,15 @@ movieclip_attachAudio(const fn_call& fn)
{
MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
- if (!fn.nargs)
- {
+ if (!fn.nargs) {
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror("MovieClip.attachAudio(): %s", _("missing arguments"));
+ log_aserror("MovieClip.attachAudio(): %s", _("missing arguments"));
);
return as_value();
}
NetStream_as* ns;
- if (!isNativeType(toObject(fn.arg(0), getVM(fn)), ns))
- {
+ if (!isNativeType(toObject(fn.arg(0), getVM(fn)), ns)) {
std::stringstream ss; fn.dump_args(ss);
// TODO: find out what to do here
log_error("MovieClip.attachAudio(%s): first arg doesn't cast to a "
@@ -549,7 +547,6 @@ movieclip_attachAudio(const fn_call& fn)
ns->setAudioController(movieclip);
- LOG_ONCE( log_unimpl("MovieClip.attachAudio() - TESTING") );
return as_value();
}
@@ -571,10 +568,7 @@ movieclip_getDepth(const fn_call& fn)
{
// Unlike TextField.getDepth this works for any DisplayObject
DisplayObject* d = ensure<IsDisplayObject<> >(fn);
-
- const int n = d->get_depth();
-
- return as_value(n);
+ return as_value(d->get_depth());
}
//swapDepths(target:Object|target:Number)
@@ -583,13 +577,11 @@ movieclip_getDepth(const fn_call& fn)
as_value
movieclip_swapDepths(const fn_call& fn)
{
-
MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
const int this_depth = movieclip->get_depth();
- if (fn.nargs < 1)
- {
+ if (fn.nargs < 1) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("%s.swapDepths() needs one arg"),
movieclip->getTarget());
);
@@ -598,8 +590,7 @@ movieclip_swapDepths(const fn_call& fn)
// Lower bound of source depth below which swapDepth has no effect
// (below Timeline/static zone)
- if (this_depth < DisplayObject::lowerAccessibleBound)
- {
+ if (this_depth < DisplayObject::lowerAccessibleBound) {
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss;
fn.dump_args(ss);
http://git.savannah.gnu.org/cgit//commit/?id=09124178cda380648a5a78eb024cd013829258e9
commit 09124178cda380648a5a78eb024cd013829258e9
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:45:41 2010 +0100
Simplify more.
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index e9b0bbf..2aff7dc 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -123,12 +123,10 @@ Rectangle_clone(const fn_call& fn)
// properties that the object has (width, height, x, y) are used.
as_object* ptr = ensure<ValidThis>(fn);
- as_value x, y, w, h;
-
- ptr->get_member(NSV::PROP_X, &x);
- ptr->get_member(NSV::PROP_Y, &y);
- ptr->get_member(NSV::PROP_WIDTH, &w);
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
as_function* ctor = getClassConstructor(fn, "flash.geom.Rectangle");
if (!ctor) return as_value();
@@ -207,36 +205,30 @@ Rectangle_containsPoint(const fn_call& fn)
VM& vm = getVM(fn);
- as_value thisx;
- ptr->get_member(NSV::PROP_X, &thisx);
- as_value argx;
- if (arg) arg->get_member(NSV::PROP_X, &argx);
+ as_value thisx = getMember(*ptr, NSV::PROP_X);
+ as_value argx = arg ? getMember(*arg, NSV::PROP_X) : as_value();
// argx >= thisx
as_value ret = newLessThan(argx, thisx, vm);
if (ret.is_undefined()) return as_value();
if (toBool(ret, vm)) return as_value(false);
- as_value thisw;
- ptr->get_member(NSV::PROP_WIDTH, &thisw);
+ as_value thisw = getMember(*ptr, NSV::PROP_WIDTH);
newAdd(thisx, thisw, vm);
ret = newLessThan(argx, thisx, vm);
if (ret.is_undefined()) return as_value();
if (!toBool(ret, vm)) return as_value(false);
- as_value thisy;
- ptr->get_member(NSV::PROP_Y, &thisy);
- as_value argy;
- if (arg) arg->get_member(NSV::PROP_Y, &argy);
+ as_value thisy = getMember(*ptr, NSV::PROP_Y);
+ as_value argy = arg ? getMember(*arg, NSV::PROP_Y) : as_value();
// argy >= thisy
ret = newLessThan(argy, thisy, vm);
if (ret.is_undefined()) return as_value();
if (toBool(ret, vm)) return as_value(false);
- as_value thish;
- ptr->get_member(NSV::PROP_HEIGHT, &thish);
+ as_value thish = getMember(*ptr, NSV::PROP_HEIGHT);
newAdd(thisy, thish, vm);
ret = newLessThan(argy, thisy, vm);
@@ -335,12 +327,10 @@ Rectangle_isEmpty(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value w;
- ptr->get_member(NSV::PROP_WIDTH, &w);
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
if (w.is_undefined() || w.is_null()) return as_value(true);
- as_value h;
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
if (h.is_undefined() || h.is_null()) return as_value(true);
double wn = toNumber(w, getVM(fn));
@@ -349,8 +339,6 @@ Rectangle_isEmpty(const fn_call& fn)
double hn = toNumber(h, getVM(fn));
if (!isFinite(hn) || hn <= 0) return as_value(true);
- log_debug("Width: %g, Height: %g", wn, hn);
-
return as_value(false);
}
@@ -411,12 +399,10 @@ Rectangle_toString(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value x, y, w, h;
-
- ptr->get_member(NSV::PROP_X, &x);
- ptr->get_member(NSV::PROP_Y, &y);
- ptr->get_member(NSV::PROP_WIDTH, &w);
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
VM& vm = getVM(fn);
http://git.savannah.gnu.org/cgit//commit/?id=e1193c015b9251052e4fdd854c8fa794e1237703
commit e1193c015b9251052e4fdd854c8fa794e1237703
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:39:45 2010 +0100
Simplify.
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 2150589..e9b0bbf 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -337,11 +337,11 @@ Rectangle_isEmpty(const fn_call& fn)
as_value w;
ptr->get_member(NSV::PROP_WIDTH, &w);
- if ( w.is_undefined() || w.is_null() ) return as_value(true);
+ if (w.is_undefined() || w.is_null()) return as_value(true);
as_value h;
ptr->get_member(NSV::PROP_HEIGHT, &h);
- if ( h.is_undefined() || h.is_null() ) return as_value(true);
+ if (h.is_undefined() || h.is_null()) return as_value(true);
double wn = toNumber(w, getVM(fn));
if (!isFinite(wn) || wn <= 0) return as_value(true);
@@ -447,28 +447,18 @@ Rectangle_bottom(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- as_value height;
- ptr->get_member(NSV::PROP_Y, &ret);
- ptr->get_member(NSV::PROP_HEIGHT, &height);
- VM& vm = getVM(fn);
- newAdd(ret, height, vm);
- }
- else // setter
- {
- as_value y;
- ptr->get_member(NSV::PROP_Y, &y);
-
- as_value height = fn.arg(0);
- VM& vm = getVM(fn);
- subtract(height, y, vm);
- ptr->set_member(NSV::PROP_HEIGHT, height);
+ if (!fn.nargs) {
+ as_value b = getMember(*ptr, NSV::PROP_Y);
+ as_value height = getMember(*ptr, NSV::PROP_HEIGHT);
+ newAdd(b, height, getVM(fn));
+ return b;
}
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ as_value height = fn.arg(0);
+ subtract(height, y, getVM(fn));
+ ptr->set_member(NSV::PROP_HEIGHT, height);
- return ret;
+ return as_value();
}
as_value
@@ -478,11 +468,10 @@ Rectangle_bottomRight(const fn_call& fn)
if (!fn.nargs) {
- as_value x, y, w, h;
- ptr->get_member(NSV::PROP_X, &x);
- ptr->get_member(NSV::PROP_Y, &y);
- ptr->get_member(NSV::PROP_WIDTH, &w);
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
VM& vm = getVM(fn);
newAdd(x, w, vm);
@@ -502,8 +491,7 @@ Rectangle_bottomRight(const fn_call& fn)
fn_call::Args args;
args += x, y;
- as_value ret = constructInstance(*pointCtor, fn.env(), args);
- return ret;
+ return constructInstance(*pointCtor, fn.env(), args);
}
IF_VERBOSE_ASCODING_ERRORS(
@@ -519,30 +507,22 @@ Rectangle_left(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- ptr->get_member(NSV::PROP_X, &ret);
+ if (!fn.nargs) {
+ return getMember(*ptr, NSV::PROP_X);
}
- else // setter
- {
- as_value oldx;
- ptr->get_member(NSV::PROP_X, &oldx);
+ as_value oldx = getMember(*ptr, NSV::PROP_X);
- as_value newx = fn.arg(0);
- ptr->set_member(NSV::PROP_X, newx);
+ as_value newx = fn.arg(0);
+ ptr->set_member(NSV::PROP_X, newx);
- as_value w;
- ptr->get_member(NSV::PROP_WIDTH, &w);
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
- VM& vm = getVM(fn);
- subtract(oldx, newx, vm);
- newAdd(w, oldx, vm);
- ptr->set_member(NSV::PROP_WIDTH, w);
- }
+ VM& vm = getVM(fn);
+ subtract(oldx, newx, vm);
+ newAdd(w, oldx, vm);
+ ptr->set_member(NSV::PROP_WIDTH, w);
- return ret;
+ return as_value();
}
as_value
@@ -550,28 +530,19 @@ Rectangle_right(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- as_value width;
- ptr->get_member(NSV::PROP_X, &ret);
- ptr->get_member(NSV::PROP_WIDTH, &width);
- VM& vm = getVM(fn);
- newAdd(ret, width, vm);
+ if (!fn.nargs) {
+ as_value r = getMember(*ptr, NSV::PROP_X);
+ as_value width = getMember(*ptr, NSV::PROP_WIDTH);
+ newAdd(r, width, getVM(fn));
+ return r;
}
- else // setter
- {
- as_value x;
- ptr->get_member(NSV::PROP_X, &x);
- VM& vm = getVM(fn);
- as_value width = fn.arg(0);
- subtract(width, x, vm);
- ptr->set_member(NSV::PROP_WIDTH, width);
- }
+ as_value x = getMember(*ptr, NSV::PROP_X);
- return ret;
+ as_value width = fn.arg(0);
+ subtract(width, x, getVM(fn));
+ ptr->set_member(NSV::PROP_WIDTH, width);
+ return as_value();
}
as_value
http://git.savannah.gnu.org/cgit//commit/?id=085f46d2e90455be71b0126b4c009e88f4805a69
commit 085f46d2e90455be71b0126b4c009e88f4805a69
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:29:13 2010 +0100
Implement Rectangle.offsetPoint
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index aec1bab..2150589 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -377,8 +377,21 @@ as_value
Rectangle_offsetPoint(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ as_object* arg = (fn.nargs > 0) ? toObject(fn.arg(0), getVM(fn)) : 0;
+ if (!arg) return as_value();
+
+ as_value xdelta = getMember(*arg, NSV::PROP_X);
+ as_value ydelta = getMember(*arg, NSV::PROP_Y);
+
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ newAdd(x, xdelta, getVM(fn));
+ ptr->set_member(NSV::PROP_X, x);
+
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ newAdd(y, ydelta, getVM(fn));
+ ptr->set_member(NSV::PROP_Y, y);
+
return as_value();
}
http://git.savannah.gnu.org/cgit//commit/?id=3e58506bcdeea8ecaa31085ad954f81781803a04
commit 3e58506bcdeea8ecaa31085ad954f81781803a04
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:28:58 2010 +0100
Implement Rectangle.offset
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 9621277..aec1bab 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -358,8 +358,18 @@ as_value
Rectangle_offset(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
+
+ as_value xdelta = fn.nargs > 0 ? fn.arg(0) : as_value();
+ as_value ydelta = fn.nargs > 1 ? fn.arg(1) : as_value();
+
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ newAdd(x, xdelta, getVM(fn));
+ ptr->set_member(NSV::PROP_X, x);
+
+ as_value y = getMember(*ptr, NSV::PROP_Y);
+ newAdd(y, ydelta, getVM(fn));
+ ptr->set_member(NSV::PROP_Y, y);
+
return as_value();
}
http://git.savannah.gnu.org/cgit//commit/?id=8602e116b528de419cd85f41d0cd41184beaacb6
commit 8602e116b528de419cd85f41d0cd41184beaacb6
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:13:22 2010 +0100
Reorder includes
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index c0b96e8..9621277 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -18,8 +18,10 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-
#include "Rectangle_as.h"
+
+#include <sstream>
+
#include "as_object.h" // for inheritance
#include "log.h"
#include "fn_call.h"
@@ -32,8 +34,6 @@
#include "namedStrings.h"
#include "GnashNumeric.h" // isFinite
-#include <sstream>
-
namespace gnash {
namespace {
http://git.savannah.gnu.org/cgit//commit/?id=38329808438e0911644c913ddf3d1d7d398935aa
commit 38329808438e0911644c913ddf3d1d7d398935aa
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:12:40 2010 +0100
Swfdec tests pass.
diff --git a/testsuite/swfdec/PASSING b/testsuite/swfdec/PASSING
index ba6b488..3037a53 100644
--- a/testsuite/swfdec/PASSING
+++ b/testsuite/swfdec/PASSING
@@ -1091,6 +1091,9 @@ rectangle-construct-6.swf:4a5a2a553b5dcb00f7fabd4a9bc33311
rectangle-construct-7.swf:2baee75083f2c286afce030a5294e81e
rectangle-construct-8.swf:a8956560274b9557dab1380d802b2b9f
rectangle-equals-5.swf:a32beb36b2e690320c9d88e3130cb600
+rectangle-equals-6.swf:2f6c18b210553f08c3ad650c4943a0b1
+rectangle-equals-7.swf:8b2378d01346dc899223760428c844e9
+rectangle-equals-8.swf:69731b2b18827427808e73604e5c740a
rectangle-properties-5.swf:b9926dc51714320ff06eddb544ae9260
rectangle-properties-7.swf:48616a870f18a7f29553a3579db8a19f
rectangle-properties-8.swf:652bab2e912331a19008c5ccb96ebe4d
http://git.savannah.gnu.org/cgit//commit/?id=2a7187f72076198c286fa032cffa36a84ac59cc5
commit 2a7187f72076198c286fa032cffa36a84ac59cc5
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 10:04:07 2010 +0100
Implement Rectangle.equals().
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 7f583f7..c0b96e8 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -261,9 +261,37 @@ as_value
Rectangle_equals(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
+
+ if (!fn.nargs) return as_value(false);
+ as_object* comp = toObject(fn.arg(0), getVM(fn));
+
+ if (!comp) return as_value(false);
+
+ if (!comp->instanceOf(getClassConstructor(fn, "flash.geom.Rectangle"))) {
+ return as_value(false);
+ }
+
+ if (!equals(getMember(*comp, NSV::PROP_X),
+ getMember(*ptr, NSV::PROP_X), getVM(fn))) {
+ return as_value(false);
+ }
+
+ if (!equals(getMember(*comp, NSV::PROP_Y),
+ getMember(*ptr, NSV::PROP_Y), getVM(fn))) {
+ return as_value(false);
+ }
+
+ if (!equals(getMember(*comp, NSV::PROP_WIDTH),
+ getMember(*ptr, NSV::PROP_WIDTH), getVM(fn))) {
+ return as_value(false);
+ }
+
+ if (!equals(getMember(*comp, NSV::PROP_HEIGHT),
+ getMember(*ptr, NSV::PROP_HEIGHT), getVM(fn))) {
+ return as_value(false);
+ }
+
+ return as_value(true);
}
as_value
http://git.savannah.gnu.org/cgit//commit/?id=554e3b956aafcf9014357573138382d4e07df9be
commit 554e3b956aafcf9014357573138382d4e07df9be
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 09:55:42 2010 +0100
Use as_error and simplify.
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 61adcac..7f583f7 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -442,7 +442,9 @@ Rectangle_bottomRight(const fn_call& fn)
boost::intrusive_ptr<as_function> pointCtor = point.to_function();
if (!pointCtor) {
- log_error("Failed to construct flash.geom.Point!");
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("Failed to construct flash.geom.Point!");
+ );
return as_value();
}
@@ -526,33 +528,30 @@ Rectangle_size(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- as_value w,h;
- ptr->get_member(NSV::PROP_WIDTH, &w);
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ if (!fn.nargs) {
+ as_value w = getMember(*ptr, NSV::PROP_WIDTH);
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
as_function* pointCtor = getClassConstructor(fn, "flash.geom.Point");
if (!pointCtor) {
- log_error("Failed to construct flash.geom.Point!");
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("Failed to construct flash.geom.Point!");
+ );
return as_value();
}
fn_call::Args args;
args += w, h;
- ret = constructInstance(*pointCtor, fn.env(), args);
- }
- else // setter
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Attempt to set read-only property %s"),
"Rectangle.size");
- );
+ return constructInstance(*pointCtor, fn.env(), args);
}
- return ret;
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set read-only property %s"),
+ "Rectangle.size");
+ );
+
+ return as_value();
}
as_value
@@ -560,30 +559,25 @@ Rectangle_top(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- ptr->get_member(NSV::PROP_Y, &ret);
+ if (!fn.nargs) {
+ // getter
+ return getMember(*ptr, NSV::PROP_Y);
}
- else // setter
- {
- as_value oldy;
- ptr->get_member(NSV::PROP_Y, &oldy);
- as_value newy = fn.arg(0);
- ptr->set_member(NSV::PROP_Y, newy);
+ // setter
+ as_value oldy = getMember(*ptr, NSV::PROP_Y);
- as_value h;
- ptr->get_member(NSV::PROP_HEIGHT, &h);
+ as_value newy = fn.arg(0);
+ ptr->set_member(NSV::PROP_Y, newy);
- VM& vm = getVM(fn);
- subtract(oldy, newy, vm);
- newAdd(h, oldy, vm);
- ptr->set_member(NSV::PROP_HEIGHT, h);
- }
+ as_value h = getMember(*ptr, NSV::PROP_HEIGHT);
- return ret;
+ VM& vm = getVM(fn);
+ subtract(oldy, newy, vm);
+ newAdd(h, oldy, vm);
+ ptr->set_member(NSV::PROP_HEIGHT, h);
+
+ return as_value();
}
as_value
@@ -591,34 +585,32 @@ Rectangle_topLeft(const fn_call& fn)
{
as_object* ptr = ensure<ValidThis>(fn);
- as_value ret;
-
- if ( ! fn.nargs ) // getter
- {
- as_value x,y;
- ptr->get_member(NSV::PROP_X, &x);
- ptr->get_member(NSV::PROP_Y, &y);
+ // getter
+ if (!fn.nargs) {
+ as_value x = getMember(*ptr, NSV::PROP_X);
+ as_value y = getMember(*ptr, NSV::PROP_Y);
as_function* pointCtor = getClassConstructor(fn, "flash.geom.Point");
if (!pointCtor) {
- log_error("Failed to construct flash.geom.Point!");
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("Failed to construct flash.geom.Point!");
+ );
return as_value();
}
fn_call::Args args;
args += x, y;
- ret = constructInstance(*pointCtor, fn.env(), args);
+ return constructInstance(*pointCtor, fn.env(), args);
}
- else // setter
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Attempt to set read-only property %s"),
"Rectangle.topLeft");
- );
- }
- return ret;
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set read-only property %s"),
+ "Rectangle.topLeft");
+ );
+
+ return as_value();
}
@@ -653,5 +645,6 @@ get_flash_geom_rectangle_constructor(const fn_call& fn)
attachRectangleInterface(*proto);
return gl.createClass(&Rectangle_ctor, proto);
}
+
} // anonymous namespace
} // end of gnash namespace
http://git.savannah.gnu.org/cgit//commit/?id=4ceca991044716f1bcb8faab3485df1aaa0cc998
commit 4ceca991044716f1bcb8faab3485df1aaa0cc998
Author: Benjamin Wolsey <address@hidden>
Date: Sun Dec 5 09:46:20 2010 +0100
Simplify contains().
diff --git a/libcore/asobj/flash/geom/Rectangle_as.cpp
b/libcore/asobj/flash/geom/Rectangle_as.cpp
index 5c1cb6e..61adcac 100644
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp
@@ -142,20 +142,14 @@ Rectangle_clone(const fn_call& fn)
as_value
Rectangle_contains(const fn_call& fn)
{
- //fn.arg(0) => x coordinate
- //fn.arg(1) => y coordinate
-
as_object* ptr = ensure<ValidThis>(fn);
- as_value rect_x_as, rect_width_as, rect_y_as, rect_height_as;
-
- ptr->get_member(NSV::PROP_X, &rect_x_as);
- ptr->get_member(NSV::PROP_WIDTH, &rect_width_as);
- ptr->get_member(NSV::PROP_Y, &rect_y_as);
- ptr->get_member(NSV::PROP_HEIGHT, &rect_height_as);
+ as_value rect_x_as = getMember(*ptr, NSV::PROP_X);
+ as_value rect_width_as = getMember(*ptr, NSV::PROP_WIDTH);
+ as_value rect_y_as = getMember(*ptr, NSV::PROP_Y);
+ as_value rect_height_as = getMember(*ptr, NSV::PROP_HEIGHT);
- if ( fn.nargs < 2 )
- {
+ if (fn.nargs < 2) {
IF_VERBOSE_ASCODING_ERRORS(
std::stringstream ss;
fn.dump_args(ss);
@@ -167,16 +161,6 @@ Rectangle_contains(const fn_call& fn)
const as_value& x_as = fn.arg(0);
const as_value& y_as = fn.arg(1);
- if ( x_as.is_null() || x_as.is_undefined() ||
- y_as.is_null() || y_as.is_undefined() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- std::stringstream ss;
- fn.dump_args(ss);
- log_aserror("flash.geom.Rectangle(%s): %s", ss.str(), _("invalid
arguments"));
- );
- return as_value();
- }
VM& vm = getVM(fn);
@@ -186,40 +170,27 @@ Rectangle_contains(const fn_call& fn)
as_value rect_y1_as = rect_y_as;
newAdd(rect_y1_as, rect_height_as, vm);
- if ( rect_x_as.is_null() || rect_x_as.is_undefined() ||
- rect_y_as.is_null() || rect_y_as.is_undefined() ||
- rect_x1_as.is_null() || rect_x1_as.is_undefined() ||
- rect_y1_as.is_null() || rect_y1_as.is_undefined() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- std::stringstream ss;
- fn.dump_args(ss);
- log_aserror("flash.geom.Rectangle(%s): %s", ss.str(), _("invalid
rectangle"));
- );
- return as_value();
- }
-
- //Points are contained within the Rectangle IFF they lie
- //on the top or left borders of the rectangle, but not the right or
- //bottom borders, or they are not on a border but between all.
+ // Points are contained within the Rectangle IFF they lie
+ // on the top or left borders of the rectangle, but not the right or
+ // bottom borders, or they are not on a border but between all.
// NOTE: order of tests is important, see actionscript.all/Rectangle.as
as_value ret = newLessThan(x_as, rect_x_as, vm);
- if ( ret.is_undefined() ) return as_value();
- if ( toBool(ret, vm) ) return as_value(false);
+ if (ret.is_undefined()) return as_value();
+ if (toBool(ret, vm)) return as_value(false);
ret = newLessThan(x_as, rect_x1_as, vm);
- if ( ret.is_undefined() ) return as_value();
- if ( ! toBool(ret, vm) ) return as_value(false);
+ if (ret.is_undefined()) return as_value();
+ if (!toBool(ret, vm)) return as_value(false);
ret = newLessThan(y_as, rect_y_as, vm);
- if ( ret.is_undefined() ) return as_value();
- if ( toBool(ret, vm) ) return as_value(false);
+ if (ret.is_undefined()) return as_value();
+ if (toBool(ret, vm)) return as_value(false);
ret = newLessThan(y_as, rect_y1_as, vm);
- if ( ret.is_undefined() ) return as_value();
- if ( ! toBool(ret, vm) ) return as_value(false);
+ if (ret.is_undefined()) return as_value();
+ if (!toBool(ret, vm)) return as_value(false);
return as_value(true);
-----------------------------------------------------------------------
Summary of changes:
libcore/asobj/MovieClip_as.cpp | 21 +--
libcore/asobj/flash/geom/Rectangle_as.cpp | 380 +++++++++++++---------------
testsuite/swfdec/PASSING | 3 +
3 files changed, 185 insertions(+), 219 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. 8fb86a47107dbfcf662daa1f92bd19b2b58891af,
Benjamin Wolsey <=