gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9842: Bugfixes to and more tests fo


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9842: Bugfixes to and more tests for flash.geom.Transform class.
Date: Thu, 25 Sep 2008 15:03:42 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9842
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2008-09-25 15:03:42 +0200
message:
  Bugfixes to and more tests for flash.geom.Transform class.
modified:
  libcore/asobj/flash/geom/Transform_as.cpp
  libcore/asobj/flash/geom_pkg.cpp
  libcore/asobj/flash/geom_pkg.h
  testsuite/actionscript.all/Transform.as
  testsuite/swfdec/PASSING
    ------------------------------------------------------------
    revno: 9839.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 13:31:52 +0200
    message:
      Test for extreme cxform values.
    modified:
      testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9839.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 14:17:23 +0200
    message:
      Update totals, expect failure.
    modified:
      testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9839.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 14:17:45 +0200
    message:
      Use proper header guard.
    modified:
      libcore/asobj/flash/geom_pkg.h
    ------------------------------------------------------------
    revno: 9839.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 14:28:00 +0200
    message:
      Truncate large double cxform values as required (should also fix the 
compiler
      warnings that occur on some machines).
      
      Test for extreme values in ColorTransform passes.
    modified:
      libcore/asobj/flash/geom/Transform_as.cpp
      testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9839.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 14:29:38 +0200
    message:
      The Transform class is available for SWF7 and below, so revert the
      commit that stopped initializing it. This gives failures for swfdec SWF6 
and
      SWF7 ColorTransform (they expect undefined values), but XPASSes in swfdec
      and actionscript.all.
      
      It's better if something is there when it's not supposed to be than the
      other way round.
    modified:
      libcore/asobj/flash/geom_pkg.cpp
    ------------------------------------------------------------
    revno: 9839.1.7
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 14:58:38 +0200
    message:
      Correct result for SWF5.
    modified:
      testsuite/actionscript.all/Transform.as
    ------------------------------------------------------------
    revno: 9839.1.8
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2008-09-25 15:03:08 +0200
    message:
      Update test results.
    modified:
      testsuite/swfdec/PASSING
=== modified file 'libcore/asobj/flash/geom/Transform_as.cpp'
--- a/libcore/asobj/flash/geom/Transform_as.cpp 2008-09-25 07:01:28 +0000
+++ b/libcore/asobj/flash/geom/Transform_as.cpp 2008-09-25 12:28:00 +0000
@@ -34,6 +34,7 @@
 #include "ColorTransform_as.h"
 
 #include <sstream>
+#include <limits>
 
 namespace gnash {
 
@@ -123,6 +124,20 @@
 
 };
 
+// Handle overflows from AS ColorTransform double. Doubtful
+// whether it will really be inlined, but that's the compiler's
+// business.
+static inline boost::int16_t
+truncateDouble(double d)
+{
+
+    if (d > std::numeric_limits<boost::int16_t>::max() ||
+        d < std::numeric_limits<boost::int16_t>::min())
+    {
+       return std::numeric_limits<boost::int16_t>::min();
+    }
+    return static_cast<boost::int16_t>(d);
+}
 
 static as_value
 Transform_colorTransform_getset(const fn_call& fn)
@@ -130,12 +145,8 @@
 
     const double factor = 256.0;
 
-    // TODO: What happens if you do: "mat = mc.transform.matrix; mat.a = 6;"
-    // (where mc is a MovieClip)? Nothing (probable), or does it change mc (how
-    // would that work?)?
-    // This should work by passing a new matrix, in which case we should just
-    // set our _movieClip's matrix from the AS matrix.
-       boost::intrusive_ptr<Transform_as> ptr = 
ensureType<Transform_as>(fn.this_ptr);
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
 
     VM& vm = ptr->getVM();
     string_table& st = vm.getStringTable();
@@ -215,7 +226,8 @@
         IF_VERBOSE_ASCODING_ERRORS(
             std::ostringstream ss;
             fn.dump_args(ss);
-            log_aserror("Transform.colorTransform(%s): extra arguments 
discarded", ss.str());
+            log_aserror("Transform.colorTransform(%s): extra arguments "
+                "discarded", ss.str());
         );
     }
 
