gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. adf728eb64ecfd82031e


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. adf728eb64ecfd82031ed6a00574f63788f706f0
Date: Fri, 10 Sep 2010 07:33:17 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  adf728eb64ecfd82031ed6a00574f63788f706f0 (commit)
       via  dbc709b8e88e7523bb17707b3d6c31a446c5a2aa (commit)
       via  76b62bd24644028c402d17e4181684a5300533d6 (commit)
       via  4ce14e3e0787b222354bc6a6011615b3de9c6210 (commit)
       via  233d390a4b88799406e711ac6fc0c3956fd8a8dc (commit)
       via  195be88a568a944bc78b691a72fb7603dc5630c1 (commit)
      from  bd098819ba1eb9e4649488b7b40a89e903996e57 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=adf728eb64ecfd82031ed6a00574f63788f706f0


commit adf728eb64ecfd82031ed6a00574f63788f706f0
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 09:09:38 2010 +0200

    Boost date time isn't required.

diff --git a/macros/boost.m4 b/macros/boost.m4
index 2782055..627d59a 100644
--- a/macros/boost.m4
+++ b/macros/boost.m4
@@ -36,11 +36,11 @@ AC_DEFUN([GNASH_PATH_BOOST],
   boost_headers="detail/lightweight_mutex.hpp thread/thread.hpp 
multi_index_container.hpp multi_index/key_extractors.hpp thread/mutex.hpp"
   dnl this is a list of *required* libraries. If any of these are missing, this
   dnl test will return a failure, and Gnash won't build.
-  boost_libs="thread date_time"
+  boost_libs="thread"
 
   dnl this is a list of *recommended* libraries. If any of these are missing, 
this
   dnl test will return a warning, and Gnash will build, but testing won't work.
-  extra_boost_libs="serialization"
+  extra_boost_libs="serialization date_time"
 #  extra_boost_libs="unit_test_framework"
 
   dnl this is the default list for paths to search. This gets

http://git.savannah.gnu.org/cgit//commit/?id=dbc709b8e88e7523bb17707b3d6c31a446c5a2aa


commit dbc709b8e88e7523bb17707b3d6c31a446c5a2aa
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 09:06:26 2010 +0200

    Use extern "C" to be on the safe side.

diff --git a/libbase/zlib_adapter.cpp b/libbase/zlib_adapter.cpp
index c85d9e6..8fb3b53 100644
--- a/libbase/zlib_adapter.cpp
+++ b/libbase/zlib_adapter.cpp
@@ -41,9 +41,9 @@ namespace zlib_adapter
 
 #else // HAVE_ZLIB_H
 
-
+extern "C" {
 #include <zlib.h>
-
+}
 
 namespace zlib_adapter
 {

http://git.savannah.gnu.org/cgit//commit/?id=76b62bd24644028c402d17e4181684a5300533d6


commit 76b62bd24644028c402d17e4181684a5300533d6
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 08:59:40 2010 +0200

    Fix typo, clean up.

diff --git a/libcore/FillStyle.cpp b/libcore/FillStyle.cpp
index e5ea0ff..af80a63 100644
--- a/libcore/FillStyle.cpp
+++ b/libcore/FillStyle.cpp
@@ -24,7 +24,6 @@
 
 #include "smart_ptr.h"
 #include "CachedBitmap.h"
-#include "log.h"
 #include "movie_definition.h"
 #include "SWF.h"
 #include "GnashNumeric.h"
diff --git a/libcore/FillStyle.h b/libcore/FillStyle.h
index ade6b3e..927a3c7 100644
--- a/libcore/FillStyle.h
+++ b/libcore/FillStyle.h
@@ -31,8 +31,6 @@
 
 namespace gnash {
     class movie_definition;
-    class Renderer;
-    class RunResources;
     class CachedBitmap;
 }
 
diff --git a/libcore/parser/TypesParser.cpp b/libcore/parser/TypesParser.cpp
index 4996940..341d582 100644
--- a/libcore/parser/TypesParser.cpp
+++ b/libcore/parser/TypesParser.cpp
@@ -20,6 +20,7 @@
 #include "TypesParser.h"
 
 #include <boost/optional.hpp>
+#include <utility>
 
 #include "GnashException.h"
 #include "SWF.h"
@@ -145,7 +146,7 @@ readRect(SWFStream& in)
         );
         return SWFRect();
     } 
-    return SWFRect(minx, maxx, miny, maxy);
+    return SWFRect(minx, miny, maxx, maxy);
 }
 
 OptionalFillPair
@@ -244,7 +245,6 @@ readFills(SWFStream& in, SWF::TagType t, movie_definition& 
md, bool readMorph)
                 boost::get<GradientFill>(morph->fill).setRecords(morphrecs);
             }
 
