gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/Color.cpp server/c...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Color.cpp server/c...
Date: Tue, 20 May 2008 09:54:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  08/05/20 09:54:26

Modified files:
        .              : ChangeLog 
        server/asobj   : Color.cpp 
        server         : character.cpp cxform.cpp cxform.h 
                         edit_text_character.cpp 
        testsuite/actionscript.all: Color.as 

Log message:
        * server/cxform.{h,cpp}: code refactory, using integral alrithmatic for 
cxform.
        * server/character.cpp, server/edit_text_character.cpp, 
          server/asobj/Color.cpp: update to synchronize the new cxform.
        * testsuite/actionscript.all/Color.as: passing.
        
          More compatible, much faster, 50% less memory per cxform...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6654&r2=1.6655
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Color.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.100&r2=1.101
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.186&r2=1.187
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Color.as?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6654
retrieving revision 1.6655
diff -u -b -r1.6654 -r1.6655
--- ChangeLog   19 May 2008 18:17:21 -0000      1.6654
+++ ChangeLog   20 May 2008 09:54:24 -0000      1.6655
@@ -1,3 +1,11 @@
+2008-05-20 Zou Lunkai <address@hidden>
+       
+       * server/cxform.{h,cpp}: code refactory, using integral alrithmatic for 
cxform.
+       * server/character.cpp, server/edit_text_character.cpp, 
+         server/asobj/Color.cpp: update to synchronize the new cxform.
+       * testsuite/actionscript.all/Color.as: passing.
+         More compatible, much faster, 50% less memory per cxform... 
+       
 2008-05-19 Benjamin Wolsey <address@hidden>
 
        * po/ja.po: correct variable order (only one instance).

Index: server/asobj/Color.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Color.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/asobj/Color.cpp      17 Apr 2008 10:22:22 -0000      1.22
+++ server/asobj/Color.cpp      20 May 2008 09:54:25 -0000      1.23
@@ -129,15 +129,7 @@
 
        void setTransform(const cxform& newTrans) 
        {
-               if ( ! checkSprite() ) return; // nothing to do
-
-#ifdef GNASH_DEBUG_COLOR
-               stringstream ss; ss << newTrans;
-               int r = (int)newTrans.m_[0][1];
-               int g = (int)newTrans.m_[1][1];
-               int b = (int)newTrans.m_[2][1];
-               log_debug ("Color.setnewTransform set newTrans to = %d/%d/%d 
(%s)", r, g, b, ss.str().c_str());
-#endif
+               if ( ! checkSprite() ) return;
 
                _sprite->set_user_cxform(newTrans);
        }
@@ -173,12 +165,9 @@
 
        const cxform& trans = obj->getTransform();
 
-       int r = (int)trans.m_[0][1];
-       int g = (int)trans.m_[1][1];
-       int b = (int)trans.m_[2][1];
-#ifdef GNASH_DEBUG_COLOR
-       log_debug ("Color.getRGB found Color transform with rgb = %d/%d/%d 
(%f,%f,%f)", r, g, b, trans.m_[0][1], trans.m_[1][1], trans.m_[2][1]);
-#endif
+       int r = (int)trans.rb;
+       int g = (int)trans.gb;
+       int b = (int)trans.bb;
 
        boost::int32_t rgb = (r<<16) | (g<<8) | b;
 
@@ -206,15 +195,15 @@
 
        as_object* ret = new as_object(getObjectInterface());
 
-       ret->init_member("ra", int(cx.m_[0][0]*100));
-       ret->init_member("ga", int(cx.m_[1][0]*100));
-       ret->init_member("ba", int(cx.m_[2][0]*100));
-       ret->init_member("aa", int(cx.m_[3][0]*100));
-
-       ret->init_member("rb", int(cx.m_[0][1]));
-       ret->init_member("gb", int(cx.m_[1][1]));
-       ret->init_member("bb", int(cx.m_[2][1]));
-       ret->init_member("ab", int(cx.m_[3][1]));
+       ret->init_member("ra", double(cx.ra / 2.56));
+       ret->init_member("ga", double(cx.ga / 2.56));
+       ret->init_member("ba", double(cx.ba / 2.56));
+       ret->init_member("aa", double(cx.aa / 2.56));
+
+       ret->init_member("rb", int(cx.rb));
+       ret->init_member("gb", int(cx.gb));
+       ret->init_member("bb", int(cx.bb));
+       ret->init_member("ab", int(cx.ab));
 
        return ret;
 }
@@ -239,12 +228,12 @@
        int b = (color&0x0000FF);
 
        cxform newTrans = obj->getTransform();
-       newTrans.m_[0][1] = r;
-       newTrans.m_[1][1] = g;
-       newTrans.m_[2][1] = b;
-       newTrans.m_[0][0] = 0;
-       newTrans.m_[1][0] = 0;
-       newTrans.m_[2][0] = 0;
+       newTrans.rb = (boost::int16_t)r;
+       newTrans.gb = (boost::int16_t)g;
+       newTrans.bb = (boost::int16_t)b;
+       newTrans.ra = 0;
+       newTrans.ga = 0;
+       newTrans.ba = 0;
 
        obj->setTransform(newTrans);
 
@@ -252,15 +241,22 @@
 }
 
 static inline void
