=== modified file 'libcore/DynamicShape.cpp'
--- libcore/DynamicShape.cpp	2009-04-24 11:29:44 +0000
+++ libcore/DynamicShape.cpp	2009-07-07 20:49:53 +0000
@@ -58,7 +58,24 @@
 DynamicShape::endFill()
 {
 	// Close the path
-	if ( _currpath ) _currpath->close();
+	if ( _currpath && _currfill )
+	{
+		// TODO: should not just close the last path
+		//       but rather append the point where
+		//       the fill actually begun (could be
+		//       in a previous path).
+		//
+		// NOTE that doing so will require changing 
+		// the hitTest code to do stop considering
+		// each path in isolation when doing PIP testing
+		//
+
+		_currpath->close();
+
+		// reset _x and _y to reflect closing point
+		_x = _currpath->ap.x;
+		_y = _currpath->ap.y;
+	}
 
 	// Remove reference to the "current" path, as
 	// next drawing will happen on a different one
@@ -70,12 +87,13 @@
 void
 DynamicShape::beginFill(const rgba& color)
 {
+	// End previous fill
+	endFill();
+
 	// Add the new fill style and set as current
 	fill_style style; style.setSolid(color);
-
-	endFill();
-
 	_currfill = add_fill_style(style);
+
 	// TODO: how to know wheter the fill should be set
 	//       as *left* or *right* fill ?
 	//       A quick test shows that *left* always work fine !
@@ -102,12 +120,14 @@
 void
 DynamicShape::beginRadialGradientFill(const std::vector<gradient_record>& grad, const SWFMatrix& mat)
 {
+
+	// End previous fill
+	endFill();
+
 	// Add the new fill style and set as current
 	fill_style style; style.setRadialGradient(grad, mat);
-
-	endFill();
-
 	_currfill = add_fill_style(style);
+
 	// TODO: how to know wheter the fill should be set
 	//       as *left* or *right* fill ?
 	//       A quick test shows that *left* always work fine !
@@ -119,10 +139,14 @@
 DynamicShape::startNewPath(bool newShape)
 {
 	// Close any pending filled path
-	if ( _currpath && _currfill) _currpath->close();
+	if ( _currpath && _currfill)
+	{
+		// TODO: this is probably bogus
+		_currpath->close();
+	}
 
 	// The DrawingApiTest.swf file shows we should not
-	// end the current fill when starting a new one.
+	// end the current fill when starting a new path.
 
 	// A quick test shows that *left* always work fine !
 	// More than that, using a *right* fill seems to break the tests !

=== modified file 'libcore/asobj/flash/display/MovieClip_as.cpp'
--- libcore/asobj/flash/display/MovieClip_as.cpp	2009-07-06 07:50:10 +0000
+++ libcore/asobj/flash/display/MovieClip_as.cpp	2009-07-07 19:03:51 +0000
@@ -2058,33 +2058,38 @@
     boost::intrusive_ptr<MovieClip> movieclip = 
         ensureType<MovieClip>(fn.this_ptr);
 
+    if ( fn.nargs < 1 )
+    {
+        IF_VERBOSE_ASCODING_ERRORS(
+        log_aserror("beginFill() with no args is a no-op");
+        );
+        return as_value();
+    }
+
     boost::uint8_t r = 0;
     boost::uint8_t g = 0;
     boost::uint8_t b = 0;
     boost::uint8_t a = 255;
 
-    if ( fn.nargs > 0 )
+
+    // 2^24 is the max here
+    boost::uint32_t rgbval = boost::uint32_t(
+            clamp<float>(fn.arg(0).to_number(), 0, 16777216));
+    r = boost::uint8_t( (rgbval&0xFF0000) >> 16);
+    g = boost::uint8_t( (rgbval&0x00FF00) >> 8);
+    b = boost::uint8_t( (rgbval&0x0000FF) );
+
+    if ( fn.nargs > 1 )
     {
-        // 2^24 is the max here
-        boost::uint32_t rgbval = boost::uint32_t(
-                clamp<float>(fn.arg(0).to_number(), 0, 16777216));
-        r = boost::uint8_t( (rgbval&0xFF0000) >> 16);
-        g = boost::uint8_t( (rgbval&0x00FF00) >> 8);
-        b = boost::uint8_t( (rgbval&0x0000FF) );
-
-        if ( fn.nargs > 1 )
+        a = 255 * clamp<int>(fn.arg(1).to_int(), 0, 100) / 100;
+        IF_VERBOSE_ASCODING_ERRORS(
+        if ( fn.nargs > 2 )
         {
-            a = 255 * clamp<int>(fn.arg(1).to_int(), 0, 100) / 100;
-            IF_VERBOSE_ASCODING_ERRORS(
-            if ( fn.nargs > 2 )
-            {
-                std::stringstream ss; fn.dump_args(ss);
-                log_aserror(_("MovieClip.beginFill(%s): args after the "
-                        "first will be discarded"), ss.str());
-            }
-            );
+            std::stringstream ss; fn.dump_args(ss);
+            log_aserror(_("MovieClip.beginFill(%s): args after the "
+                    "first will be discarded"), ss.str());
         }
-
+        );
     }
 
     rgba color(r, g, b, a);