-
             if (t == SWF::DEFINESHAPE4 || t == SWF::DEFINESHAPE4_) {
 
                 const SWF::SpreadMode spread =

http://git.savannah.gnu.org/cgit//commit/?id=4ce14e3e0787b222354bc6a6011615b3de9c6210


commit 4ce14e3e0787b222354bc6a6011615b3de9c6210
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 08:39:39 2010 +0200

    Move fill style parsing, fix many includes.

diff --git a/libcore/FillStyle.cpp b/libcore/FillStyle.cpp
index 782dc56..e5ea0ff 100644
--- a/libcore/FillStyle.cpp
+++ b/libcore/FillStyle.cpp
@@ -21,32 +21,18 @@
 
 #include <iostream> 
 #include <boost/variant.hpp>
-#include <boost/optional.hpp>
 
-#include "TypesParser.h"
 #include "smart_ptr.h"
+#include "CachedBitmap.h"
 #include "log.h"
-#include "SWFStream.h"
 #include "movie_definition.h"
 #include "SWF.h"
-#include "GnashException.h"
 #include "GnashNumeric.h"
-#include "Renderer.h"
 #include "RunResources.h"
 #include "GnashImage.h"
 
-
 namespace gnash {
 
-// Forward declarations
-namespace {
-    OptionalFillPair readSolidFill(SWFStream& in, SWF::TagType t,
-            bool readMorph);
-    OptionalFillPair readBitmapFill(SWFStream& in, SWF::FillType type,
-            movie_definition& md, bool readMorph);
-    GradientRecord readGradientRecord(SWFStream& in, SWF::TagType tag);
-}
-
 namespace {
 
 /// Create a lerped version of two other FillStyles.
@@ -115,6 +101,18 @@ GradientFill::setFocalPoint(double d)
 {
     _focalPoint = clamp<float>(d, -1, 1); 
 }
+
+BitmapFill::BitmapFill(Type t, const CachedBitmap* bi, const SWFMatrix& m,
+        SmoothingPolicy pol)
+    :
+    _type(t),
+    _smoothingPolicy(pol),
+    _matrix(m),
+    _bitmapInfo(bi),
+    _md(0),
+    _id(0)
+{
+}
     
 BitmapFill::BitmapFill(SWF::FillType t, movie_definition* md,
         boost::uint16_t id, const SWFMatrix& m)
@@ -155,6 +153,33 @@ BitmapFill::BitmapFill(SWF::FillType t, movie_definition* 
md,
     }
 }
 
+BitmapFill::BitmapFill(const BitmapFill& other)
+    :
+    _type(other._type),
+    _smoothingPolicy(other._smoothingPolicy),
+    _matrix(other._matrix),
+    _bitmapInfo(other._bitmapInfo),
+    _md(other._md),
+    _id(other._id)
+{
+}
+
+BitmapFill::~BitmapFill()
+{
+}
+    
+BitmapFill&
+BitmapFill::operator=(const BitmapFill& other)
+{
+    _type = other._type;
+    _smoothingPolicy = other._smoothingPolicy;
+    _matrix = other._matrix;
+    _bitmapInfo = other._bitmapInfo;
+    _md = other._md;
+    _id = other._id;
+    return *this;
+}
+
 const CachedBitmap*
 BitmapFill::bitmap() const
 {
@@ -191,166 +216,6 @@ BitmapFill::setLerp(const BitmapFill& a, const 
BitmapFill& b, double ratio)
     _matrix.set_lerp(a.matrix(), b.matrix(), ratio);
 }
 
-OptionalFillPair
-readFills(SWFStream& in, SWF::TagType t, movie_definition& md, bool readMorph)
-{
-
-    in.ensureBytes(1);
-    const SWF::FillType type = static_cast<SWF::FillType>(in.read_u8());
-        
-    IF_VERBOSE_PARSE(
-        log_parse("  FillStyle read type = 0x%X", +type);
-    );
-
-    switch (type) {
-
-        case SWF::FILL_SOLID:
-            return readSolidFill(in, t, readMorph);
-
-        case SWF::FILL_TILED_BITMAP_HARD:
-        case SWF::FILL_CLIPPED_BITMAP_HARD:
-        case SWF::FILL_TILED_BITMAP:
-        case SWF::FILL_CLIPPED_BITMAP:
-            return readBitmapFill(in, type, md, readMorph);
-
-        case SWF::FILL_LINEAR_GRADIENT:
-        case SWF::FILL_RADIAL_GRADIENT:
-        case SWF::FILL_FOCAL_GRADIENT:
-        {
-
-            GradientFill::Type gr;
-            switch (type) {
-                case SWF::FILL_LINEAR_GRADIENT:
-                    gr = GradientFill::LINEAR;
-                    break;
-                case SWF::FILL_RADIAL_GRADIENT:
-                case SWF::FILL_FOCAL_GRADIENT:
-                    gr = GradientFill::RADIAL;
-                    break;
-                default:
-                    std::abort();
-            }
-
-            SWFMatrix m = readSWFMatrix(in).invert();
-            GradientFill gf(gr, m);
-
-            boost::optional<FillStyle> morph;
-            if (readMorph) {
-                SWFMatrix m2 = readSWFMatrix(in).invert();
-                morph = GradientFill(gr, m2);
-            }
-            
-            in.ensureBytes(1);
-            const boost::uint8_t grad_props = in.read_u8();
-            
-            const boost::uint8_t num_gradients = grad_props & 0xF;
-            IF_VERBOSE_PARSE(
-               log_parse("  gradients: num_gradients = %d", +num_gradients);
-            );
-        
-            if (!num_gradients) {
-                IF_VERBOSE_MALFORMED_SWF(
-                    log_swferror(_("No gradients!"));
-                );
-                throw ParserException();
-            }
-        
-            GradientFill::GradientRecords recs;
-            recs.reserve(num_gradients);
-
-            GradientFill::GradientRecords morphrecs;
-            morphrecs.reserve(num_gradients);
-
-            for (size_t i = 0; i < num_gradients; ++i) {
-                recs.push_back(readGradientRecord(in, t));
-                if (readMorph) {
-                    morphrecs.push_back(readGradientRecord(in, t));
-                }
-            }
-        
-            // A GradientFill may never have fewer than 2 colour stops. We've
-            // no tests to show what happens in that case for static fills.
-            // Dynamic fills are tested to display as a solid fill. In either
-            // case the renderer will bork if there is only 1 stop in a 
-            // GradientFill.
-            if (num_gradients == 1) {
-                const rgba c1 = recs[0].color;
-                if (readMorph) {
-                    const rgba c2 = morphrecs[0].color;
-                    morph = SolidFill(c2);
-                }
-                return std::make_pair(SolidFill(c1), morph);
-            }
-        
-            gf.setRecords(recs);
-            if (readMorph) {
-                boost::get<GradientFill>(morph->fill).setRecords(morphrecs);
-            }
-
-
-            if (t == SWF::DEFINESHAPE4 || t == SWF::DEFINESHAPE4_) {
-
-                const SWF::SpreadMode spread =
-                    static_cast<SWF::SpreadMode>(grad_props >> 6);
-
-                switch (spread) {
-                    case SWF::GRADIENT_SPREAD_PAD:
-                        gf.spreadMode = GradientFill::PAD;
-                        break;
-                    case SWF::GRADIENT_SPREAD_REFLECT:
-                        gf.spreadMode = GradientFill::REFLECT;
-                        break;
-                    case SWF::GRADIENT_SPREAD_REPEAT:
-                        gf.spreadMode = GradientFill::REPEAT;
-                        break;
-                    default: 
-                        IF_VERBOSE_MALFORMED_SWF(
-                            log_swferror("Illegal spread mode in gradient "
-                                "definition.");
-                        );
-                }
-        
-                // TODO: handle in GradientFill.
-                const SWF::InterpolationMode i =
-                    static_cast<SWF::InterpolationMode>((grad_props >> 4) & 3);
-
-                switch (i) {
-                    case SWF::GRADIENT_INTERPOLATION_NORMAL:
-                    case SWF::GRADIENT_INTERPOLATION_LINEAR:
-                        gf.interpolation = i;
-                    default:
-                        IF_VERBOSE_MALFORMED_SWF(
-                            log_swferror("Illegal interpolation mode in "
-                                "gradient definition.");
-                        );
-                }
-            }
-
-            // A focal gradient also has a focal point.
-            if (type == SWF::FILL_FOCAL_GRADIENT) {
-               in.ensureBytes(2);
-               gf.setFocalPoint(in.read_short_sfixed());
-            }
-        
-            if (readMorph) {
-                boost::get<GradientFill>(morph->fill).
-                    setFocalPoint(gf.focalPoint());
-            }
-
-            return std::make_pair(gf, morph);
-        }
-
-        default:
-        {
-            std::stringstream ss;
-            ss << "Unknown fill style type " << +type;    
-            // This is a fatal error, we'll be leaving the stream
-            // read pointer in an unknown position.
-            throw ParserException(ss.str()); 
-        }
-    }
-}
-
 // Sets this style to a blend of a and b.  t = [0,1]
 void
 setLerp(FillStyle& f, const FillStyle& a, const FillStyle& b, double t)
@@ -360,79 +225,6 @@ setLerp(FillStyle& f, const FillStyle& a, const FillStyle& 
b, double t)
     boost::apply_visitor(SetLerp(a.fill, b.fill, t), f.fill);
 }
 
-namespace {
-
-OptionalFillPair
-readSolidFill(SWFStream& in, SWF::TagType t, bool readMorph)
-{
-    rgba color;
-
-    boost::optional<FillStyle> morph;
-
-    // 0x00: solid fill
-    if (t == SWF::DEFINESHAPE3 || t == SWF::DEFINESHAPE4 ||
-            t == SWF::DEFINESHAPE4_ || readMorph) {
-        color = readRGBA(in);
-        if (readMorph) {
-            rgba othercolor;
-            othercolor = readRGBA(in);
-            morph = SolidFill(othercolor);
-        }
-    }
-    else {
-        // For DefineMorphShape tags we should use morphFillStyle 
-        assert(t == SWF::DEFINESHAPE || t == SWF::DEFINESHAPE2);
-        color = readRGB(in);
-    }
-
-    IF_VERBOSE_PARSE(
-        log_parse("  color: %s", color);
-    );
-    return std::make_pair(SolidFill(color), morph);
-}
-
-OptionalFillPair
-readBitmapFill(SWFStream& in, SWF::FillType type, movie_definition& md,
-        bool readMorph)
-{
-
-    in.ensureBytes(2);
-    const boost::uint16_t id = in.read_u16();
-
-    SWFMatrix m = readSWFMatrix(in).invert();
-
-    boost::optional<FillStyle> morph;
-    if (readMorph) {
-        SWFMatrix m2 = readSWFMatrix(in).invert();
-        morph = BitmapFill(type, &md, id, m2);
-    }
-
-    // For some reason, it looks like they store the inverse of the
-    // TWIPS-to-texcoords SWFMatrix.
-    return std::make_pair(BitmapFill(type, &md, id, m), morph);
-}
-
-GradientRecord
-readGradientRecord(SWFStream& in, SWF::TagType tag)
-{
-    in.ensureBytes(1);
-    const boost::uint8_t ratio = in.read_u8();
-
-    switch (tag) {
-        case SWF::DEFINESHAPE:
-        case SWF::DEFINESHAPE2:
-        {
-            const rgba color = readRGB(in);
-            return GradientRecord(ratio, color);
-        }
-        default:
-            break;
-    }
-    const rgba color = readRGBA(in);
-    return GradientRecord(ratio, color);
-}
-
-} // anonymous namespace
 
 std::ostream&
 operator<<(std::ostream& os, const BitmapFill::SmoothingPolicy& p)
diff --git a/libcore/FillStyle.h b/libcore/FillStyle.h
index 7bdc85f..ade6b3e 100644
--- a/libcore/FillStyle.h
+++ b/libcore/FillStyle.h
@@ -1,3 +1,4 @@
+// FillStyle.h: variant fill styles
 // 
 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 // 
@@ -21,20 +22,18 @@
 #include <boost/variant.hpp>
 #include <vector> 
 #include <iosfwd> 
-#include <boost/optional.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include <cassert>
 
 #include "SWFMatrix.h"
-#include "CachedBitmap.h"
 #include "SWF.h"
 #include "RGBA.h" 
 
 namespace gnash {
-    class SWFStream;
     class movie_definition;
     class Renderer;
     class RunResources;
+    class CachedBitmap;
 }
 
 namespace gnash {
@@ -64,6 +63,9 @@ public:
 /// possible to change the appearance of the fill by changing the CachedBitmap
 /// it refers to.
 //
+/// Special member functions (ctor, dtor etc) are not inlined to avoid 
+/// requiring the definition of movie_definition.
+//
 /// TODO: check the following:
 //
 /// It may be necessary to allow setting the smoothing policy; the use of
@@ -92,34 +94,22 @@ public:
     //
     /// TODO: check the smoothing policy here!
     BitmapFill(Type t, const CachedBitmap* bi, const SWFMatrix& m,
-            SmoothingPolicy pol)
-        :
-        _type(t),
-        _smoothingPolicy(pol),
-        _matrix(m),
-        _bitmapInfo(bi),
-        _md(0),
-        _id(0)
-    {
-    }
+            SmoothingPolicy pol);
 
     /// Construct a static BitmapFill using a SWF tag.
     BitmapFill(SWF::FillType t, movie_definition* md, boost::uint16_t id,
             const SWFMatrix& m);
 
+    /// Destructor
+    ~BitmapFill();
+
     /// Copy a BitmapFill
     //
     /// The copied BitmapFill refers to the same bitmap id in the same
     /// movie_definition as the original.
-    BitmapFill(const BitmapFill& other)
-        :
-        _type(other._type),
-        _smoothingPolicy(other._smoothingPolicy),
-        _matrix(other._matrix),
-        _bitmapInfo(other._bitmapInfo),
-        _md(other._md),
-        _id(other._id)
-    {}
+    BitmapFill(const BitmapFill& other);
+    
+    BitmapFill& operator=(const BitmapFill& other);
 
     /// Set this fill to a lerp of two other BitmapFills.
     void setLerp(const BitmapFill& a, const BitmapFill& b, double ratio);
@@ -162,7 +152,6 @@ private:
     boost::uint16_t _id;
 };
 
-
 /// A GradientFill
 //
 /// TODO: clean this up!
@@ -313,15 +302,6 @@ public:
 /// errors are caught by type-checking and will throw an unhandled exception.
 void setLerp(FillStyle& f, const FillStyle& a, const FillStyle& b, double t);
 
