gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/server/MatrixTest.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/server/MatrixTest.cpp
Date: Fri, 04 Jan 2008 12:24:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/01/04 12:24:32

Modified files:
        .              : ChangeLog 
        testsuite/server: MatrixTest.cpp 

Log message:
                * testsuite/server/MatrixTest.cpp: add a test
                  for transforming a couple of points using
                  a translate + scale approach. This is the
                  way we should transform radial gradients
                  for beginGradientFill, probably optimizable
                  but helpful for understanding it.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5293&r2=1.5294
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/MatrixTest.cpp?cvsroot=gnash&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5293
retrieving revision 1.5294
diff -u -b -r1.5293 -r1.5294
--- ChangeLog   3 Jan 2008 17:50:24 -0000       1.5293
+++ ChangeLog   4 Jan 2008 12:24:31 -0000       1.5294
@@ -1,3 +1,12 @@
+2008-01-04 Sandro Santilli <address@hidden>
+
+       * testsuite/server/MatrixTest.cpp: add a test
+         for transforming a couple of points using
+         a translate + scale approach. This is the
+         way we should transform radial gradients
+         for beginGradientFill, probably optimizable
+         but helpful for understanding it.
+
 2008-01-03 Sandro Santilli <address@hidden>
 
        * server/sprite_instance.cpp (beginGradientFill): 

Index: testsuite/server/MatrixTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/MatrixTest.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/server/MatrixTest.cpp     1 Jul 2007 10:55:13 -0000       1.9
+++ testsuite/server/MatrixTest.cpp     4 Jan 2008 12:24:32 -0000       1.10
@@ -173,5 +173,57 @@
        check_equals(m1.get_x_translation(), 5);
        check_equals(m1.get_y_translation(), 6);
 
+       //---------------------------------------------
+       // Test transformations
+       //---------------------------------------------
+
+       point p1(0, 0);
+       point p2(64, 64);
+       point r;
+
+       m1.set_identity();
+
+       // Scale points by 1/32
+
+       m1.set_scale(20.0/64, 20.0/64);
+
+       m1.transform(&r, p1);
+       check_equals(r.x, 0);
+       check_equals(r.y, 0);
+
+       m1.transform(&r, p2);
+       check_equals(r.x, 20);
+       check_equals(r.y, 20);
+
+       // Translate points to have the origin at 32,32
+       // (coordinates expressed in prior-to-scaling matrix)
+
+       m1.concatenate_translation(-32, -32);
+
+       m1.transform(&r, p1);
+       check_equals(r.x, -10);
+       check_equals(r.y, -10);
+
+       m1.transform(&r, p2);
+       check_equals(r.x, 10);
+       check_equals(r.y, 10);
+
+       // Apply a final scaling by 10 keeping
+       // the current origin (reached after
+       // translation)
+
+       matrix final;
+       final.set_scale(10, 10);
+       final.concatenate(m1);
+       m1 = final;
+
+       m1.transform(&r, p1);
+       check_equals(r.x, -100);
+       check_equals(r.y, -100);
+
+       m1.transform(&r, p2);
+       check_equals(r.x, 100);
+       check_equals(r.y, 100);
+
 }
 




reply via email to

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