-parseColorTransProp (as_object& obj, string_table::key key, float *target, 
bool scale)
+parseColorTransProp (as_object& obj, string_table::key key, boost::int16_t 
*target, bool scale)
 {
        as_value tmp;
        double d;
 
-       if ( ! obj.get_member(key, &tmp) ) return;
+       if ( ! obj.get_member(key, &tmp) ) {
+        return;
+    }
+    
        d = tmp.to_number();
-       if ( scale ) *target = d/100.0;
-       else *target = d;
+       if ( scale ) {   
+        *target = (boost::int16_t)(d * 2.56);
+    }
+       else {
+        *target = (boost::int16_t)d;
+    }
 }
 
 static as_value
@@ -301,16 +297,16 @@
        cxform newTrans = obj->getTransform();
 
        // multipliers
-       parseColorTransProp(*trans, st.find("ra"), &newTrans.m_[0][0], true);
-       parseColorTransProp(*trans, st.find("ga"), &newTrans.m_[1][0], true);
-       parseColorTransProp(*trans, st.find("ba"), &newTrans.m_[2][0], true);
-       parseColorTransProp(*trans, st.find("aa"), &newTrans.m_[3][0], true);
+       parseColorTransProp(*trans, st.find("ra"), &newTrans.ra, true);
+       parseColorTransProp(*trans, st.find("ga"), &newTrans.ga, true);
+       parseColorTransProp(*trans, st.find("ba"), &newTrans.ba, true);
+       parseColorTransProp(*trans, st.find("aa"), &newTrans.aa, true);
 
        // offsets
-       parseColorTransProp(*trans, st.find("rb"), &newTrans.m_[0][1], false);
-       parseColorTransProp(*trans, st.find("gb"), &newTrans.m_[1][1], false);
-       parseColorTransProp(*trans, st.find("bb"), &newTrans.m_[2][1], false);
-       parseColorTransProp(*trans, st.find("ab"), &newTrans.m_[3][1], false);
+       parseColorTransProp(*trans, st.find("rb"), &newTrans.rb, false);
+       parseColorTransProp(*trans, st.find("gb"), &newTrans.gb, false);
+       parseColorTransProp(*trans, st.find("bb"), &newTrans.bb, false);
+       parseColorTransProp(*trans, st.find("ab"), &newTrans.ab, false);
 
        obj->setTransform(newTrans);
 

Index: server/character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -b -r1.100 -r1.101
--- server/character.cpp        17 May 2008 10:47:09 -0000      1.100
+++ server/character.cpp        20 May 2008 09:54:25 -0000      1.101
@@ -391,7 +391,7 @@
        as_value rv;
        if ( fn.nargs == 0 ) // getter
        {
-               rv = as_value(ptr->get_cxform().m_[3][0] * 100.f);
+               rv = as_value(ptr->get_cxform().aa / 2.56f);
        }
        else // setter
        {
@@ -407,9 +407,9 @@
                        );
                        return rv;
                }
-               // Set alpha modulate, in percent.
+               // set alpha = input / 100.0 * 256 = input * 2.56;
                cxform  cx = ptr->get_cxform();