-/// Either a single or a morph-pair FillStyle.
-typedef std::pair<FillStyle, boost::optional<FillStyle> > OptionalFillPair;
-
-/// Read FillStyles from a stream
-//
-/// Read either single or morph-pair fill styles from a stream. 
-OptionalFillPair readFills(SWFStream& in, SWF::TagType t, movie_definition& m,
-        bool readMorph);
-
 DSOEXPORT std::ostream& operator<<(std::ostream& os,
         const BitmapFill::SmoothingPolicy& p);
 
diff --git a/libcore/parser/TypesParser.cpp b/libcore/parser/TypesParser.cpp
index a4c01b8..4996940 100644
--- a/libcore/parser/TypesParser.cpp
+++ b/libcore/parser/TypesParser.cpp
@@ -19,14 +19,30 @@
 
 #include "TypesParser.h"
 
+#include <boost/optional.hpp>
+
+#include "GnashException.h"
+#include "SWF.h"
 #include "SWFStream.h"
 #include "RGBA.h"
 #include "SWFMatrix.h"
 #include "SWFRect.h"
+#include "FillStyle.h"
 #include "log.h"
+#include "movie_definition.h"
 
 namespace gnash {
 
+// Forward declarations
+namespace {
+    OptionalFillPair readSolidFill(SWFStream& in, SWF::TagType t,
+            bool readMorph);
+    OptionalFillPair readBitmapFill(SWFStream& in, SWF::FillType type,
+            movie_definition& md, bool readMorph);
+    GradientRecord readGradientRecord(SWFStream& in, SWF::TagType tag);
+}
+
+
 SWFMatrix
 readSWFMatrix(SWFStream& in)
 {
@@ -132,4 +148,238 @@ readRect(SWFStream& in)
     return SWFRect(minx, maxx, miny, maxy);
 }
 
+OptionalFillPair
+readFills(SWFStream& in, SWF::TagType t, movie_definition& md, bool readMorph)
+{
+
+    in.ensureBytes(1);
+    const SWF::FillType type = static_cast<SWF::FillType>(in.read_u8());
+        
+    IF_VERBOSE_PARSE(
+        log_parse("  FillStyle read type = 0x%X", +type);
+    );
+
+    switch (type) {
+
+        case SWF::FILL_SOLID:
+            return readSolidFill(in, t, readMorph);
+
+        case SWF::FILL_TILED_BITMAP_HARD:
+        case SWF::FILL_CLIPPED_BITMAP_HARD:
+        case SWF::FILL_TILED_BITMAP:
+        case SWF::FILL_CLIPPED_BITMAP:
+            return readBitmapFill(in, type, md, readMorph);
+
+        case SWF::FILL_LINEAR_GRADIENT:
+        case SWF::FILL_RADIAL_GRADIENT:
+        case SWF::FILL_FOCAL_GRADIENT:
+        {
+
+            GradientFill::Type gr;
+            switch (type) {
+                case SWF::FILL_LINEAR_GRADIENT:
+                    gr = GradientFill::LINEAR;
+                    break;
+                case SWF::FILL_RADIAL_GRADIENT:
+                case SWF::FILL_FOCAL_GRADIENT:
+                    gr = GradientFill::RADIAL;
+                    break;
+                default:
+                    std::abort();
+            }
+
+            SWFMatrix m = readSWFMatrix(in).invert();
+            GradientFill gf(gr, m);
+
+            boost::optional<FillStyle> morph;
+            if (readMorph) {
+                SWFMatrix m2 = readSWFMatrix(in).invert();
+                morph = GradientFill(gr, m2);
+            }
+            
+            in.ensureBytes(1);
+            const boost::uint8_t grad_props = in.read_u8();
+            
+            const boost::uint8_t num_gradients = grad_props & 0xF;
+            IF_VERBOSE_PARSE(
+               log_parse("  gradients: num_gradients = %d", +num_gradients);
+            );
+        
+            if (!num_gradients) {
+                IF_VERBOSE_MALFORMED_SWF(
+                    log_swferror(_("No gradients!"));
+                );
+                throw ParserException();
+            }
+        
+            GradientFill::GradientRecords recs;
+            recs.reserve(num_gradients);
+
+            GradientFill::GradientRecords morphrecs;
+            morphrecs.reserve(num_gradients);
+
+            for (size_t i = 0; i < num_gradients; ++i) {
+                recs.push_back(readGradientRecord(in, t));
+                if (readMorph) {
+                    morphrecs.push_back(readGradientRecord(in, t));
+                }
+            }
+        
+            // A GradientFill may never have fewer than 2 colour stops. We've
+            // no tests to show what happens in that case for static fills.
+            // Dynamic fills are tested to display as a solid fill. In either
+            // case the renderer will bork if there is only 1 stop in a 
+            // GradientFill.
+            if (num_gradients == 1) {
+                const rgba c1 = recs[0].color;
+                if (readMorph) {
+                    const rgba c2 = morphrecs[0].color;
+                    morph = SolidFill(c2);
+                }
+                return std::make_pair(SolidFill(c1), morph);
+            }
+        
+            gf.setRecords(recs);
+            if (readMorph) {
+                boost::get<GradientFill>(morph->fill).setRecords(morphrecs);
+            }
+
+
+            if (t == SWF::DEFINESHAPE4 || t == SWF::DEFINESHAPE4_) {
+
+                const SWF::SpreadMode spread =
+                    static_cast<SWF::SpreadMode>(grad_props >> 6);
+
+                switch (spread) {
+                    case SWF::GRADIENT_SPREAD_PAD:
+                        gf.spreadMode = GradientFill::PAD;
+                        break;
+                    case SWF::GRADIENT_SPREAD_REFLECT:
+                        gf.spreadMode = GradientFill::REFLECT;
+                        break;
+                    case SWF::GRADIENT_SPREAD_REPEAT:
+                        gf.spreadMode = GradientFill::REPEAT;
+                        break;
+                    default: 
+                        IF_VERBOSE_MALFORMED_SWF(
+                            log_swferror("Illegal spread mode in gradient "
+                                "definition.");
+                        );
+                }
+        
+                // TODO: handle in GradientFill.
+                const SWF::InterpolationMode i =
+                    static_cast<SWF::InterpolationMode>((grad_props >> 4) & 3);
+
+                switch (i) {
+                    case SWF::GRADIENT_INTERPOLATION_NORMAL:
+                    case SWF::GRADIENT_INTERPOLATION_LINEAR:
+                        gf.interpolation = i;
+                    default:
+                        IF_VERBOSE_MALFORMED_SWF(
+                            log_swferror("Illegal interpolation mode in "
+                                "gradient definition.");
+                        );
+                }
+            }
+
+            // A focal gradient also has a focal point.
+            if (type == SWF::FILL_FOCAL_GRADIENT) {
+               in.ensureBytes(2);
+               gf.setFocalPoint(in.read_short_sfixed());
+            }
+        
+            if (readMorph) {
+                boost::get<GradientFill>(morph->fill).
+                    setFocalPoint(gf.focalPoint());
+            }
+
+            return std::make_pair(gf, morph);
+        }
+
+        default:
+        {
+            std::stringstream ss;
+            ss << "Unknown fill style type " << +type;    
+            // This is a fatal error, we'll be leaving the stream
+            // read pointer in an unknown position.
+            throw ParserException(ss.str()); 
+        }
+    }
+}
+
+namespace {
+
+OptionalFillPair
+readSolidFill(SWFStream& in, SWF::TagType t, bool readMorph)
+{
+    rgba color;
+
+    boost::optional<FillStyle> morph;
+
+    // 0x00: solid fill
+    if (t == SWF::DEFINESHAPE3 || t == SWF::DEFINESHAPE4 ||
+            t == SWF::DEFINESHAPE4_ || readMorph) {
+        color = readRGBA(in);
+        if (readMorph) {
+            rgba othercolor;
+            othercolor = readRGBA(in);
+            morph = SolidFill(othercolor);
+        }
+    }
+    else {
+        // For DefineMorphShape tags we should use morphFillStyle 
+        assert(t == SWF::DEFINESHAPE || t == SWF::DEFINESHAPE2);
+        color = readRGB(in);
+    }
+
+    IF_VERBOSE_PARSE(
+        log_parse("  color: %s", color);
+    );
+    return std::make_pair(SolidFill(color), morph);
+}
+
+OptionalFillPair
+readBitmapFill(SWFStream& in, SWF::FillType type, movie_definition& md,
+        bool readMorph)
+{
+
+    in.ensureBytes(2);
+    const boost::uint16_t id = in.read_u16();
+
+    SWFMatrix m = readSWFMatrix(in).invert();
+
+    boost::optional<FillStyle> morph;
+    if (readMorph) {
+        SWFMatrix m2 = readSWFMatrix(in).invert();
+        morph = BitmapFill(type, &md, id, m2);
+    }
+
+    // For some reason, it looks like they store the inverse of the
+    // TWIPS-to-texcoords SWFMatrix.
+    return std::make_pair(BitmapFill(type, &md, id, m), morph);
+}
+
+GradientRecord
+readGradientRecord(SWFStream& in, SWF::TagType tag)
+{
+    in.ensureBytes(1);
+    const boost::uint8_t ratio = in.read_u8();
+
+    switch (tag) {
+        case SWF::DEFINESHAPE:
+        case SWF::DEFINESHAPE2:
+        {
+            const rgba color = readRGB(in);
+            return GradientRecord(ratio, color);
+        }
+        default:
+            break;
+    }
+    const rgba color = readRGBA(in);
+    return GradientRecord(ratio, color);
+}
+
+} // anonymous namespace
+
 }
diff --git a/libcore/parser/TypesParser.h b/libcore/parser/TypesParser.h
index e039d50..e04064e 100644
--- a/libcore/parser/TypesParser.h
+++ b/libcore/parser/TypesParser.h
@@ -20,11 +20,18 @@
 #ifndef GNASH_TYPESPARSER_H
 #define GNASH_TYPESPARSER_H
 
