[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9539: A bit more BitmapData.
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9539: A bit more BitmapData. |
Date: |
Fri, 25 Jul 2008 13:21:10 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9539
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2008-07-25 13:21:10 +0200
message:
A bit more BitmapData.
modified:
libcore/asobj/flash/display/BitmapData_as.cpp
libcore/asobj/flash/geom/Rectangle_as.cpp
libcore/asobj/flash/geom/Rectangle_as.h
testsuite/actionscript.all/BitmapData.as
------------------------------------------------------------
revno: 9536.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Fri 2008-07-25 13:19:08 +0200
message:
More tests for BitmapData. Implement BitmapData.rectangle.
modified:
libcore/asobj/flash/display/BitmapData_as.cpp
libcore/asobj/flash/geom/Rectangle_as.cpp
libcore/asobj/flash/geom/Rectangle_as.h
testsuite/actionscript.all/BitmapData.as
=== modified file 'libcore/asobj/flash/display/BitmapData_as.cpp'
--- a/libcore/asobj/flash/display/BitmapData_as.cpp 2008-07-25 09:10:16
+0000
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp 2008-07-25 11:19:08
+0000
@@ -22,6 +22,7 @@
#endif
#include "BitmapData_as.h"
+#include "flash/geom/Rectangle_as.h" // for BitmapData.rectangle
#include "as_object.h" // for inheritance
#include "log.h"
#include "fn_call.h"
@@ -506,9 +507,15 @@
BitmapData_rectangle_getset(const fn_call& fn)
{
boost::intrusive_ptr<BitmapData_as> ptr =
ensureType<BitmapData_as>(fn.this_ptr);
- UNUSED(ptr);
- LOG_ONCE( log_unimpl (__FUNCTION__) );
- return as_value();
+
+ boost::intrusive_ptr<as_object> obj = init_Rectangle_instance();
+
+ obj->set_member(NSV::PROP_X, 0);
+ obj->set_member(NSV::PROP_Y, 0);
+ obj->set_member(NSV::PROP_WIDTH, ptr->getWidth());
+ obj->set_member(NSV::PROP_HEIGHT, ptr->getHeight());
+
+ return as_value(obj.get()); // will keep alive
}
static as_value
=== modified file 'libcore/asobj/flash/geom/Rectangle_as.cpp'
--- a/libcore/asobj/flash/geom/Rectangle_as.cpp 2008-07-13 15:33:34 +0000
+++ b/libcore/asobj/flash/geom/Rectangle_as.cpp 2008-07-25 11:19:08 +0000
@@ -654,6 +654,11 @@
return cl;
}
+boost::intrusive_ptr<as_object> init_Rectangle_instance()
+{
+ return boost::intrusive_ptr<as_object>(new Rectangle_as);
+}
+
// extern
void Rectangle_class_init(as_object& where)
{
=== modified file 'libcore/asobj/flash/geom/Rectangle_as.h'
--- a/libcore/asobj/flash/geom/Rectangle_as.h 2008-05-05 07:57:26 +0000
+++ b/libcore/asobj/flash/geom/Rectangle_as.h 2008-07-25 11:19:08 +0000
@@ -17,14 +17,14 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifndef __GNASH_ASOBJ_RECTANGLE_H__
-#define __GNASH_ASOBJ_RECTANGLE_H__
+#ifndef GNASH_ASOBJ_RECTANGLE_H
+#define GNASH_ASOBJ_RECTANGLE_H
#ifdef HAVE_CONFIG_H
#include "gnashconfig.h"
#endif
-//#include <memory> // for auto_ptr
+#include "smart_ptr.h" // boost::intrusive_ptr
namespace gnash {
@@ -34,7 +34,7 @@
void Rectangle_class_init(as_object& global);
/// Return a Rectangle instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_Rectangle_instance();
+boost::intrusive_ptr<as_object> init_Rectangle_instance();
} // end of gnash namespace
=== modified file 'testsuite/actionscript.all/BitmapData.as'
--- a/testsuite/actionscript.all/BitmapData.as 2008-07-25 09:30:42 +0000
+++ b/testsuite/actionscript.all/BitmapData.as 2008-07-25 11:19:08 +0000
@@ -83,7 +83,8 @@
check_equals(bmp.height, 10);
check_equals(bmp.width, 10);
check_equals(bmp.transparent, true);
-xcheck_equals(bmp.rectangle.toString(), "(x=0, y=0, w=10, h=10)");
+check_equals(bmp.rectangle.toString(), "(x=0, y=0, w=10, h=10)");
+check(bmp.rectangle instanceOf flash.geom.Rectangle);
check_equals(bmp.getPixel(1, 1), 16777215);
check_equals(bmp.getPixel(9, 9), 16777215);
check_equals(bmp.getPixel32(1, 1), -1);
@@ -98,7 +99,7 @@
check_equals(bmp.height, 30);
check_equals(bmp.width, 20);
check_equals(bmp.transparent, false);
-xcheck_equals(bmp.rectangle.toString(), "(x=0, y=0, w=20, h=30)");
+check_equals(bmp.rectangle.toString(), "(x=0, y=0, w=20, h=30)");
check_equals(bmp.getPixel(1, 1), 0xeeddee);
check_equals(bmp.getPixel32(1, 1), -1122834);
@@ -207,10 +208,23 @@
mc.attachBitmap(bmp, this.getNextHighestDepth());
+bmp.dispose();
+xcheck_equals(bmp.height, -1);
+xcheck_equals(bmp.width, -1);
+xcheck_equals(bmp.transparent, -1);
+xcheck_equals(typeof(bmp.rectangle), "number");
+xcheck_equals(bmp.rectangle, -1);
+xcheck_equals(bmp.rectangle.toString(), "-1");
+
+check(bmp instanceOf Bitmap);
+bmp.height = 2;
+xcheck_equals(bmp.height, -1);
+
+
//-------------------------------------------------------------
// END OF TEST
//-------------------------------------------------------------
-totals(89);
+totals(98);
#endif // OUTPUT_VERSION >= 8
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9539: A bit more BitmapData.,
Benjamin Wolsey <=