gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11226: first pass at drawing api fi


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11226: first pass at drawing api fixes, 6 XPASS, no failures
Date: Wed, 08 Jul 2009 12:42:36 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11226
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-08 12:42:36 +0200
message:
  first pass at drawing api fixes, 6 XPASS, no failures
modified:
  libcore/DynamicShape.cpp
  libcore/asobj/flash/display/MovieClip_as.cpp
    ------------------------------------------------------------
    revno: 11215.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Tue 2009-07-07 22:56:30 +0200
    message:
      beginFill() with no arg should be a no-op
    modified:
      libcore/asobj/flash/display/MovieClip_as.cpp
    ------------------------------------------------------------
    revno: 11215.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Tue 2009-07-07 23:03:53 +0200
    message:
      Don't close a path on endFill if no fill is in effect; reset cursor 
coordinate when closing a path.
    modified:
      libcore/DynamicShape.cpp
=== modified file 'libcore/DynamicShape.cpp'
--- a/libcore/DynamicShape.cpp  2009-04-24 11:29:44 +0000
+++ b/libcore/DynamicShape.cpp  2009-07-07 21:03: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'
--- a/libcore/asobj/flash/display/MovieClip_as.cpp      2009-07-06 07:50:10 
+0000
+++ b/libcore/asobj/flash/display/MovieClip_as.cpp      2009-07-07 20:56:30 
+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);


reply via email to

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