-               cx.m_[3][0] = input / 100.f; // 
utility::infinite_to_fzero(input) / 100.f;
+               cx.aa = (boost::int16_t)(input * 2.56); 
                ptr->set_cxform(cx);
                ptr->transformedByScript(); // m_accept_anim_moves = false; 
        }

Index: server/cxform.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/cxform.cpp   19 May 2008 13:03:53 -0000      1.15
+++ server/cxform.cpp   20 May 2008 09:54:25 -0000      1.16
@@ -30,35 +30,32 @@
 
 namespace gnash {
 
-cxform  cxform::identity;
+using boost::uint8_t;
+using boost::int16_t;
+using utility::clamp;
 
 cxform::cxform()
 // Initialize to identity transform.    
 {
-    m_[0][0] = 1;
-    m_[1][0] = 1;
-    m_[2][0] = 1;
-    m_[3][0] = 1;
-    m_[0][1] = 0;
-    m_[1][1] = 0;
-    m_[2][1] = 0;
-    m_[3][1] = 0;
+    ra = ga = ba = aa = 256;
+    rb = gb = bb = ab = 0;
 }
 
-void    cxform::concatenate(const cxform& c)
 // Concatenate c's transform onto ours.  When
 // transforming colors, c's transform is applied
 // first, then ours.    
+void    cxform::concatenate(const cxform& c)  
 {
-    m_[0][1] += m_[0][0] * c.m_[0][1];
-    m_[1][1] += m_[1][0] * c.m_[1][1];
-    m_[2][1] += m_[2][0] * c.m_[2][1];
-    m_[3][1] += m_[3][0] * c.m_[3][1];
-
-    m_[0][0] *= c.m_[0][0];
-    m_[1][0] *= c.m_[1][0];
-    m_[2][0] *= c.m_[2][0];
-    m_[3][0] *= c.m_[3][0];
+// enbrace all the overflows intentionally.
+    rb += (ra * c.rb >> 8);
+    gb += (ga * c.gb >> 8);
+    bb += (ba * c.bb >> 8);
+    ab += (aa * c.ab >> 8);
+
+    ra = ra * c.ra >> 8;
+    ga = ga * c.ga >> 8;
+    ba = ba * c.ba >> 8;
+    aa = aa * c.aa >> 8;
 }
 
 
@@ -68,18 +65,27 @@
     rgba    result(in.m_r, in.m_g, in.m_b, in.m_a);
 
     transform(result.m_r, result.m_g, result.m_b, result.m_a);
-
     return result;
 }
 
+// transform the given color with our cxform.
 void    cxform::transform(boost::uint8_t& r, boost::uint8_t& g, 
boost::uint8_t& b, boost::uint8_t& a) const
-// Faster transform() method for loops (avoids creation of rgba object)
 {
-    using utility::clamp;
-    r = static_cast<boost::uint8_t>(clamp<float>(r * m_[0][0] + m_[0][1], 0, 
255));
-    g = static_cast<boost::uint8_t>(clamp<float>(g * m_[1][0] + m_[1][1], 0, 
255));
-    b = static_cast<boost::uint8_t>(clamp<float>(b * m_[2][0] + m_[2][1], 0, 
255));
-    a = static_cast<boost::uint8_t>(clamp<float>(a * m_[3][0] + m_[3][1], 0, 
255));
+    // force conversion to int16 first, kind of optimization.
+    int16_t rt = (int16_t)r;
+    int16_t gt = (int16_t)g;
+    int16_t bt = (int16_t)b;
+    int16_t at = (int16_t)a;
+    
+    rt = (rt * ra >> 8) + rb;
+    gt = (gt * ga >> 8) + gb;
+    bt = (bt * ba >> 8) + bb;
+    at = (at * aa >> 8) + ab;
+    
+    r = (uint8_t)(clamp<int16_t>(rt, 0, 255));
+    g = (uint8_t)(clamp<int16_t>(gt, 0, 255));
+    b = (uint8_t)(clamp<int16_t>(bt, 0, 255));
+    a = (uint8_t)(clamp<int16_t>(at, 0, 255));
 }
 
 void    cxform::read_rgb(stream& in)