+
+#include <boost/optional.hpp>
+
+#include "SWF.h"
+
 namespace gnash {
     class SWFStream;
     class SWFMatrix;
     class SWFRect;
     class rgba;
+    class movie_definition;
+    class FillStyle;
 }
 
 namespace gnash {
@@ -41,6 +48,16 @@ rgba readRGB(SWFStream& in);
 /// Read a bit-packed rectangle from an SWF stream
 SWFRect readRect(SWFStream& in);
 
+/// Either a single or a morph-pair FillStyle.
+typedef std::pair<FillStyle, boost::optional<FillStyle> > OptionalFillPair;
+
+/// Read FillStyles from a stream
+//
+/// Read either single or morph-pair fill styles from a stream. 
+OptionalFillPair readFills(SWFStream& in, SWF::TagType t, movie_definition& m,
+        bool readMorph);
+
+
 } // namespace gnash
 
 #endif
diff --git a/librender/Renderer_agg.cpp b/librender/Renderer_agg.cpp
index e069e55..3b05a94 100644
--- a/librender/Renderer_agg.cpp
+++ b/librender/Renderer_agg.cpp
@@ -111,7 +111,6 @@ AGG resources
 #include "gnashconfig.h"
 #endif
 
-#include "Renderer.h"
 #include "Renderer_agg.h" 
 
 #include <vector>
@@ -155,6 +154,7 @@ AGG resources
 #include <agg_alpha_mask_u8.h>
 
 #include "gnash.h"
+#include "CachedBitmap.h"
 #include "RGBA.h"
 #include "GnashImage.h"
 #include "log.h"
diff --git a/librender/Renderer_agg.h b/librender/Renderer_agg.h
index 7931dcd..af4a2c7 100644
--- a/librender/Renderer_agg.h
+++ b/librender/Renderer_agg.h
@@ -21,6 +21,7 @@
 #define BACKEND_RENDER_HANDLER_AGG_H
 
 #include "dsodefs.h"