@@ -225,35 +237,36 @@
         IF_VERBOSE_ASCODING_ERRORS(
             std::ostringstream ss;
             fn.dump_args(ss);
-            log_aserror("Transform.colorTransform(%s): argument is not an 
object", ss.str());
+            log_aserror("Transform.colorTransform(%s): argument is not an "
+                "object", ss.str());
         );
         return as_value();
     }
     
-    // TODO: check whether this is necessary (probable), or whether it can be 
any object.
+    // TODO: check whether this is necessary (probable), 
+    // or whether it can be any object.
     boost::intrusive_ptr<ColorTransform_as> transform = 
dynamic_cast<ColorTransform_as*>(obj.get());
     if (!transform)
     {
         IF_VERBOSE_ASCODING_ERRORS(
             std::ostringstream ss;
             fn.dump_args(ss);
-            log_aserror("Transform.colorTransform(%s): argument is not a 
ColorTransform", ss.str());
+            log_aserror("Transform.colorTransform(%s): argument is not a "
+                "ColorTransform", ss.str());
         );
         return as_value();
     }
     
     cxform c;
-    c.ra = transform->getRedMultiplier() * factor;
-    c.ga = transform->getGreenMultiplier() * factor;
-    c.ba = transform->getBlueMultiplier() * factor;
-    c.aa = transform->getAlphaMultiplier() * factor;
-    c.rb = transform->getRedOffset();
-    c.gb = transform->getGreenOffset();
-    c.bb = transform->getBlueOffset();
-    c.ab = transform->getAlphaOffset();
+    c.ra = truncateDouble(transform->getRedMultiplier() * factor);
+    c.ga = truncateDouble(transform->getGreenMultiplier() * factor);
+    c.ba = truncateDouble(transform->getBlueMultiplier() * factor);
+    c.aa = truncateDouble(transform->getAlphaMultiplier() * factor);
+    c.rb = truncateDouble(transform->getRedOffset());
+    c.gb = truncateDouble(transform->getGreenOffset());
+    c.bb = truncateDouble(transform->getBlueOffset());
+    c.ab = truncateDouble(transform->getAlphaOffset());
   
-    log_debug("Setting MovieClip cxform to: %s", c);
-    
     ptr->setColorTransform(c);
     
     return as_value();
@@ -262,7 +275,8 @@
 static as_value
 Transform_concatenatedColorTransform_getset(const fn_call& fn)
 {
-       boost::intrusive_ptr<Transform_as> ptr = 
ensureType<Transform_as>(fn.this_ptr);
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
        UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
@@ -271,7 +285,8 @@
 static as_value
 Transform_concatenatedMatrix_getset(const fn_call& fn)
 {
-       boost::intrusive_ptr<Transform_as> ptr = 
ensureType<Transform_as>(fn.this_ptr);
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
        UNUSED(ptr);
        LOG_ONCE( log_unimpl (__FUNCTION__) );
        return as_value();
@@ -288,7 +303,8 @@
     // would that work?)?
     // This should work by passing a new matrix, in which case we should just
     // set our _movieClip's matrix from the AS matrix.
-       boost::intrusive_ptr<Transform_as> ptr = 
ensureType<Transform_as>(fn.this_ptr);
+       boost::intrusive_ptr<Transform_as> ptr = 
+        ensureType<Transform_as>(fn.this_ptr);
 
     VM& vm = ptr->getVM();
     string_table& st = vm.getStringTable();
@@ -479,7 +495,8 @@
 
        // Register _global.Transform
     string_table& st = where.getVM().getStringTable();
-    where.init_destructive_property(st.find("Transform"), 
get_flash_geom_transform_constructor);
+    where.init_destructive_property(st.find("Transform"), 
+                   get_flash_geom_transform_constructor);
 
 }
 

=== modified file 'libcore/asobj/flash/geom_pkg.cpp'
--- a/libcore/asobj/flash/geom_pkg.cpp  2008-09-23 08:13:54 +0000
+++ b/libcore/asobj/flash/geom_pkg.cpp  2008-09-25 12:29:38 +0000
@@ -44,11 +44,6 @@
        Matrix_class_init(*pkg);
        Point_class_init(*pkg);
        Rectangle_class_init(*pkg);
-
-    // Transform is never available below SWF7, even
-    // when prop flags are set.        
-       if (version < 8) return pkg;
-               
        Transform_class_init(*pkg);
 
        return pkg;

=== modified file 'libcore/asobj/flash/geom_pkg.h'
--- a/libcore/asobj/flash/geom_pkg.h    2008-05-05 07:57:26 +0000
+++ b/libcore/asobj/flash/geom_pkg.h    2008-09-25 12:17:45 +0000
@@ -15,8 +15,8 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#ifndef __FLASH_GEOM_PACKAGE_H__
-#define __FLASH_GEOM_PACKAGE_H__
+#ifndef GNASH_FLASH_GEOM_PACKAGE_H
+#define GNASH_FLASH_GEOM_PACKAGE_H
 
 namespace gnash {
 

=== modified file 'testsuite/actionscript.all/Transform.as'
--- a/testsuite/actionscript.all/Transform.as   2008-09-22 16:07:20 +0000
+++ b/testsuite/actionscript.all/Transform.as   2008-09-25 12:58:38 +0000
@@ -27,7 +27,11 @@
 ASSetPropFlags (_global, "flash", 0, 5248);
 
 #if OUTPUT_VERSION < 8
-check_equals(flash.geom.Transform, undefined);
+# if OUTPUT_VERSION < 6 
+check_equals(typeOf(flash.geom.Transform), "undefined");
+# else
+check_equals(typeOf(flash.geom.Transform), "function");
+# endif
 totals(1);
 #else
 
@@ -96,6 +100,9 @@
 mcx.transform.colorTransform = r;
 check_equals(mcx.transform.colorTransform.toString(), "(redMultiplier=0, 
greenMultiplier=1, blueMultiplier=1, alphaMultiplier=1, redOffset=0, 
greenOffset=0, blueOffset=255, alphaOffset=0)");
 
+r = new ColorTransform(5e-67, 2342341, 11234112, -287394874978, 1222222, 
2342343434, 255, 4e+5);
+mcx.transform.colorTransform = r;
+check_equals(mcx.transform.colorTransform.toString(), "(redMultiplier=0, 
greenMultiplier=-128, blueMultiplier=-128, alphaMultiplier=-128, 
redOffset=-32768, greenOffset=-32768, blueOffset=255, alphaOffset=-32768)");
 
 
 // Tricks with the flash package:
@@ -196,5 +203,5 @@
 xcheck_equals(mcOld.transform.matrix.toString(), "(a=4, b=0.300000011920929, 
c=0.300000011920929, d=1, tx=1, ty=0)");
 
 
-totals(63);
+totals(64);
 #endif

=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING  2008-09-25 09:17:24 +0000
+++ b/testsuite/swfdec/PASSING  2008-09-25 13:03:08 +0000
@@ -1092,13 +1092,12 @@
 totalframes.swf:cdc0d5e2017d293438ef80fa136c44e8
 transform2.swf:95d19c9ed6592c459d7f6836a0365df2
 transform-color-transform-5.swf:1b03afaa179024037f5d167556b3f7a9
-transform-color-transform-6.swf:8cfd79068cc9d51db8796bb27186bbda
-transform-color-transform-7.swf:bd48f8529157f81c30caca47ce6bb871
 Transform-matrix-5.swf:ae65136f5adbcd6dfec68760f7d1d7b4
 Transform-matrix-6.swf:45c037253c5fbac0a80753a5d194f60c
 Transform-matrix-7.swf:c4110453b8151dd87efff882e5b312ca
 transform-properties-5.swf:9332e41f53db6ec456387efffd9e12a7
 transform-properties-5.swf:b0386824584340e1d0a80f986ce779b9
+transform-properties-7.swf:3b06ecd463038959132e9cae56e58b3b
 transform-properties-8.swf:47331702f04553a41f57842ebfd081f8
 transform.swf:5c8533f9168ca3e92d000ce1693ed5ef
 try-6.swf:f9672870259f993617e5e41cf2e0bb95


reply via email to

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