@@ -102,22 +108,22 @@
     }
 
     if (has_mult) {
-        m_[0][0] = in.read_sint(nbits) / 255.0f;
-        m_[1][0] = in.read_sint(nbits) / 255.0f;
-        m_[2][0] = in.read_sint(nbits) / 255.0f;
-        m_[3][0] = 1;
+        ra = in.read_sint(nbits);
+        ga = in.read_sint(nbits);
+        ba = in.read_sint(nbits);
+        aa = 256;
     }
     else {
-        for (int i = 0; i < 4; i++) { m_[i][0] = 1; }
+        ra = ga = ba = aa = 256; 
     }
     if (has_add) {
-        m_[0][1] = (float) in.read_sint(nbits);
-        m_[1][1] = (float) in.read_sint(nbits);
-        m_[2][1] = (float) in.read_sint(nbits);
-        m_[3][1] = 1;
+        rb = in.read_sint(nbits);
+        gb = in.read_sint(nbits);
+        bb = in.read_sint(nbits);
+        ab = 0;
     }
     else {
-        for (int i = 0; i < 4; i++) { m_[i][1] = 0; }
+        rb = gb = bb = ab = 0; 
     }
 }
 
@@ -141,48 +147,33 @@
     }
 
     if (has_mult) {
-        m_[0][0] = in.read_sint(nbits) / 256.0f;
-        m_[1][0] = in.read_sint(nbits) / 256.0f;
-        m_[2][0] = in.read_sint(nbits) / 256.0f;
-        m_[3][0] = in.read_sint(nbits) / 256.0f;
+        ra = in.read_sint(nbits);
+        ga = in.read_sint(nbits);
+        ba = in.read_sint(nbits);
+        aa = in.read_sint(nbits);
     }
     else {
-        for (int i = 0; i < 4; i++) { m_[i][0] = 1; }
+        ra = ga = ba = aa = 256; 
     }
     if (has_add) {
-        m_[0][1] = (float) in.read_sint(nbits);
-        m_[1][1] = (float) in.read_sint(nbits);
-        m_[2][1] = (float) in.read_sint(nbits);
-        m_[3][1] = (float) in.read_sint(nbits);
+        rb = in.read_sint(nbits);
+        gb = in.read_sint(nbits);
+        bb = in.read_sint(nbits);
+        ab = in.read_sint(nbits);
     }
     else {
-        for (int i = 0; i < 4; i++) { m_[i][1] = 0; }
+        rb = gb = bb = ab = 0; 
     }
 }
 
-/// Force component values to be in legal range.
-void cxform::clamp()
-{
-    using utility::clamp;
-    m_[0][0] = clamp<float>(m_[0][0], 0, 1);
-    m_[1][0] = clamp<float>(m_[1][0], 0, 1);
-    m_[2][0] = clamp<float>(m_[2][0], 0, 1);
-    m_[3][0] = clamp<float>(m_[3][0], 0, 1);
-
-    m_[0][1] = clamp<float>(m_[0][1], -255.0f, 255.0f);
-    m_[1][1] = clamp<float>(m_[1][1], -255.0f, 255.0f);
-    m_[2][1] = clamp<float>(m_[2][1], -255.0f, 255.0f);
-    m_[3][1] = clamp<float>(m_[3][1], -255.0f, 255.0f);
-}
-
 void    cxform::print() const
 // Debug log.
 {
     log_parse("    *         +");
-    log_parse("| %4.4f %4.4f|", m_[0][0], m_[0][1]);
-    log_parse("| %4.4f %4.4f|", m_[1][0], m_[1][1]);
-    log_parse("| %4.4f %4.4f|", m_[2][0], m_[2][1]);
-    log_parse("| %4.4f %4.4f|", m_[3][0], m_[3][1]);
+    log_parse("| %4.4f %4.4f|", ra/256.0f, rb);
+    log_parse("| %4.4f %4.4f|", ga/256.0f, gb);
+    log_parse("| %4.4f %4.4f|", ba/256.0f, bb);
+    log_parse("| %4.4f %4.4f|", aa/256.0f, ab);
 }
 
 std::string
