gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...
Date: Tue, 04 Mar 2008 11:04:35 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/03/04 11:04:35

Modified files:
        .              : ChangeLog 
        server         : sprite_instance.cpp 
        testsuite/misc-ming.all: DrawingApiTest.as 

Log message:
                * server/sprite_instance.cpp: check arguments of drawing api
                  functions for being finite.
                * testsuite/misc-ming.all/DrawingApiTest.as: test passing
                  non-finite parameters to the drawing api.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5795&r2=1.5796
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.481&r2=1.482
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DrawingApiTest.as?cvsroot=gnash&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5795
retrieving revision 1.5796
diff -u -b -r1.5795 -r1.5796
--- ChangeLog   4 Mar 2008 10:55:56 -0000       1.5795
+++ ChangeLog   4 Mar 2008 11:04:34 -0000       1.5796
@@ -1,3 +1,10 @@
+2008-03-04 Sandro Santilli <address@hidden>
+
+       * server/sprite_instance.cpp: check arguments of drawing api
+         functions for being finite.
+       * testsuite/misc-ming.all/DrawingApiTest.as: test passing
+         non-finite parameters to the drawing api.
+
 2008-03-04 Bastiaan Jacques <address@hidden>
 
        * testsuite/server/AsValueTest.cpp: Quick test for isnan and isinf.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.481
retrieving revision 1.482
diff -u -b -r1.481 -r1.482
--- server/sprite_instance.cpp  28 Feb 2008 11:18:36 -0000      1.481
+++ server/sprite_instance.cpp  4 Mar 2008 11:04:35 -0000       1.482
@@ -1249,6 +1249,28 @@
   float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
   float y = PIXELS_TO_TWIPS(fn.arg(1).to_number());
 
+  if ( ! isfinite(x) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.lineTo(%s) : non-finite first argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(0).to_debug_string().c_str());
+    );
+    x = 0;
+  }
+   
+  if ( ! isfinite(y) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.lineTo(%s) : non-finite second argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(1).to_debug_string().c_str());
+    );
+    y = 0;
+  }
+
 #ifdef DEBUG_DRAWING_API
   log_debug("%s.lineTo(%g,%g);", sprite->getTarget().c_str(), x, y);
 #endif
@@ -1273,6 +1295,28 @@
   float x = PIXELS_TO_TWIPS(fn.arg(0).to_number());
   float y = PIXELS_TO_TWIPS(fn.arg(1).to_number());
 
+  if ( ! isfinite(x) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.moveTo(%s) : non-finite first argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(0).to_debug_string().c_str());
+    );
+    x = 0;
+  }
+   
+  if ( ! isfinite(y) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.moveTo(%s) : non-finite second argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(1).to_debug_string().c_str());
+    );
+    y = 0;
+  }
+
 #ifdef DEBUG_DRAWING_API
   log_debug("%s.moveTo(%g,%g);", sprite->getTarget().c_str(), x, y);
 #endif
@@ -1346,6 +1390,50 @@
   float ax = PIXELS_TO_TWIPS(fn.arg(2).to_number());
   float ay = PIXELS_TO_TWIPS(fn.arg(3).to_number());
 
+  if ( ! isfinite(cx) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.curveTo(%s) : non-finite first argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(0).to_debug_string().c_str());
+    );
+    cx = 0;
+  }
+   
+  if ( ! isfinite(cy) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.curveTo(%s) : non-finite second argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(1).to_debug_string().c_str());
+    );
+    cy = 0;
+  }
+
+  if ( ! isfinite(ax) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.curveTo(%s) : non-finite third argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(0).to_debug_string().c_str());
+    );
+    ax = 0;
+  }
+   
+  if ( ! isfinite(ay) )
+  {
+    IF_VERBOSE_ASCODING_ERRORS(
+    std::stringstream ss; fn.dump_args(ss);
+    log_aserror("%s.curveTo(%s) : non-finite fourth argument (%s), "
+      "converted to zero", sprite->getTarget().c_str(),
+      ss.str().c_str(), fn.arg(1).to_debug_string().c_str());
+    );
+    ay = 0;
+  }
+
 #ifdef DEBUG_DRAWING_API
   log_debug("%s.curveTo(%g,%g,%g,%g);", sprite->getTarget().c_str(), cx, cy, 
ax, ay);
 #endif

Index: testsuite/misc-ming.all/DrawingApiTest.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/DrawingApiTest.as,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- testsuite/misc-ming.all/DrawingApiTest.as   8 Jan 2008 21:53:43 -0000       
1.32
+++ testsuite/misc-ming.all/DrawingApiTest.as   4 Mar 2008 11:04:35 -0000       
1.33
@@ -17,7 +17,7 @@
 // 'h' toggles _visible
 //
 
-rcsid="$Id: DrawingApiTest.as,v 1.32 2008/01/08 21:53:43 strk Exp $";
+rcsid="$Id: DrawingApiTest.as,v 1.33 2008/03/04 11:04:35 strk Exp $";
 
 #include "../actionscript.all/check.as"
 
@@ -228,6 +228,29 @@
        check( zshape.hitTest((223+25), (145+20), true) ); // 3
        check( zshape.hitTest(273, 165, true) ); // 4
 
+       createEmptyMovieClip("x", 20);
+       with (x)
+       {
+               lineStyle(6, 0xFF8800);
+               beginFill(0x888800, 100);
+               moveTo(100, 100);
+               lineTo("string", NaN); // equivalent to 0, 0
+               curveTo(100, "string", Object, 100); // equivalent to 100, 0, 
0, 100
+               moteTo(undefined, 0); // equivalent to 0, 0
+               lineTo(100, null);
+               endFill();
+       }
+       x._x = 100;
+       x._y = 150;
+       x._xscale = 30;
+       x._yscale = 30;
+#if 0 // TODO: check these
+       check( x.hitTest(223, 145, true) ); 
+       check( x.hitTest((223+10), (145+0), true) ); 
+       check( x.hitTest((223+20), (145+5), true) ); 
+       check( x.hitTest((223+25), (145+20), true) ); 
+       check( x.hitTest(273, 165, true) ); 
+#endif
 }
 
 // Make the MovieClip "active" (grabbing mouse events)




reply via email to

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