+#include "Renderer.h"
 
 namespace gnash {
 
diff --git a/librender/Renderer_cairo.cpp b/librender/Renderer_cairo.cpp
index 9d9bab0..e8da916 100644
--- a/librender/Renderer_cairo.cpp
+++ b/librender/Renderer_cairo.cpp
@@ -35,22 +35,24 @@
 // - masks
 // - video (from old Cairo renderer)
 
+#include "Renderer_cairo.h"
+
+#include <cmath>
+#include <cairo/cairo.h>
+#include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/bind.hpp>
+
 #include "smart_ptr.h"
 #include "Renderer.h"
 #include "GnashImage.h"
 #include "PathParser.h"
 #include "swf/ShapeRecord.h"
-#include "Renderer_cairo.h"
 #include "utility.h"
 #include "FillStyle.h"
 #include "Transform.h"
 #include "ImageIterators.h"
-
-#include <cmath>
-#include <cairo/cairo.h>
-#include <boost/scoped_array.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/bind.hpp>
+#include "CachedBitmap.h"
 
 namespace gnash {
 

http://git.savannah.gnu.org/cgit//commit/?id=233d390a4b88799406e711ac6fc0c3956fd8a8dc


commit 233d390a4b88799406e711ac6fc0c3956fd8a8dc
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 08:19:02 2010 +0200

    Move most SWFStream handling out of libcore.

diff --git a/libcore/FillStyle.cpp b/libcore/FillStyle.cpp
index 43c3796..782dc56 100644
--- a/libcore/FillStyle.cpp
+++ b/libcore/FillStyle.cpp
@@ -23,6 +23,7 @@
 #include <boost/variant.hpp>
 #include <boost/optional.hpp>
 
+#include "TypesParser.h"
 #include "smart_ptr.h"
 #include "log.h"
 #include "SWFStream.h"
diff --git a/libcore/FillStyle.h b/libcore/FillStyle.h
index 259907a..7bdc85f 100644
--- a/libcore/FillStyle.h
+++ b/libcore/FillStyle.h
@@ -28,14 +28,16 @@
 #include "SWFMatrix.h"
 #include "CachedBitmap.h"
 #include "SWF.h"
-#include "RGBA.h" // for rgba type
+#include "RGBA.h" 
 
 namespace gnash {
+    class SWFStream;
+    class movie_definition;
+    class Renderer;
+    class RunResources;
+}
 
-class SWFStream;
-class movie_definition;
-class Renderer;
-class RunResources;
+namespace gnash {
 
 class GradientRecord
 {
diff --git a/libcore/LineStyle.cpp b/libcore/LineStyle.cpp
index 5e38fe9..12365fa 100644
--- a/libcore/LineStyle.cpp
+++ b/libcore/LineStyle.cpp
@@ -20,8 +20,10 @@
 // Based on public domain work by Thatcher Ulrich <address@hidden> 2003
 // styles.cpp   -- Thatcher Ulrich <address@hidden> 2003
 
-#include "RunResources.h"
 #include "LineStyle.h"
+
+#include "TypesParser.h"
+#include "RunResources.h"
 #include "log.h"
 #include "SWFStream.h"
 #include "smart_ptr.h"
diff --git a/libcore/RGBA.cpp b/libcore/RGBA.cpp
index 0389701..b6c53da 100644
--- a/libcore/RGBA.cpp
+++ b/libcore/RGBA.cpp
@@ -1,4 +1,3 @@
-// RGBA.cpp: RGBA color handling.
 // 
 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 //   Foundation, Inc
@@ -21,7 +20,6 @@
 #include "RGBA.h"
 #include "GnashNumeric.h"
 #include "log.h"
-#include "SWFStream.h"
 #include <sstream> 
 
 namespace gnash {
@@ -44,29 +42,6 @@ rgba::set_lerp(const rgba& a, const rgba& b, float f)
 }
 
 rgba
-readRGBA(SWFStream& in)
-{
-    in.ensureBytes(4);
-    const boost::uint8_t r = in.read_u8();
-    const boost::uint8_t g = in.read_u8();
-    const boost::uint8_t b = in.read_u8();
-    const boost::uint8_t a = in.read_u8();
-    return rgba(r, g, b, a);
-}
-
-/// Can throw ParserException on premature end of input stream
-rgba
-readRGB(SWFStream& in)
-{
-    in.ensureBytes(3);
-    const boost::uint8_t r = in.read_u8();
-    const boost::uint8_t g = in.read_u8();
-    const boost::uint8_t b = in.read_u8();
-    const boost::uint8_t a = 0xff;
-    return rgba(r, g, b, a);
-}
-
-rgba
 colorFromHexString(const std::string& color)
 {
     std::stringstream ss(color);
diff --git a/libcore/RGBA.h b/libcore/RGBA.h
index d133552..bc41576 100644
--- a/libcore/RGBA.h
+++ b/libcore/RGBA.h
@@ -27,10 +27,6 @@
 #include <boost/cstdint.hpp> 
 
 namespace gnash {
-    class SWFStream;
-}
-
-namespace gnash {
 
 /// A basic RGBA type
 //
@@ -135,15 +131,6 @@ public:
 
 std::ostream& operator<< (std::ostream& os, const rgba& r);
 
-/// Initialize from input stream (reads RGBA)
-//
-/// Throw a ParserException if there's no enough bytes in the
-/// currently opened tag for reading. See SWFStream::ensureBytes()
-rgba readRGBA(SWFStream& in);
-
-/// Initialize from intput stream (reads RGB)
-rgba readRGB(SWFStream& in);
-    
 /// Create an RGBA value from a hex string (e.g. FF0000)
 //
 /// @param color    A hex string in 'rrbbgg' format. This must contain only
diff --git a/libcore/SWFMatrix.cpp b/libcore/SWFMatrix.cpp
index dcf42b0..a95195a 100644
--- a/libcore/SWFMatrix.cpp
+++ b/libcore/SWFMatrix.cpp
@@ -21,7 +21,6 @@
 //
 
 #include "SWFMatrix.h"
-#include "SWFStream.h" // for reading from SWF
 #include "log.h"
 #include "GnashNumeric.h"
 #include "SWFRect.h"
@@ -51,49 +50,6 @@ Fixed16Mul(boost::int32_t a, boost::int32_t b)
 
 } // anonymous namepace
 
-SWFMatrix
-readSWFMatrix(SWFStream& in)
-{
-    in.align();
-
-    in.ensureBits(1);
-    const bool has_scale = in.read_bit(); 
-
-    boost::int32_t sx = 65536;
-    boost::int32_t sy = 65536;
-    if (has_scale) {
-        in.ensureBits(5);
-        const boost::uint8_t scale_nbits = in.read_uint(5);
-        in.ensureBits(scale_nbits * 2);
-        sx = in.read_sint(scale_nbits);
-        sy = in.read_sint(scale_nbits);
-    }
-
-    in.ensureBits(1);
-    const bool has_rotate = in.read_bit();
-    boost::int32_t shx = 0;
-    boost::int32_t shy = 0;
-    if (has_rotate) {
-        in.ensureBits(5);
-        int rotate_nbits = in.read_uint(5);
-
-        in.ensureBits(rotate_nbits * 2);
-        shx = in.read_sint(rotate_nbits);
-        shy = in.read_sint(rotate_nbits);
-    }
-
-    in.ensureBits(5);
-    const boost::uint8_t translate_nbits = in.read_uint(5);
-    boost::int32_t tx = 0;
-    boost::int32_t ty = 0;
-    if (translate_nbits) {
-        in.ensureBits(translate_nbits * 2);
-        tx = in.read_sint(translate_nbits);
-        ty = in.read_sint(translate_nbits);
-    }
-    return SWFMatrix(sx, shx, shy, sy, tx, ty);
-}
-
 void
 SWFMatrix::transform(geometry::Point2d& p) const
 {
diff --git a/libcore/SWFMatrix.h b/libcore/SWFMatrix.h
index f03f952..fd55e5c 100644
--- a/libcore/SWFMatrix.h
+++ b/libcore/SWFMatrix.h
@@ -32,7 +32,6 @@
 
 // Forward declarations
 namespace gnash {
-    class SWFStream;
     class SWFRect;
     namespace geometry {
         class Point2d;
@@ -199,9 +198,6 @@ private:
 
 }; //end of SWFMatrix
 
-/// Read from input stream.
-SWFMatrix readSWFMatrix(SWFStream& in);
-
 inline bool
 operator==(const SWFMatrix& a, const SWFMatrix& b)
 {
diff --git a/libcore/SWFRect.cpp b/libcore/SWFRect.cpp
index d6f44c0..1ff35a7 100644
--- a/libcore/SWFRect.cpp
+++ b/libcore/SWFRect.cpp
@@ -17,45 +17,19 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "SWFRect.h"
-#include "log.h"
-#include "SWFStream.h"
+
+#include <sstream> 
+
 #include "SWFMatrix.h"
 #include "Point2d.h"
 #include "GnashNumeric.h" // for flerp, clamp...
 
-#include <sstream> // for ::print and ::toString
 
 namespace gnash {
 
 const boost::int32_t SWFRect::rectNull;
 const boost::int32_t SWFRect::rectMax;
 
-void
-SWFRect::read(SWFStream& in)
-{
-    in.align();
-    in.ensureBits(5);
-    int nbits = in.read_uint(5);
-    in.ensureBits(nbits*4);
-    
-    _xMin = in.read_sint(nbits);
-    _xMax = in.read_sint(nbits);
-    _yMin = in.read_sint(nbits);
-    _yMax = in.read_sint(nbits);
-
-    // Check if this SWFRect is valid.
-    if (_xMax < _xMin || _yMax < _yMin)
-    {
-        // We set invalid rectangles to NULL, but we might instead
-        // want to actually swap the values if the proprietary player
-        // does so. TODO: check it out.
-        IF_VERBOSE_MALFORMED_SWF(
-        log_swferror("Invalid rectangle: "
-            "xMin=%g xMax=%g yMin=%g yMax=%g", _xMin, _xMax, _yMin, _yMax);
-        );
-        set_null();
-    } 
-}
 
 // Set ourself to bound a rectangle that has been transformed by m.  
 void
@@ -102,31 +76,30 @@ SWFRect::expand_to_rect(const SWFRect& r)
 
 void
 SWFRect::expand_to_transformed_rect(const SWFMatrix& m, const SWFRect& r)
-// Expand ourself to a transformed SWFRect.
 {   
-    if ( r.is_null() )
-    {
+    if (r.is_null()) {
          return;
     }
 
-    boost::int32_t  x1 = r.get_x_min();
-    boost::int32_t  y1 = r.get_y_min();
-    boost::int32_t  x2 = r.get_x_max();
-    boost::int32_t  y2 = r.get_y_max();
+    const boost::int32_t x1 = r.get_x_min();
+    const boost::int32_t y1 = r.get_y_min();
+    const boost::int32_t x2 = r.get_x_max();
+    const boost::int32_t y2 = r.get_y_max();
 
-    point  p0(x1, y1);
-    point  p1(x2, y1);
-    point  p2(x2, y2);
-    point  p3(x1, y2);
+    point p0(x1, y1);
+    point p1(x2, y1);
+    point p2(x2, y2);
+    point p3(x1, y2);
     
     m.transform(p0);
     m.transform(p1);
     m.transform(p2);
     m.transform(p3);
 
-    if( is_null() ) {
+    if (is_null()) {
         set_to_point(p0.x, p0.y);   
-    }else {
+    }
+    else {
         expand_to(p0.x, p0.y);
     }
     expand_to(p1.x, p1.y);
diff --git a/libcore/SWFRect.h b/libcore/SWFRect.h
index f4af9c8..746525f 100644
--- a/libcore/SWFRect.h
+++ b/libcore/SWFRect.h
@@ -31,7 +31,6 @@
 // Forward decl
 namespace gnash {
     class SWFMatrix;
-    class SWFStream;
     namespace geometry {
         class Point2d;
     }
@@ -46,24 +45,6 @@ class SWFRect
 {
 
 public:
-    /// Read a bit-packed rectangle from an SWF stream
-    //
-    /// Format of the bit-packed rectangle is:
-    ///
-    /// bits  | name  | description
-    /// ------+-------+-------------------------
-    ///   5   | nbits | number of bits used in subsequent values
-    /// nbits | xmin  | minimum X value
-    /// nbits | xmax  | maximum X value
-    /// nbits | ymin  | minimum Y value
-    /// nbits | ymax  | maximum Y value
-    ///
-    /// If max values are less then min values the SWF is malformed;
-    /// in this case this method will raise an swf_error and set the
-    /// rectangle to the NULL rectangle. See is_null().
-    /// 
-    ///
-    void    read(SWFStream& in);
 
     static const boost::int32_t rectNull = 0x80000000;
     static const boost::int32_t rectMax = 0x7fffffff;
@@ -278,7 +259,7 @@ private:
 
 
 inline std::ostream&
-operator<< (std::ostream& os, const SWFRect& r)
+operator<<(std::ostream& os, const SWFRect& r)
 {
     if (!r.is_null()) {
         os << "RECT(" 
diff --git a/libcore/parser/Makefile.am b/libcore/parser/Makefile.am
index 4d62c1f..69d26fd 100644
--- a/libcore/parser/Makefile.am
+++ b/libcore/parser/Makefile.am
@@ -48,6 +48,7 @@ libgnashparser_la_SOURCES = \
        action_buffer.cpp \
        BitmapMovieDefinition.cpp \
        SWFParser.cpp \
+       TypesParser.cpp \
        SWFMovieDefinition.cpp \
        sound_definition.cpp \
        sprite_definition.cpp
@@ -57,6 +58,7 @@ noinst_HEADERS = \
        BitmapMovieDefinition.h \
        movie_definition.h \
        SWFParser.h \
+       TypesParser.h \
        SWFMovieDefinition.h \
        sound_definition.h \
        sprite_definition.h
diff --git a/libcore/parser/SWFMovieDefinition.cpp 
b/libcore/parser/SWFMovieDefinition.cpp
index 6e33718..24e11f3 100644
--- a/libcore/parser/SWFMovieDefinition.cpp
+++ b/libcore/parser/SWFMovieDefinition.cpp
@@ -33,7 +33,6 @@
 #include <algorithm> 
 
 #include "GnashSleep.h"
-#include "GnashImageJpeg.h"
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "movie_definition.h" 
 #include "zlib_adapter.h"
@@ -53,6 +52,8 @@
 #include "namedStrings.h"
 #include "as_function.h"
 #include "CachedBitmap.h"
+#include "TypesParser.h"
+#include "GnashImageJpeg.h"
 
 // Debug frames load
 #undef DEBUG_FRAMES_LOAD
@@ -322,12 +323,12 @@ SWFMovieDefinition::readHeader(std::auto_ptr<IOChannel> 
in,
 
     _str.reset(new SWFStream(_in.get()));
 
-    m_frame_size.read(*_str);
+    m_frame_size = readRect(*_str);
+
     // If the SWFRect is malformed, SWFRect::read would already 
     // print an error. We check again here just to give 
     // the error are better context.
-    if ( m_frame_size.is_null() )
-    {
+    if (m_frame_size.is_null()) {
         IF_VERBOSE_MALFORMED_SWF(
         log_swferror("non-finite movie bounds");
         );
diff --git a/libcore/parser/SWFParser.cpp b/libcore/parser/SWFParser.cpp
index 32f6193..63d7485 100644
--- a/libcore/parser/SWFParser.cpp
+++ b/libcore/parser/SWFParser.cpp
@@ -16,10 +16,6 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// The SWFMovieDefinition is the 'root' definition of a SWF movie, including
-// movies loaded into another SWF file. Each self-contained SWF file has 
exactly
-// one SWFMovieDefinition.
-
 #include "SWFStream.h"
 #include "movie_definition.h"
 #include "RunResources.h"
diff --git a/libcore/parser/TypesParser.cpp b/libcore/parser/TypesParser.cpp
new file mode 100644
index 0000000..a4c01b8
--- /dev/null
+++ b/libcore/parser/TypesParser.cpp
@@ -0,0 +1,135 @@
+// TypesParser.cpp: read SWF types from a stream
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "TypesParser.h"
+
+#include "SWFStream.h"
+#include "RGBA.h"
+#include "SWFMatrix.h"
+#include "SWFRect.h"
+#include "log.h"
+
+namespace gnash {
+
+SWFMatrix
+readSWFMatrix(SWFStream& in)
+{
+    in.align();
+
+    in.ensureBits(1);
+    const bool has_scale = in.read_bit(); 
+
+    boost::int32_t sx = 65536;
+    boost::int32_t sy = 65536;
+    if (has_scale) {
+        in.ensureBits(5);
+        const boost::uint8_t scale_nbits = in.read_uint(5);
+        in.ensureBits(scale_nbits * 2);
+        sx = in.read_sint(scale_nbits);
+        sy = in.read_sint(scale_nbits);
+    }
+
+    in.ensureBits(1);
+    const bool has_rotate = in.read_bit();
+    boost::int32_t shx = 0;
+    boost::int32_t shy = 0;
+    if (has_rotate) {
+        in.ensureBits(5);
+        int rotate_nbits = in.read_uint(5);
+
+        in.ensureBits(rotate_nbits * 2);
+        shx = in.read_sint(rotate_nbits);
+        shy = in.read_sint(rotate_nbits);
+    }
+
+    in.ensureBits(5);
+    const boost::uint8_t translate_nbits = in.read_uint(5);
+    boost::int32_t tx = 0;
+    boost::int32_t ty = 0;
+    if (translate_nbits) {
+        in.ensureBits(translate_nbits * 2);
+        tx = in.read_sint(translate_nbits);
+        ty = in.read_sint(translate_nbits);
+    }
+    return SWFMatrix(sx, shx, shy, sy, tx, ty);
+}
+
+rgba
+readRGBA(SWFStream& in)
+{
+    in.ensureBytes(4);
+    const boost::uint8_t r = in.read_u8();
+    const boost::uint8_t g = in.read_u8();
+    const boost::uint8_t b = in.read_u8();
+    const boost::uint8_t a = in.read_u8();
+    return rgba(r, g, b, a);
+}
+
+rgba
+readRGB(SWFStream& in)
+{
+    in.ensureBytes(3);
+    const boost::uint8_t r = in.read_u8();
+    const boost::uint8_t g = in.read_u8();
+    const boost::uint8_t b = in.read_u8();
+    const boost::uint8_t a = 0xff;
+    return rgba(r, g, b, a);
+}
+
+/// Format of the bit-packed rectangle is:
+///
+/// bits  | name  | description
+/// ------+-------+-------------------------
+///   5   | nbits | number of bits used in subsequent values
+/// nbits | xmin  | minimum X value
+/// nbits | xmax  | maximum X value
+/// nbits | ymin  | minimum Y value
+/// nbits | ymax  | maximum Y value
+///
+/// If max values are less then min values the SWF is malformed;
+/// in this case this method will raise an swf_error and set the
+/// rectangle to the NULL rectangle. See is_null().
+SWFRect
+readRect(SWFStream& in)
+{
+    in.align();
+    in.ensureBits(5);
+    const int nbits = in.read_uint(5);
+    in.ensureBits(nbits*4);
+    
+    const int minx = in.read_sint(nbits);
+    const int maxx = in.read_sint(nbits);
+    const int miny = in.read_sint(nbits);
+    const int maxy = in.read_sint(nbits);
+
+    // Check if this SWFRect is valid.
+    if (maxx < minx || maxy < miny) {
+        // We set invalid rectangles to NULL, but we might instead
+        // want to actually swap the values if the proprietary player
+        // does so. TODO: check it out.
+        IF_VERBOSE_MALFORMED_SWF(
+            log_swferror("Invalid rectangle: "
+                "minx=%g maxx=%g miny=%g maxy=%g", minx, maxx, miny, maxy);
+        );
+        return SWFRect();
+    } 
+    return SWFRect(minx, maxx, miny, maxy);
+}
+
+}
diff --git a/libcore/parser/TypesParser.h b/libcore/parser/TypesParser.h
new file mode 100644
index 0000000..e039d50
--- /dev/null
+++ b/libcore/parser/TypesParser.h
@@ -0,0 +1,46 @@
+// TypesParser.h: read SWF types from a stream
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_TYPESPARSER_H
+#define GNASH_TYPESPARSER_H
+
+namespace gnash {
+    class SWFStream;
+    class SWFMatrix;
+    class SWFRect;
+    class rgba;
+}
+
+namespace gnash {
+
+/// Read a SWFMatrix from input stream
+SWFMatrix readSWFMatrix(SWFStream& in);
+
+/// Read an RGBA rgba from input stream
+rgba readRGBA(SWFStream& in);
+
+/// Read an RGB rgba from input stream
+rgba readRGB(SWFStream& in);
+    
+/// Read a bit-packed rectangle from an SWF stream
+SWFRect readRect(SWFStream& in);
+
+} // namespace gnash
+
+#endif
diff --git a/libcore/swf/DefineButtonTag.cpp b/libcore/swf/DefineButtonTag.cpp
index c42b4cb..df4fbde 100644
--- a/libcore/swf/DefineButtonTag.cpp
+++ b/libcore/swf/DefineButtonTag.cpp
@@ -21,9 +21,11 @@
 
 // Based on the public domain work of Thatcher Ulrich <address@hidden> 2003
 
+#include "DefineButtonTag.h"
+
+#include "TypesParser.h"
 #include "RunResources.h"
 #include "smart_ptr.h" // GNASH_USE_GC
-#include "DefineButtonTag.h"
 #include "DisplayObject.h"
 #include "Button.h" // for createDisplayObject()
 #include "DefineButtonCxformTag.h"
@@ -54,8 +56,7 @@ DefineButtonTag::DefineButtonTag(SWFStream& in, 
movie_definition& m,
     _trackAsMenu(false),
     _movieDef(m)
 {
-    switch (tag)
-    {
+    switch (tag) {
         default:
             std::abort();
             break;
diff --git a/libcore/swf/DefineEditTextTag.cpp 
b/libcore/swf/DefineEditTextTag.cpp
index 48c903c..4a02257 100644
--- a/libcore/swf/DefineEditTextTag.cpp
+++ b/libcore/swf/DefineEditTextTag.cpp
@@ -15,8 +15,10 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-#include "RunResources.h"
 #include "DefineEditTextTag.h"
+
+#include "TypesParser.h"
+#include "RunResources.h"
 #include "TextField_as.h"
 #include "TextField.h"
 #include "movie_definition.h"
@@ -58,7 +60,7 @@ void
 DefineEditTextTag::read(SWFStream& in, movie_definition& m)
 {
 
-       _rect.read(in);
+       _rect = readRect(in);
 
        in.align();
        in.ensureBytes(2);
@@ -70,9 +72,9 @@ DefineEditTextTag::read(SWFStream& in, movie_definition& m)
        _password  = flags & (1 << 4);
        _readOnly  = flags & (1 << 3); 
 
-    bool hasColor = flags & (1 << 2); 
-       bool hasMaxChars = flags & (1 << 1); 
-       bool hasFont = flags & (1 << 0); 
+    const bool hasColor = flags & (1 << 2); 
+       const bool hasMaxChars = flags & (1 << 1); 
+       const bool hasFont = flags & (1 << 0); 
 
     flags = in.read_u8();
        // 0: no font class, 1 font class and height, can't be true if has_font 
was true
diff --git a/libcore/swf/DefineFontTag.cpp b/libcore/swf/DefineFontTag.cpp
index e8b6fee..1e5b07d 100644
--- a/libcore/swf/DefineFontTag.cpp
+++ b/libcore/swf/DefineFontTag.cpp
@@ -19,6 +19,11 @@
 //
 
 #include "DefineFontTag.h"
+
+#include <memory>
+#include <string>
+
+#include "TypesParser.h"
 #include "SWFStream.h"
 #include "Font.h"
 #include "RunResources.h"
@@ -306,11 +311,10 @@ DefineFontTag::readDefineFont2Or3(SWFStream& in, 
movie_definition& m,
             _glyphTable[i].advance = static_cast<float>(in.read_u16());
         }
 
-        // Bounds table.
-        {
-            SWFRect dummy_rect;
-            // TODO: shouldn't we log_unimpl here ??
-            for (size_t i = 0; i < nGlyphs; i++) dummy_rect.read(in);
+        // TODO: shouldn't we log_unimpl here ??
+        for (size_t i = 0; i < nGlyphs; i++) {
+            LOG_ONCE(log_unimpl("Bounds table in DefineFont2Tag"));
+            readRect(in);
         }
 
         // Kerning pairs.
diff --git a/libcore/swf/DefineMorphShapeTag.cpp 
b/libcore/swf/DefineMorphShapeTag.cpp
index 9346173..36ba9cb 100644
--- a/libcore/swf/DefineMorphShapeTag.cpp
+++ b/libcore/swf/DefineMorphShapeTag.cpp
@@ -24,6 +24,10 @@
 // Vitalij Alexeev <address@hidden> 2004.
 
 #include "DefineMorphShapeTag.h"
+
+#include <boost/cstdint.hpp>
+
+#include "TypesParser.h"
 #include "MorphShape.h"
 #include "SWFStream.h"
 #include "movie_definition.h"
@@ -83,15 +87,13 @@ DefineMorphShapeTag::read(SWFStream& in, TagType tag, 
movie_definition& md,
         || tag == DEFINEMORPHSHAPE2
         || tag == DEFINEMORPHSHAPE2_);
 
-    SWFRect bounds1, bounds2;
-    bounds1.read(in);
-    bounds2.read(in);
+    const SWFRect bounds1 = readRect(in);
+    const SWFRect bounds2 = readRect(in);
 
     if (tag == DEFINEMORPHSHAPE2 || tag == DEFINEMORPHSHAPE2_) {
         // TODO: Use these values.
-        SWFRect innerBound1, innerBound2;
-        innerBound1.read(in);
-        innerBound2.read(in);
+        const SWFRect innerBound1 = readRect(in);
+        const SWFRect innerBound2 = readRect(in);
 
         // This should be used -- first 6 bits reserved, then
         // 'non-scaling' stroke, then 'scaling' stroke -- these can be
@@ -137,31 +139,6 @@ DefineMorphShapeTag::read(SWFStream& in, TagType tag, 
movie_definition& md,
     assert(_shape1.fillStyles().size() == _shape2.fillStyles().size());
     assert(_shape1.lineStyles().size() == _shape2.lineStyles().size());
 
-#if 0
-
-    const unsigned edges1 = PathList::computeNumberOfEdges(_shape1.paths());
-    const unsigned edges2 = PathList::computeNumberOfEdges(_shape2.paths());
-
-    IF_VERBOSE_PARSE(
-      log_parse("morph: "
-          "startShape(paths:%d, edges:%u), "
-          "endShape(paths:%d, edges:%u)",
-          _shape1.paths().size(), edges1,
-          _shape2.paths().size(), edges2);
-    );
-
-    IF_VERBOSE_MALFORMED_SWF(
-        // It is perfectly legal to have a different number of paths,
-        // edges count should be the same instead
-        if (edges1 != edges2) {
-            log_swferror(_("Different number of edges "
-                "in start (%u) and end (%u) shapes "
-                "of a morph"), edges1, edges1);
-        }
-
-    );
-#endif
-
 }
 
 } // namespace SWF
diff --git a/libcore/swf/DefineScalingGridTag.cpp 
b/libcore/swf/DefineScalingGridTag.cpp
index 4ae0e1e..23d11d5 100644
--- a/libcore/swf/DefineScalingGridTag.cpp
+++ b/libcore/swf/DefineScalingGridTag.cpp
@@ -19,6 +19,8 @@
 //
 
 #include "DefineScalingGridTag.h"
+
+#include "TypesParser.h"
 #include "SWFStream.h"
 #include "movie_definition.h"
 #include "MovieClip.h"
@@ -33,14 +35,13 @@ DefineScalingGridTag::loader(SWFStream& in, TagType /*tag*/,
         movie_definition& /*md*/, const RunResources& /*r*/)
 {
     in.ensureBytes(2);
-    boost::uint16_t id = in.read_u16();
+    const boost::uint16_t id = in.read_u16();
 
     IF_VERBOSE_PARSE(
-            log_parse("DefineScalingGridTag: id = %d", id);
+        log_parse("DefineScalingGridTag: id = %d", id);
     );
 
-    SWFRect inner;
-    inner.read(in);
+    const SWFRect inner = readRect(in);
 
     log_unimpl("DefineScalingGridTag");
 
diff --git a/libcore/swf/DefineTextTag.cpp b/libcore/swf/DefineTextTag.cpp
index c7ce9e1..11f9ae4 100644
--- a/libcore/swf/DefineTextTag.cpp
+++ b/libcore/swf/DefineTextTag.cpp
@@ -19,8 +19,13 @@
 
 // Derived from text.cpp       -- Thatcher Ulrich <address@hidden> 2003
 
-#include "RunResources.h"
 #include "DefineTextTag.h"
+
+#include <algorithm>
+#include <numeric>
+
+#include "TypesParser.h"
+#include "RunResources.h"
 #include "SWFStream.h"
 #include "log.h"
 #include "SWF.h"
@@ -32,9 +37,6 @@
 #include "movie_definition.h"
 #include "Transform.h"
 
-#include <algorithm>
-#include <numeric>
-
 namespace gnash {
 namespace SWF {
 
@@ -101,7 +103,7 @@ DefineTextTag::read(SWFStream& in, movie_definition&m, 
TagType tag)
 {
        assert(tag == DEFINETEXT || tag == DEFINETEXT2);
 
-       _rect.read(in);
+       _rect = readRect(in);
        _matrix = readSWFMatrix(in);
 
        in.ensureBytes(2); // glyph_bits + advance_bits
diff --git a/libcore/swf/PlaceObject2Tag.cpp b/libcore/swf/PlaceObject2Tag.cpp
index eb170f7..88b4ba0 100644
--- a/libcore/swf/PlaceObject2Tag.cpp
+++ b/libcore/swf/PlaceObject2Tag.cpp
@@ -18,11 +18,15 @@
 //
 
 #ifdef HAVE_CONFIG_H
-#include "RunResources.h"
 #include "gnashconfig.h" // HAVE_ZLIB_H, USE_SWFTREE
 #endif
 
 #include "PlaceObject2Tag.h"
+
+#include <string>
+
+#include "TypesParser.h"
+#include "RunResources.h"
 #include "DisplayObject.h"
 #include "MovieClip.h"
 #include "swf_event.h"
@@ -440,16 +444,13 @@ PlaceObject2Tag::read(SWFStream& in, TagType tag)
 
     m_TagType = tag;
 
-    if (tag == SWF::PLACEOBJECT)
-    {
+    if (tag == SWF::PLACEOBJECT) {
         readPlaceObject(in);
     }
-    else if ( tag == SWF::PLACEOBJECT2 )
-    {
+    else if (tag == SWF::PLACEOBJECT2) {
         readPlaceObject2(in);
     }
-    else
-    {
+    else {
         readPlaceObject3(in);
     }
 }
@@ -485,12 +486,12 @@ PlaceObject2Tag::~PlaceObject2Tag()
     deleteChecked(_actionBuffers.begin(), _actionBuffers.end());
 }
 
-/* public static */
 void
 PlaceObject2Tag::loader(SWFStream& in, TagType tag, movie_definition& m,
         const RunResources& /*r*/)
 {
-    assert(tag == SWF::PLACEOBJECT || tag == SWF::PLACEOBJECT2 || tag == 
SWF::PLACEOBJECT3);
+    assert(tag == SWF::PLACEOBJECT || tag == SWF::PLACEOBJECT2 ||
+            tag == SWF::PLACEOBJECT3);
 
     // TODO: who owns and is going to remove this tag ?
     PlaceObject2Tag* ch = new PlaceObject2Tag(m);
diff --git a/libcore/swf/SetBackgroundColorTag.h 
b/libcore/swf/SetBackgroundColorTag.h
index 8e9c19d..248708a 100644
--- a/libcore/swf/SetBackgroundColorTag.h
+++ b/libcore/swf/SetBackgroundColorTag.h
@@ -18,12 +18,13 @@
 #ifndef GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
 #define GNASH_SWF_SETBACKGROUNDCOLOR_TAG_H
 
-#include "ControlTag.h" // for inheritance
-#include "SWF.h" // for TagType definition
-#include "MovieClip.h" // for inlines (execute)
-#include "movie_definition.h" // for inlines (loader)
-#include "log.h" // for log_parse
-#include "RGBA.h" // for rgba class
+#include "ControlTag.h" 
+#include "TypesParser.h"
+#include "SWF.h" 
+#include "MovieClip.h" 
+#include "movie_definition.h" 
+#include "log.h" 
+#include "RGBA.h" 
 
 // Forward declarations
 namespace gnash {
diff --git a/libcore/swf/ShapeRecord.cpp b/libcore/swf/ShapeRecord.cpp
index 49007d1..99d070a 100644
--- a/libcore/swf/ShapeRecord.cpp
+++ b/libcore/swf/ShapeRecord.cpp
@@ -17,6 +17,8 @@
 
 
 #include "ShapeRecord.h"
+
+#include "TypesParser.h"
 #include "SWF.h"
 #include "SWFStream.h"
 #include "movie_definition.h"
@@ -267,9 +269,9 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
                             tag == SWF::DEFINESHAPE4 ||
                             tag == SWF::DEFINESHAPE4_);
 
-    if (styleInfo)
-    {
-        _bounds.read(in);
+    if (styleInfo) {
+
+        _bounds = readRect(in);
     
         IF_VERBOSE_PARSE(
             std::string b = _bounds.toString();
@@ -277,10 +279,8 @@ ShapeRecord::read(SWFStream& in, SWF::TagType tag, 
movie_definition& m,
         );
     
         // TODO: Store and use these. Unfinished.
-        if (tag == SWF::DEFINESHAPE4 || tag == SWF::DEFINESHAPE4_)
-        {
-            SWFRect tbound;
-            tbound.read(in);
+        if (tag == SWF::DEFINESHAPE4 || tag == SWF::DEFINESHAPE4_) {
+            const SWFRect tbound = readRect(in);
             in.ensureBytes(1);
             static_cast<void>(in.read_u8());
             LOG_ONCE(log_unimpl("DEFINESHAPE4 edge boundaries and scales"));
diff --git a/libcore/swf/TextRecord.cpp b/libcore/swf/TextRecord.cpp
index 9bdf086..419cec4 100644
--- a/libcore/swf/TextRecord.cpp
+++ b/libcore/swf/TextRecord.cpp
@@ -17,6 +17,11 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "TextRecord.h"
+
+#include <boost/assign/list_of.hpp>
+#include <vector>
+
+#include "TypesParser.h"
 #include "SWFStream.h"
 #include "SWFMatrix.h"
 #include "SWFCxForm.h"
@@ -28,8 +33,6 @@
 #include "Font.h"
 #include "Renderer.h"
 
-#include <boost/assign/list_of.hpp>
-#include <vector>
 
 namespace gnash {
 namespace SWF {    

http://git.savannah.gnu.org/cgit//commit/?id=195be88a568a944bc78b691a72fb7603dc5630c1


commit 195be88a568a944bc78b691a72fb7603dc5630c1
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 10 07:37:19 2010 +0200

    Remove unused convenience functions.

diff --git a/libcore/as_function.cpp b/libcore/as_function.cpp
index d2684d4..27c75cf 100644
--- a/libcore/as_function.cpp
+++ b/libcore/as_function.cpp
@@ -72,12 +72,10 @@ as_function::as_function(Global_as& gl)
        init_member(NSV::PROP_uuPROTOuu, as_value(getFunctionPrototype()), 
flags);
 }
 
-const std::string&
+std::string
 as_function::stringValue() const
 {
-    // TODO: find out what AS3 functions return.
-    static const std::string str("[type Function]");
-    return str;
+    return "[type Function]";
 }
 
 
diff --git a/libcore/as_function.h b/libcore/as_function.h
index 326888d..272190a 100644
--- a/libcore/as_function.h
+++ b/libcore/as_function.h
@@ -73,7 +73,7 @@ public:
     /// be called.
        virtual as_value call(const fn_call& fn) = 0;
 
-    virtual const std::string& stringValue() const;
+    virtual std::string stringValue() const;
 
        /// Run this function as a constructor on an object
     //
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index f4e6f69..6512408 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -148,36 +148,36 @@ public:
     // Fetching members from 'super' yelds a lookup on the associated prototype
     virtual bool get_member(const ObjectURI& uri, as_value* val)
        {
-            as_object* proto = prototype();
-            if (proto) return proto->get_member(uri, val);
-            log_debug("Super has no associated prototype");
-            return false;
+        as_object* proto = prototype();
+        if (proto) return proto->get_member(uri, val);
+        log_debug("Super has no associated prototype");
+        return false;
        }
 
     /// Dispatch.
     virtual as_value call(const fn_call& fn)
        {
 
-            // TODO: this is a hack to make sure objects are constructed, not
-            // converted (fn.isInstantiation() must be true).
-            fn_call::Args::container_type argsIn(fn.getArgs());
-            fn_call::Args args;
-            args.swap(argsIn);
-
-            fn_call fn2(fn.this_ptr, fn.env(), args, fn.super, true);
-            assert(fn2.isInstantiation());
-            as_function* ctor = constructor();
-            if (ctor) return ctor->call(fn2);
-            log_debug("Super has no associated constructor");
-            return as_value();
+        // TODO: this is a hack to make sure objects are constructed, not
+        // converted (fn.isInstantiation() must be true).
+        fn_call::Args::container_type argsIn(fn.getArgs());
+        fn_call::Args args;
+        args.swap(argsIn);
+
+        fn_call fn2(fn.this_ptr, fn.env(), args, fn.super, true);
+        assert(fn2.isInstantiation());
+        as_function* ctor = constructor();
+        if (ctor) return ctor->call(fn2);
+        log_debug("Super has no associated constructor");
+        return as_value();
        }
 
 protected:
 
     virtual void markReachableResources() const
        {
-            if (_super) _super->setReachable();
-            markAsObjectReachable();
+        if (_super) _super->setReachable();
+        markAsObjectReachable();
        }
 
 private:
@@ -267,7 +267,7 @@ public:
         _version(getSWFVersion(this_ptr)),
         _st(getStringTable(this_ptr)),
         _to(to)
-        { /* do nothing */ }
+    {}
 
     bool accept(const ObjectURI& uri, const as_value& val) {
         _to.push_front(std::make_pair(_st.value(getName(uri)),
@@ -312,11 +312,10 @@ as_object::call(const fn_call& /*fn*/)
     throw ActionTypeError();
 }
 
-const std::string&
+std::string
 as_object::stringValue() const
 {
-    static const std::string str("[object Object]");
-    return str;
+    return "[object Object]";
 }
 
 std::pair<bool,bool>
@@ -670,8 +669,8 @@ as_object::init_member(const ObjectURI& uri, const 
as_value& val, int flags)
     // Set (or create) a SimpleProperty 
     if (!_members.setValue(uri, val, flags)) {
         ObjectURI::Logger l(getStringTable(*this));
-        log_error(_("Attempt to initialize read-only property ``%s''"
-                    " on object ``%p'' twice"), l(uri), (void*)this);
+        log_error(_("Attempt to initialize read-only property '%s'"
+                    " on object '%p' twice"), l(uri), (void*)this);
         // We shouldn't attempt to initialize a member twice, should we ?
         abort();
     }
@@ -689,11 +688,7 @@ void
 as_object::init_property(const ObjectURI& uri, as_function& getter,
                          as_function& setter, int flags)
 {
-    as_value cacheValue;
-
-    // PropertyList::addGetterSetter always returns true (used to be
-    // an assert).
-    _members.addGetterSetter(uri, getter, &setter, cacheValue, flags);
+    _members.addGetterSetter(uri, getter, &setter, as_value(), flags);
 }
 
 void
@@ -708,8 +703,6 @@ void
 as_object::init_property(const ObjectURI& uri, as_c_function_ptr getter,
                          as_c_function_ptr setter, int flags)
 {
-    // PropertyList::addGetterSetter always returns true (used to be
-    // an assert).
     _members.addGetterSetter(uri, getter, setter, flags);
 }
 
@@ -717,18 +710,14 @@ bool
 as_object::init_destructive_property(const ObjectURI& uri, as_function& getter,
                                      int flags)
 {
-    // No case check, since we've already got the key.
-    bool success = _members.addDestructiveGetter(uri, getter, flags);
-    return success;
+    return _members.addDestructiveGetter(uri, getter, flags);
 }
 
 bool
 as_object::init_destructive_property(const ObjectURI& uri,
                                      as_c_function_ptr getter, int flags)
 {
-    // No case check, since we've already got the key.
-    bool success = _members.addDestructiveGetter(uri, getter, flags);
-    return success;
+    return _members.addDestructiveGetter(uri, getter, flags);
 }
 
 void
@@ -742,14 +731,6 @@ as_object::init_readonly_property(const std::string& key, 
as_function& getter,
 }
 
 void
-as_object::init_readonly_property(const ObjectURI& uri, as_function& getter,
-                                  int initflags)
-{
-    init_property(uri, getter, getter, initflags | PropFlags::readOnly);
-    assert(_members.getProperty(uri));
-}
-
-void
 as_object::init_readonly_property(const std::string& key,
                                   as_c_function_ptr getter, int initflags)
 {
@@ -760,15 +741,6 @@ as_object::init_readonly_property(const std::string& key,
 }
 
 void
-as_object::init_readonly_property(const ObjectURI& uri,
-                                  as_c_function_ptr getter, int initflags)
-{
-    init_property(uri, getter, getter, initflags | PropFlags::readOnly);
-    assert(_members.getProperty(uri));
-}
-
-
-void
 as_object::set_member_flags(const ObjectURI& uri, int setTrue, int setFalse)
 {
     _members.setFlags(uri, setTrue, setFalse);
@@ -857,10 +829,9 @@ as_object::prototypeOf(as_object& instance)
 
     std::set<as_object*> visited;
 
-    while (obj && visited.insert(obj.get()).second )
-       {
-            if ( obj->get_prototype() == this ) return true;
-            obj = obj->get_prototype(); 
+    while (obj && visited.insert(obj.get()).second ) {
+        if (obj->get_prototype() == this) return true;
+        obj = obj->get_prototype(); 
        }
 
     // See actionscript.all/Inheritance.as for a way to trigger this
@@ -875,8 +846,8 @@ as_object::prototypeOf(as_object& instance)
 void
 as_object::dump_members() 
 {
-    log_debug(_("%d members of object %p follow"),
-              _members.size(), (const void*)this);
+    log_debug(_("%d members of object %p follow"), _members.size(),
+            static_cast<const void*>(this));
     _members.dump();
 }
 
@@ -1147,7 +1118,7 @@ Trigger::call(const as_value& oldval, const as_value& 
newval,
         return ret;
         
     }
-    catch (GnashException&) {
+    catch (const GnashException&) {
         _executing = false;
         throw;
     }
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 7a62bde..d35d455 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -204,7 +204,7 @@ public:
     //
     /// This is dependent on the VM version and the type of object, function,
     /// or class.
-    virtual const std::string& stringValue() const;
+    virtual std::string stringValue() const;
 
     /// The most common flags for built-in properties.
     //
@@ -406,9 +406,6 @@ public:
     void init_readonly_property(const std::string& key, as_function& getter,
             int flags = DefaultFlags);
 
-    void init_readonly_property(const ObjectURI& uri,
-            as_function& getter, int flags = DefaultFlags);
-
     /// Use this method for read-only properties.
     //
     /// This method achieves the same as the above init_property method.
@@ -425,9 +422,6 @@ public:
     void init_readonly_property(const std::string& key,
             as_c_function_ptr getter, int flags = DefaultFlags);
 
-    void init_readonly_property(const ObjectURI& uri,
-            as_c_function_ptr getter, int flags = DefaultFlags);
-
     /// Enumerate all non-hidden property keys to the given as_environment.
     //
     /// NB: this function does not access the property values, so callers

-----------------------------------------------------------------------

Summary of changes:
 libbase/zlib_adapter.cpp                           |    4 +-
 libcore/FillStyle.cpp                              |  288 +++-----------------
 libcore/FillStyle.h                                |   52 +---
 libcore/LineStyle.cpp                              |    4 +-
 libcore/RGBA.cpp                                   |   25 --
 libcore/RGBA.h                                     |   13 -
 libcore/SWFMatrix.cpp                              |   44 ---
 libcore/SWFMatrix.h                                |    4 -
 libcore/SWFRect.cpp                                |   57 +---
 libcore/SWFRect.h                                  |   21 +--
 libcore/as_function.cpp                            |    6 +-
 libcore/as_function.h                              |    2 +-
 libcore/as_object.cpp                              |   93 +++----
 libcore/as_object.h                                |    8 +-
 libcore/parser/Makefile.am                         |    2 +
 libcore/parser/SWFMovieDefinition.cpp              |    9 +-
 libcore/parser/SWFParser.cpp                       |    4 -
 libcore/{FillStyle.cpp => parser/TypesParser.cpp}  |  279 +++++++------------
 .../{swf/VideoFrameTag.h => parser/TypesParser.h}  |   58 ++--
 libcore/swf/DefineButtonTag.cpp                    |    7 +-
 libcore/swf/DefineEditTextTag.cpp                  |   12 +-
 libcore/swf/DefineFontTag.cpp                      |   14 +-
 libcore/swf/DefineMorphShapeTag.cpp                |   39 +--
 libcore/swf/DefineScalingGridTag.cpp               |    9 +-
 libcore/swf/DefineTextTag.cpp                      |   12 +-
 libcore/swf/PlaceObject2Tag.cpp                    |   19 +-
 libcore/swf/SetBackgroundColorTag.h                |   13 +-
 libcore/swf/ShapeRecord.cpp                        |   14 +-
 libcore/swf/TextRecord.cpp                         |    7 +-
 librender/Renderer_agg.cpp                         |    2 +-
 librender/Renderer_agg.h                           |    1 +
 librender/Renderer_cairo.cpp                       |   16 +-
 macros/boost.m4                                    |    4 +-
 33 files changed, 334 insertions(+), 808 deletions(-)
 copy libcore/{FillStyle.cpp => parser/TypesParser.cpp} (65%)
 copy libcore/{swf/VideoFrameTag.h => parser/TypesParser.h} (51%)


hooks/post-receive
-- 
Gnash



reply via email to

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