gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10544: Another OpenBSD build fix an


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10544: Another OpenBSD build fix and some tests for blendMode confirming the
Date: Thu, 15 Jan 2009 12:52:05 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10544
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-01-15 12:52:05 +0100
message:
  Another OpenBSD build fix and some tests for blendMode confirming the
  way it was implemented was correct (large numbers do not truncate).
modified:
  libcore/character.cpp
  testsuite/actionscript.all/MovieClip.as
    ------------------------------------------------------------
    revno: 10541.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-01-15 12:26:44 +0100
    message:
      Add some more tests for blendMode argument, and cast to int before casting
      to BlendMode because OpenBSD's compiler can't do double to BlendMode.
    modified:
      libcore/character.cpp
      testsuite/actionscript.all/MovieClip.as
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2009-01-14 08:50:47 +0000
+++ b/libcore/character.cpp     2009-01-15 11:26:44 +0000
@@ -555,8 +555,7 @@
 as_value
 character::blendMode(const fn_call& fn)
 {
-    boost::intrusive_ptr<character> ch =
-        ensureType<character>(fn.this_ptr);
+    boost::intrusive_ptr<character> ch = ensureType<character>(fn.this_ptr);
 
     // This is AS-correct, but doesn't do anything.
     // TODO: implement in the renderers!
@@ -591,14 +590,16 @@
     if (bm.is_number()) {
         double mode = bm.to_number();
 
-        // hardlight is the last known value
+        // Hardlight is the last known value. This also performs range checking
+        // for float-to-int conversion.
         if (mode < 0 || mode > BLENDMODE_HARDLIGHT) {
 
             // An invalid numeric argument becomes undefined.
             ch->setBlendMode(BLENDMODE_UNDEFINED);
         }
         else {
-            ch->setBlendMode(static_cast<BlendMode>(mode));
+            /// The extra static cast is required to keep OpenBSD happy.
+            ch->setBlendMode(static_cast<BlendMode>(static_cast<int>(mode)));
         }
         return as_value();
     }

=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as   2008-12-05 09:58:55 +0000
+++ b/testsuite/actionscript.all/MovieClip.as   2009-01-15 11:26:44 +0000
@@ -123,7 +123,7 @@
 #endif
 
 #if OUTPUT_VERSION >= 8
-       check_totals(936); // SWF8+
+       check_totals(938); // SWF8+
 #endif
 
        play();
@@ -2195,6 +2195,10 @@
 check_equals(_root.blendMode, "darken");
 _root.blendMode = -1;
 check_equals(_root.blendMode, undefined);
+_root.blendMode = 0xffffffff;
+check_equals(_root.blendMode, undefined);
+_root.blendMode = -0xffffffff;
+check_equals(_root.blendMode, undefined);
 _root.blendMode = 5.5;
 check_equals(_root.blendMode, "lighten");
 _root.blendMode = "NORMAL";


reply via email to

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