gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10739: fill_style::set_lerp : don't


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10739: fill_style::set_lerp : don't pretend that gradient bitmaps
Date: Thu, 26 Mar 2009 08:50:45 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10739
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Thu 2009-03-26 08:50:45 +0100
message:
  fill_style::set_lerp : don't pretend that gradient bitmaps
  are the same for the two shapes of a morph. Dunno if this is correct
  but was the behaviour before I merged bitmap and gradient bitmapInfo
  into one. Fixes assertion failure in bug #25998.
modified:
  libcore/fill_style.cpp
=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp    2009-03-19 16:27:50 +0000
+++ b/libcore/fill_style.cpp    2009-03-26 07:50:45 +0000
@@ -530,36 +530,54 @@
     m_type = a.get_type();
     assert(m_type == b.get_type());
 
-    // fill style color
+    // fill style color (TODO: only for solid fills ?)
     m_color.set_lerp(a.get_color(), b.get_color(), t);
 
-    // fill style gradient SWFMatrix
-    //
-    // @@ TODO morphed gradients don't come out exactly
-    // right; they shift around some.  Not sure where the
-    // problem is.
-    _matrix.set_lerp(a._matrix, b._matrix, t);
+    bool usesMatrix = false;
 
-    // fill style gradients
-    assert(m_gradients.size() == a.m_gradients.size());
-    assert(m_gradients.size() == b.m_gradients.size());
-    for (size_t j=0, nj=m_gradients.size(); j<nj; ++j)
+    switch (m_type)
     {
-        m_gradients[j].m_ratio =
-            (boost::uint8_t) frnd( flerp(a.m_gradients[j].m_ratio,
-                    b.m_gradients[j].m_ratio, t)
-                );
-        m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
-                b.m_gradients[j].m_color, t);
+        case SWF::FILL_LINEAR_GRADIENT:
+        case SWF::FILL_RADIAL_GRADIENT:
+        case SWF::FILL_FOCAL_GRADIENT:
+        {
+            usesMatrix = true;
+
+            // fill style gradients
+            assert(m_gradients.size() == a.m_gradients.size());
+            assert(m_gradients.size() == b.m_gradients.size());
+            for (size_t j=0, nj=m_gradients.size(); j<nj; ++j)
+            {
+                m_gradients[j].m_ratio =
+                    (boost::uint8_t) frnd( flerp(a.m_gradients[j].m_ratio,
+                            b.m_gradients[j].m_ratio, t)
+                        );
+                m_gradients[j].m_color.set_lerp(a.m_gradients[j].m_color,
+                        b.m_gradients[j].m_color, t);
+            }
+            _bitmapInfo = NULL;
+            break;
+        }
+
+        case SWF::FILL_TILED_BITMAP:
+        case SWF::FILL_CLIPPED_BITMAP:
+        case SWF::FILL_TILED_BITMAP_HARD:
+        case SWF::FILL_CLIPPED_BITMAP_HARD:
+        {
+            usesMatrix = true;
+
+            // fill style bitmap ID
+            _bitmapInfo = a._bitmapInfo;
+            assert(_bitmapInfo == b._bitmapInfo);
+            break;
+        }
+
+        default:
+            break;
     }
-    _bitmapInfo = NULL;
-
-    // fill style bitmap ID
-    _bitmapInfo = a._bitmapInfo;
-    assert(_bitmapInfo == b._bitmapInfo);
-
-    // fill style bitmap SWFMatrix
-    _matrix.set_lerp(a._matrix, b._matrix, t);
+
+    // fill style bitmap or gradient SWFMatrix
+    if ( usesMatrix ) _matrix.set_lerp(a._matrix, b._matrix, t);
 }
 
 


reply via email to

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