@@ -196,30 +187,31 @@
 std::ostream&
 operator<< (std::ostream& os, const cxform& cx) 
 {
-    os << "r: *" << cx.m_[0][0] << " +" << cx.m_[0][1] << ", ";
-    os << "|g: *" << cx.m_[1][0] << " +" << cx.m_[1][1] << ", ";
-    os << "|b: *" << cx.m_[2][0] << " +" << cx.m_[2][1] << ", ";
-    os << "|a: *" << cx.m_[3][0] << " +" << cx.m_[3][1];
+    os << "r: *"  << cx.ra  << " +" << cx.rb << ", ";
+    os << "|g: *" << cx.ga << " +" << cx.gb << ", ";
+    os << "|b: *" << cx.ba << " +" << cx.bb << ", ";
+    os << "|a: *" << cx.aa << " +" << cx.ab;
     return os;
 }
 
 bool    cxform::is_identity() const
 // Returns true when the cxform equals identity (no transform)
 {      
-    for (int a=0; a<4; a++)
-        for (int b=0; b<2; b++)
-        {
-            if (m_[a][b] != identity.m_[a][b])
-                return false;
-        }
-
-    return true;
+    return 
+        ra == 256 &&
+        rb == 0   &&
+        ga == 256 &&
+        gb == 0   &&
+        ba == 256 &&
+        bb == 0   &&
+        aa == 256 &&
+        ab == 0;
 }
 
 bool    cxform::is_invisible() const
 // Returns true when the cxform leads to alpha == 0
 {
-    return(255.0 * m_[3][0] + m_[3][1]) <= 0.0;    
+    return (255 * aa >> 8) + ab == 0;    
 }
 
 

Index: server/cxform.h
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/cxform.h     27 Mar 2008 10:50:14 -0000      1.12
+++ server/cxform.h     20 May 2008 09:54:25 -0000      1.13
@@ -31,7 +31,7 @@
 
 namespace gnash {
 
-/// Color transform type, used by render handler
+/// Color Transformation Record
 class DSOEXPORT cxform
 {
 public:
@@ -39,8 +39,14 @@
     friend bool operator== (const cxform&, const cxform&);
     friend std::ostream& operator<< (std::ostream& os, const cxform& cx);
 
-    /// [RGBA][multiply, add]
-    float      m_[4][2];
+    boost::int16_t ra; // RedMultTerm,   8.8 fixed point
+    boost::int16_t rb; // RedAddTerm,   16.0 fixed point
+    boost::int16_t ga; // GreenMultTerm  8.8 fixed point
+    boost::int16_t gb; // GreenAddTerm  16.0 fixed point
+    boost::int16_t ba; // BlueMultTerm   8.8 fixed point
+    boost::int16_t bb; // BlueAddTerm   16.0 fixed point
+    boost::int16_t aa; // AlphaMultTerm  8.8 fixed point
+    boost::int16_t ab; // AlphaAddTerm  16.0 fixed point
     
     /// Initialize to the identity color transform (no transform)
     cxform();
@@ -52,27 +58,46 @@
     ///
     void concatenate(const cxform& c);
     
-    /// Apply our transform to the given color; return the result.
+    /// Transform the given color, return the result.
     rgba transform(const rgba& in) const;
     
-    /// Faster transform() method for loops (avoids creation of rgba object)
+    /// Transform the given color.
     void transform(boost::uint8_t& r, boost::uint8_t& g, boost::uint8_t& b, 
boost::uint8_t& a) const;    
     
+    void  store_to(boost::int16_t * dst) const
+    {
+        *dst++ = ra; *dst++ = rb; 
+        *dst++ = ga; *dst++ = gb; 
+        *dst++ = ba; *dst++ = bb; 
+        *dst++ = aa; *dst++ = ab; 
+    }
+    
+    cxform & load_from(float * src)
+    {
+    // enbrace the overflows intentionally.
+        ra = (boost::int16_t)((*src++) * 2.56f);
+        rb = (boost::int16_t)(*src++);
+        ga = (boost::int16_t)((*src++) * 2.56f);
+        gb = (boost::int16_t)(*src++);
+        ba = (boost::int16_t)((*src++) * 2.56f);
+        bb = (boost::int16_t)(*src++);
+        aa = (boost::int16_t)((*src++) * 2.56f);
+        ab = (boost::int16_t)(*src++);
+        return *this;
+    }
+    
     /// Read RGB from the SWF input stream.
     void read_rgb(stream& in);
 
-    // temp hack, should drop..
+    // TODO: temp hack, should drop!
     void read_rgb(stream* in) { read_rgb(*in); }
     
     /// Read RGBA from the SWF input stream.
     void read_rgba(stream& in);
 
-    // temp hack, should drop..
+    // TODO: temp hack, should drop!
     void read_rgba(stream* in) { read_rgba(*in); }
     
-    /// Force component values to be in range.
-    void clamp();
-    
     /// Debug log.
     void print() const;
     
@@ -82,9 +107,6 @@
     /// Returns true when the cxform leads to alpha == 0
     bool is_invisible() const;
     
-    /// The identity color transform (no transform)
-    static cxform      identity;
-
     std::string toString() const;
 };
 
@@ -92,18 +114,16 @@
 inline bool operator== (const cxform& a, const cxform& b)
 {
        return  
-               a.m_[0][0] == b.m_[0][0] &&
-               a.m_[0][1] == b.m_[0][1] &&
-               a.m_[1][0] == b.m_[1][0] &&
-               a.m_[1][1] == b.m_[1][1] &&
-               a.m_[2][0] == b.m_[2][0] &&
-               a.m_[2][1] == b.m_[2][1] &&
-               a.m_[3][0] == b.m_[3][0] &&
-               a.m_[3][1] == b.m_[3][1];
+               a.ra == b.ra &&
+               a.rb == b.rb &&
+               a.ga == b.ga &&
+               a.gb == b.gb &&
+               a.ba == b.ba &&
+               a.bb == b.bb &&
+               a.aa == b.aa &&
+               a.ab == b.ab;
 }
 
-
-
 }      // namespace gnash
 
 #endif // GNASHCXFORM_H

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -b -r1.186 -r1.187
--- server/edit_text_character.cpp      19 May 2008 13:03:53 -0000      1.186
+++ server/edit_text_character.cpp      20 May 2008 09:54:25 -0000      1.187
@@ -1075,7 +1075,7 @@
                // @@ TODO this should be generic to class character!
                // Arg is in percent.
                cxform  cx = get_cxform();
