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. release_0_8_9_start-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-535-g6849f3a
Date: Thu, 07 Apr 2011 12:18:15 +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  6849f3a8c77d97f2acb7e6ad55e286c1b2b5abc4 (commit)
       via  5469ba15569912e22cff4985a697b877bd39ed0a (commit)
       via  bb12a2d66ccd56086d47ebcfa0fc24dfe866c2c0 (commit)
       via  ee42d2de7f93bf99237aaa675c71bcf13565d735 (commit)
      from  02a6d988ec61557fa4c2b3c7b1215bbd2406fae1 (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=6849f3a8c77d97f2acb7e6ad55e286c1b2b5abc4


commit 6849f3a8c77d97f2acb7e6ad55e286c1b2b5abc4
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Apr 7 14:07:22 2011 +0200

    Add test for overlapping copyChannel() ranges.
    
    Gnash already does this correctly.

diff --git a/testsuite/actionscript.all/BitmapData.as 
b/testsuite/actionscript.all/BitmapData.as
index 09b92e9..1683451 100644
--- a/testsuite/actionscript.all/BitmapData.as
+++ b/testsuite/actionscript.all/BitmapData.as
@@ -826,6 +826,24 @@ dest.copyChannel(src, new Rect(0, 0, 100, 100), new 
Point(0, 0), 6, 4);
  check_equals(dest.getPixel(25, 75), 0xffff00); // Yellow
  check_equals(dest.getPixel(75, 75), 0xffff00); // Yellow
 
+// Copy same channel to source range
+// As the source range is transformed while being processed,
+// those transformations accumulate to give unexpected 
+// results.
+dest = new flash.display.BitmapData(100, 100, false, 0x000000);
+dest.fillRect(new Rect(0, 0, 50, 50), 0x0000ff);
+dest.copyChannel(dest, new Rect(0, 0, 100, 100), new Point(4, 4), 4, 4);
+ check_equals(dest.getPixel(52, 6), 0x0000ff);
+ check_equals(dest.getPixel(56, 10), 0x0000ff);
+ check_equals(dest.getPixel(60, 14), 0x0000ff);
+ check_equals(dest.getPixel(96, 50), 0x0000ff);
+ check_equals(dest.getPixel(96, 96), 0x0000ff);
+ check_equals(dest.getPixel(6, 52), 0x0000ff);
+ check_equals(dest.getPixel(10, 56), 0x0000ff);
+ check_equals(dest.getPixel(14, 60), 0x0000ff);
+ check_equals(dest.getPixel(50, 96), 0x0000ff);
+ check_equals(dest.getPixel(96, 96), 0x0000ff);
+
 // noise().
 
 // Tests that a particular color does not appear.
@@ -997,6 +1015,6 @@ flash.display.BitmapData.prototype = e;
 // END OF TEST
 //-------------------------------------------------------------
 
-totals(354);
+totals(364);
 
 #endif // OUTPUT_VERSION >= 8

http://git.savannah.gnu.org/cgit//commit/?id=5469ba15569912e22cff4985a697b877bd39ed0a


commit 5469ba15569912e22cff4985a697b877bd39ed0a
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Apr 7 14:07:18 2011 +0200

    Update news.

diff --git a/NEWS b/NEWS
index c0778f7..cb16b3c 100644
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,9 @@ YYYY/MM/DD
 Improvements since 0.8.9 release are:
 
  * Qt4 GUI supports mouse wheel, clipboard, and screen resolution.
- * Enhanced UI support for Script limits (abort popups, user prefs)
- * BitmapData.copyPixels() implemented.
+ * Enhanced UI support for script limits (abort popups, user prefs)
+ * BitmapData functions copyPixels(), copyChannel, and noise() 
+   implemented.
 
 Gnash 0.8.9
 2011/03/19

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


commit bb12a2d66ccd56086d47ebcfa0fc24dfe866c2c0
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Apr 7 13:50:47 2011 +0200

    Add another test for copyChannel().
    
    Test multiple source channels where some pixels have values
    for both source channels; this also doesn't work.

diff --git a/testsuite/actionscript.all/BitmapData.as 
b/testsuite/actionscript.all/BitmapData.as
index 4d6a002..09b92e9 100644
--- a/testsuite/actionscript.all/BitmapData.as
+++ b/testsuite/actionscript.all/BitmapData.as
@@ -727,6 +727,14 @@ dest.copyChannel(src, new Rect(0, 0, 100, 100), new 
Point(0, 0), 3, 4);
  check_equals(dest.getPixel(25, 75), 0x000000); // Nothing
  check_equals(dest.getPixel(75, 75), 0x000000); // Nothing
 
+// Copy red and blue channels to green channel
+dest = new flash.display.BitmapData(100, 100, true, 0xff000000);
+dest.copyChannel(src, new Rect(0, 0, 100, 100), new Point(0, 0), 5, 2);
+ check_equals(dest.getPixel(25, 25), 0x000000); // Nothing
+ check_equals(dest.getPixel(75, 25), 0x000000); // Nothing
+ check_equals(dest.getPixel(25, 75), 0x000000); // Nothing
+ check_equals(dest.getPixel(75, 75), 0x000000); // Nothing
+
 // Copy green channel to green and blue channels
 // Doesn't work!
 dest = new flash.display.BitmapData(100, 100, true, 0xffffffff);
@@ -989,6 +997,6 @@ flash.display.BitmapData.prototype = e;
 // END OF TEST
 //-------------------------------------------------------------
 
-totals(350);
+totals(354);
 
 #endif // OUTPUT_VERSION >= 8

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


commit ee42d2de7f93bf99237aaa675c71bcf13565d735
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Apr 7 13:33:55 2011 +0200

    Use std::transform in copyChannel().

diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp 
b/libcore/asobj/flash/display/BitmapData_as.cpp
index 739b9ee..7f8ca62 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -180,6 +180,40 @@ private:
     const bool _greyscale;
 };
 
