gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. d6707fe11c8700c3b314


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. d6707fe11c8700c3b314c5f8e6ace828be4c42aa
Date: Wed, 01 Sep 2010 10:33:02 +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  d6707fe11c8700c3b314c5f8e6ace828be4c42aa (commit)
       via  9aacf5e1a2d90ae1d779541302bfe18eeef883cb (commit)
       via  8792e32d30a2004556bace9200507c34bd3323bf (commit)
      from  d996bc6ce3dcf03932483bf5bcb15150b031b2ce (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=d6707fe11c8700c3b314c5f8e6ace828be4c42aa


commit d6707fe11c8700c3b314c5f8e6ace828be4c42aa
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Sep 1 12:32:48 2010 +0200

    Add clone() comments.

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index 5b0ced7..a98be30 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -378,6 +378,8 @@ bitmapdata_clone(const fn_call& fn)
     else {
         im.reset(new image::ImageRGB(width, height));
     }
+    // Note that it would be much faster to copy the pixels, but BitmapData
+    // currently doesn't expose a way to do this.
     std::copy(bm->begin(), bm->end(), image::begin<image::ARGB>(*im));
 
     Global_as& gl = getGlobal(fn);

http://git.savannah.gnu.org/cgit//commit/?id=9aacf5e1a2d90ae1d779541302bfe18eeef883cb


commit 9aacf5e1a2d90ae1d779541302bfe18eeef883cb
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Sep 1 12:16:53 2010 +0200

    Implement BitmapData.clone(). Tests all pass.

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index e345d3f..5b0ced7 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -364,10 +364,32 @@ bitmapdata_applyFilter(const fn_call& fn)
 as_value
 bitmapdata_clone(const fn_call& fn)
 {
-       BitmapData_as* ptr = ensure<ThisIsNative<BitmapData_as> >(fn);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+       as_object* obj = ensure<ValidThis>(fn);
+       BitmapData_as* bm = ensure<ThisIsNative<BitmapData_as> >(fn);
+    if (bm->disposed()) return as_value();
+
+    const size_t width = bm->width();
+    const size_t height = bm->height();
+
+    std::auto_ptr<image::GnashImage> im;
+    if (bm->transparent()) {
+        im.reset(new image::ImageRGBA(width, height));
+    }
+    else {
+        im.reset(new image::ImageRGB(width, height));
+    }
+    std::copy(bm->begin(), bm->end(), image::begin<image::ARGB>(*im));
+
+    Global_as& gl = getGlobal(fn);
+    as_object* ret = gl.createObject();
+    const as_value& proto = obj->getMember(NSV::PROP_uuPROTOuu);
+    if (proto.is_object()) {
+        ret->set_member(NSV::PROP_uuPROTOuu, proto);
+    }
+
+    ret->setRelay(new BitmapData_as(ret, im));
+
+       return as_value(ret);
 }
 
 as_value
diff --git a/libcore/asobj/flash/display/BitmapData_as.h 
b/libcore/asobj/flash/display/BitmapData_as.h
index fdb3cbe..1364398 100644
--- a/libcore/asobj/flash/display/BitmapData_as.h
+++ b/libcore/asobj/flash/display/BitmapData_as.h
@@ -62,7 +62,6 @@ public:
     /// The constructor sets the immutable size of the
     /// bitmap, as well as whether it can handle transparency or not.
        BitmapData_as(as_object* owner, std::auto_ptr<image::GnashImage> im);
-       
 
     virtual ~BitmapData_as() {}
 

http://git.savannah.gnu.org/cgit//commit/?id=8792e32d30a2004556bace9200507c34bd3323bf


commit 8792e32d30a2004556bace9200507c34bd3323bf
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Sep 1 12:16:40 2010 +0200

    Add tests for BitmapData.clone().

diff --git a/testsuite/actionscript.all/BitmapData.as 
b/testsuite/actionscript.all/BitmapData.as
index ed7d782..f67cfed 100644
--- a/testsuite/actionscript.all/BitmapData.as
+++ b/testsuite/actionscript.all/BitmapData.as
@@ -598,10 +598,79 @@ check_equals(bm.getPixel32(5, 5), 0x300000ff);
 bm = new flash.display.BitmapData(10, 10, true, 0x30ffffff);
 check_equals(bm.getPixel32(5, 5), 0x30ffffff);
 
+// clone();
+
+orig = new flash.display.BitmapData(10, 10, false, 0x00ff10);
+orig.a = 7;
+orig.setPixel(5, 5, 0x0000ff);
+
+// Cloning doesn't clone non-native properties.
+cl = orig.clone();
+check_equals(cl.a, undefined);
+check_equals(cl.width, 10);
+check_equals(cl.height, 10);
+check_equals(cl.getPixel(2, 2), 0x00ff10);
+check_equals(cl.getPixel(5, 5), 0x0000ff);
+check_equals(typeof(cl.__proto__), "object");
+check_equals(cl.__proto__, orig.__proto__);
+check_equals(typeof(cl.constructor), "function");
+check_equals(cl.constructor, orig.constructor);
+
+// The constructor is irrelevant.
+orig.constructor = 10;
+check_equals(orig.constructor, 10);
+cl = orig.clone();
+check_equals(typeof(cl.__proto__), "object");
+check_equals(typeof(cl.constructor), "function");
+
+// The prototype is important.
+orig.__proto__ = 8;
+check_equals(orig.__proto__, 8);
+cl = orig.clone();
+check_equals(cl.__proto__, undefined);
+check_equals(cl.constructor, undefined);
+
+// What kind of prototype makes this work?
+o = {};
+o.constructor = 25;
+o.clone = flash.display.BitmapData.prototype.clone;
+orig.__proto__ = o;
+o.width = 20;
+o.height = 21;
+o.getPixel = flash.display.BitmapData.prototype.getPixel;
+
+cl = orig.clone();
+check_equals(cl.__proto__, o);
+check_equals(cl.constructor, 25);
+check_equals(cl.width, 20);
+check_equals(cl.height, 21);
+cl.__proto__ = flash.display.BitmapData.prototype;
+check_equals(cl.width, 10);
+check_equals(cl.height, 10);
+
+e = flash.display.BitmapData.prototype;
+orig.__proto__ = e;
+flash.display.BitmapData.prototype = 8;
+check_equals(flash.display.BitmapData.prototype, 8);
+cl = orig.clone();
+check_equals(typeof(cl.__proto__), "object");
+check_equals(typeof(cl.constructor), "function");
+
+// The constructor property comes from the original __proto__.
+cb = e.constructor;
+e.constructor = 98;
+cl = orig.clone();
+check_equals(typeof(cl.__proto__), "object");
+check_equals(cl.constructor, 98);
+
+// Restore to original state!
+e.constructor = cb;
+flash.display.BitmapData.prototype = e;
+
 //-------------------------------------------------------------
 // END OF TEST
 //-------------------------------------------------------------
 
-totals(226);
+totals(252);
 
 #endif // OUTPUT_VERSION >= 8

-----------------------------------------------------------------------

Summary of changes:
 libcore/asobj/flash/display/BitmapData_as.cpp |   32 ++++++++++--
 libcore/asobj/flash/display/BitmapData_as.h   |    1 -
 testsuite/actionscript.all/BitmapData.as      |   71 ++++++++++++++++++++++++-
 3 files changed, 98 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]