-               cx.m_[3][0] = 
utility::clamp<float>(utility::infinite_to_fzero(val.to_number()) / 100.f, 0, 
1);
+               cx.aa = (boost::int16_t)(val.to_number() * 2.56);
                set_cxform(cx);
                return true;
        }
@@ -1122,7 +1122,7 @@
        {
                // @@ TODO this should be generic to class character!
                const cxform&   cx = get_cxform();
-               val->set_double(cx.m_[3][0] * 100.f);
+               val->set_double(cx.aa / 2.56);
                return true;
        }
        case NSV::PROP_uX:

Index: testsuite/actionscript.all/Color.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Color.as,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/actionscript.all/Color.as 20 May 2008 01:59:28 -0000      1.16
+++ testsuite/actionscript.all/Color.as 20 May 2008 09:54:25 -0000      1.17
@@ -22,7 +22,7 @@
 // execute it like this gnash -1 -r 0 -v out.swf
 
 
-rcsid="$Id: Color.as,v 1.16 2008/05/20 01:59:28 zoulunkai Exp $";
+rcsid="$Id: Color.as,v 1.17 2008/05/20 09:54:25 zoulunkai Exp $";
 #include "check.as"
 
 //--------------------------------
@@ -219,7 +219,7 @@
 check_equals ( trans2.ga, -50 );
 check_equals ( trans2.gb, 255 );
 // pp uses 1/256 accuracy, 31.640625 == int(0.32*256)*100/256.0f
-xcheck( trans2.ba - 31.640625 < 0.000001 ); // Don't use check_equals or 
Math.round here.
+check( trans2.ba - 31.640625 < 0.000001 ); // Don't use check_equals or 
Math.round here.
 check_equals ( trans2.bb, 2 );
 check_equals ( trans2.aa, 100 );
 check_equals ( trans2.ab, 0 );
@@ -249,7 +249,7 @@
 colorObj.setTransform(trans);
 trans2 = colorObj.getTransform();
 // 99.609375 == int(0.999*256)*100/256.0
-xcheck(trans2.ra - 99.609375 < 0.0000001); // Don't use check_equals or 
Math.round here.
+check(trans2.ra - 99.609375 < 0.0000001); // Don't use check_equals or 
Math.round here.
 check_equals(trans2.rb, 99);
 
 //




reply via email to

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