[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/cxform.cpp server/cxform...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/cxform.cpp server/cxform... |
Date: |
Wed, 21 May 2008 07:26:09 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 08/05/21 07:26:09
Modified files:
. : ChangeLog
server : cxform.cpp cxform.h
testsuite/actionscript.all: Color.as
Log message:
* server/cxform.{h,cpp}: docs, minor cleanup.
* testsuite/actionscript.all/color.as: more accuracy tests.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6658&r2=1.6659
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.h?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Color.as?cvsroot=gnash&r1=1.17&r2=1.18
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6658
retrieving revision 1.6659
diff -u -b -r1.6658 -r1.6659
--- ChangeLog 21 May 2008 06:46:41 -0000 1.6658
+++ ChangeLog 21 May 2008 07:26:07 -0000 1.6659
@@ -1,3 +1,8 @@
+2008-05-21 Zou Lunkai <address@hidden>
+
+ * server/cxform.{h,cpp}: docs, minor cleanup.
+ * testsuite/actionscript.all/color.as: more accuracy tests.
+
2008-05-21 Sandro Santilli <address@hidden>
* cygnal/Makefile.am, utilities/Makefile.am: add LIBINTL
Index: server/cxform.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/cxform.cpp 20 May 2008 09:54:25 -0000 1.16
+++ server/cxform.cpp 21 May 2008 07:26:08 -0000 1.17
@@ -41,12 +41,12 @@
rb = gb = bb = ab = 0;
}
-// Concatenate c's transform onto ours. When
+// Concatenate cxform c onto ours. When
// transforming colors, c's transform is applied
// first, then ours.
void cxform::concatenate(const cxform& c)
{
-// enbrace all the overflows intentionally.
+ // enbrace all the overflows intentionally.
rb += (ra * c.rb >> 8);
gb += (ga * c.gb >> 8);
bb += (ba * c.bb >> 8);
@@ -170,10 +170,10 @@
// Debug log.
{
log_parse(" * +");
- 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);
+ log_parse("| %4.4f %4.4f|", ra/256.0, rb);
+ log_parse("| %4.4f %4.4f|", ga/256.0, gb);
+ log_parse("| %4.4f %4.4f|", ba/256.0, bb);
+ log_parse("| %4.4f %4.4f|", aa/256.0, ab);
}
std::string
Index: server/cxform.h
===================================================================
RCS file: /sources/gnash/gnash/server/cxform.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/cxform.h 20 May 2008 09:54:25 -0000 1.13
+++ server/cxform.h 21 May 2008 07:26:08 -0000 1.14
@@ -36,22 +36,19 @@
{
public:
- friend bool operator== (const cxform&, const cxform&);
- friend std::ostream& operator<< (std::ostream& os, const cxform& cx);
-
boost::int16_t ra; // RedMultTerm, 8.8 fixed point
- boost::int16_t rb; // RedAddTerm, 16.0 fixed point
+ boost::int16_t rb; // RedAddTerm, 16 bit integer(no fraction)
boost::int16_t ga; // GreenMultTerm 8.8 fixed point
- boost::int16_t gb; // GreenAddTerm 16.0 fixed point
+ boost::int16_t gb; // GreenAddTerm 16 bit integer(no fraction)
boost::int16_t ba; // BlueMultTerm 8.8 fixed point
- boost::int16_t bb; // BlueAddTerm 16.0 fixed point
+ boost::int16_t bb; // BlueAddTerm 16 bit integer(no fraction)
boost::int16_t aa; // AlphaMultTerm 8.8 fixed point
- boost::int16_t ab; // AlphaAddTerm 16.0 fixed point
+ boost::int16_t ab; // AlphaAddTerm 16 bit integer(no fraction)
/// Initialize to the identity color transform (no transform)
cxform();
- /// Concatenate c's transform onto ours.
+ /// Concatenate cxform c onto ours.
//
/// When transforming colors, c's transform is applied
/// first, then ours.
@@ -64,6 +61,7 @@
/// Transform the given color.
void transform(boost::uint8_t& r, boost::uint8_t& g, boost::uint8_t& b,
boost::uint8_t& a) const;
+ /// Store the cxform record to an external array.
void store_to(boost::int16_t * dst) const
{
*dst++ = ra; *dst++ = rb;
@@ -72,6 +70,7 @@
*dst++ = aa; *dst++ = ab;
}
+ /// Load an cxform record from an external array.
cxform & load_from(float * src)
{
// enbrace the overflows intentionally.
@@ -86,28 +85,37 @@
return *this;
}
+ /// Returns true when the cxform equals identity (no transform).
+ bool is_identity() const;
+
+ /// Returns true when the cxform leads to alpha == 0
+ //
+ /// Not the _alpha property, but the visible alpha related to dislpay.
+ /// The two might be completely diffrent. eg. mc._alpha ranges in [-32768,
32767]
+ /// But the alpha on screen ranges in [0, 255]
+ bool is_invisible() const;
+
/// Read RGB from the SWF input stream.
void read_rgb(stream& in);
// TODO: temp hack, should drop!
+ // why read_xxx(stream *) and read_xxx(stream &) are mixed together?
void read_rgb(stream* in) { read_rgb(*in); }
/// Read RGBA from the SWF input stream.
void read_rgba(stream& in);
// TODO: temp hack, should drop!
+ // why read_xxx(stream *) and read_xxx(stream &) are mixed together?
void read_rgba(stream* in) { read_rgba(*in); }
- /// Debug log.
- void print() const;
-
- /// Returns true when the cxform equals identity (no transform)
- bool is_identity() const;
+ friend bool operator== (const cxform&, const cxform&);
- /// Returns true when the cxform leads to alpha == 0
- bool is_invisible() const;
+ friend std::ostream& operator<< (std::ostream& os, const cxform& cx);
std::string toString() const;
+
+ void print() const;
};
Index: testsuite/actionscript.all/Color.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Color.as,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- testsuite/actionscript.all/Color.as 20 May 2008 09:54:25 -0000 1.17
+++ testsuite/actionscript.all/Color.as 21 May 2008 07:26:09 -0000 1.18
@@ -22,7 +22,7 @@
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Color.as,v 1.17 2008/05/20 09:54:25 zoulunkai Exp $";
+rcsid="$Id: Color.as,v 1.18 2008/05/21 07:26:09 zoulunkai Exp $";
#include "check.as"
//--------------------------------
@@ -252,6 +252,24 @@
check(trans2.ra - 99.609375 < 0.0000001); // Don't use check_equals or
Math.round here.
check_equals(trans2.rb, 99);
+#if OUTPUT_VERSION >= 6
+trans.aa = 12800; // 0x80 * 100
+trans.ab = 0;
+_root.createEmptyMovieClip("mc1", 10);
+check_equals(mc1._alpha, 100);
+colorObj = new Color(mc1);
+colorObj.setTransform(trans);
+trans2 = colorObj.getTransform();
+// (int16)(12800 / 100.0 * 256) == -12800
+// Gnash failed, but not due to accuracy problem,
+// _alpha is not calculated correctly.
+xcheck_equals(mc1._alpha, -12800);
+
+trans.ab = 10;
+// _alpha is not calculated correctly. Not sure about the algorithm at the
moment.
+xcheck_equals(mc1._alpha, -12800);
+#endif
+
//
// Some tests for same-named (case-insensitive) variables in SWF6
//
- [Gnash-commit] gnash ChangeLog server/cxform.cpp server/cxform...,
Zou Lunkai <=