+/// Copy a single channel from one ARGB value to a channel in another.
+//
+/// Due to peculiarities in the Adobe implementation, this also supports
+/// setting them to black.
+template<typename Iterator>
+struct CopyChannel
+{
+    typedef boost::tuple<Iterator, Iterator> iterator_tuple;
+    typedef boost::zip_iterator<iterator_tuple> iterator_type;
+
+    CopyChannel(bool multiple, boost::uint8_t srcchans,
+            boost::uint8_t destchans)
+        :
+        _multiple(multiple),
+        _srcchans(srcchans),
+        _destchans(destchans)
+    {}
+
+    /// 
+    boost::uint32_t operator()(typename iterator_type::value_type p) const {
+        // If multiple source channels, we set the destination channel
+        // to black. Else to the value of the requested channel.
+        const boost::uint8_t val = _multiple ? 0 : 
getChannel(boost::get<0>(p), _srcchans);
+        return setChannel(boost::get<1>(p), _destchans, val);
+    }
+
+private:
+    const bool _multiple;
+    const boost::uint8_t _srcchans;
+    const boost::uint8_t _destchans;
+
+};
+
+
 } // anonymous namespace
 
 BitmapData_as::BitmapData_as(as_object* owner,
@@ -584,23 +618,19 @@ bitmapdata_copyChannel(const fn_call& fn)
     assert(destX + destW <= static_cast<int>(ptr->width()));
     assert(destY + destH <= static_cast<int>(ptr->height()));
 
-    boost::make_zip_iterator(boost::make_tuple(src, targ));
-
     // Copy for the width and height of the *dest* image.
     // We have already ensured that the copied area
-    // is inside both bitmapdatas.
+    // is inside both bitmapdatas
+    typedef CopyChannel<BitmapData_as::iterator> Copier;
+    Copier c(multiple, srcchans, destchans);
+
+    // Note that copying the same channel to a range starting in the
+    // source range produces unexpected effects because the source
+    // range is changed while it is being copied. This is verified
+    // to happen with the Adobe player too.
     for (int i = 0; i < destH; ++i) {
-
-        BitmapData_as::iterator s = src;
-        BitmapData_as::iterator d = targ;
-        for (int j = 0; j < destW; ++j, ++s, ++d) {
-
-            // If multiple source channels, we set the destination channel
-            // to black. Else to the value of the requested channel.
-            const boost::uint8_t val = multiple ? 0 : getChannel(*s, srcchans);
-            *d = setChannel(*d, destchans, val);
-
-        }
+        Copier::iterator_type zip(boost::make_tuple(src, targ));
+        std::transform(zip, zip + destW, targ, c);
         targ += ptr->width();
         src += source->width();
     }

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

Summary of changes:
 NEWS                                          |    5 +-
 libcore/asobj/flash/display/BitmapData_as.cpp |   58 +++++++++++++++++++------
 testsuite/actionscript.all/BitmapData.as      |   28 +++++++++++-
 3 files changed, 74 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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