gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/Makefile.am server/fontl...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Makefile.am server/fontl...
Date: Sat, 01 Dec 2007 15:41:00 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/01 15:41:00

Modified files:
        .              : ChangeLog 
        server         : Makefile.am fontlib.cpp shape.cpp shape.h 
        server/parser  : morph2_character_def.cpp morph2_character_def.h 
                         shape_character_def.cpp shape_character_def.h 
Removed files:
        server         : tesselate.cpp tesselate.h 

Log message:
        Drop unused software renderer (tesselator, mesh_set and friends)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5041&r2=1.5042
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fontlib.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.cpp?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/tesselate.cpp?cvsroot=gnash&r1=1.15&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/tesselate.h?cvsroot=gnash&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/morph2_character_def.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/morph2_character_def.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.h?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5041
retrieving revision 1.5042
diff -u -b -r1.5041 -r1.5042
--- ChangeLog   1 Dec 2007 12:58:41 -0000       1.5041
+++ ChangeLog   1 Dec 2007 15:40:58 -0000       1.5042
@@ -1,9 +1,16 @@
+2007-12-01 Sandro Santilli <address@hidden>
+
+       * server/: Makefile.am, fontlib.cpp, shape.{cpp,h},
+         tesselate.{cpp,h}, parser/morph2_character_def.{cpp,h},
+         parser/shape_character_def.{cpp,h}:
+         Drop unused software renderer (tesselator, mesh_set and friends)
+
 2007-12-01 Benjamin Wolsey <address@hidden>
 
        * libmedia/sdl/MediaParserFfmpeg.cpp: Add buffer to prevent invalid
          reads when decoding media frames.
 
-2007-11-30 Sandro Santilli <address@hidden>
+2007-12-01 Sandro Santilli <address@hidden>
 
        * server/: font.{cpp,h}, fontlib.{cpp,h}, text.cpp:
          Drop deprecated textured glyphs support.

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- server/Makefile.am  23 Nov 2007 22:23:24 -0000      1.132
+++ server/Makefile.am  1 Dec 2007 15:40:59 -0000       1.133
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.132 2007/11/23 22:23:24 strk Exp $
+# $Id: Makefile.am,v 1.133 2007/12/01 15:40:59 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -107,7 +107,6 @@
        shape.cpp \
        stream.cpp \
        styles.cpp \
-       tesselate.cpp \
        text.cpp \
        textformat.cpp \
        timers.cpp \
@@ -185,7 +184,6 @@
        swf/StartSoundTag.h \
        swf_event.h \
        swf_function.h \
-       tesselate.h \
        text.h \
        textformat.h \
        timers.h \

Index: server/fontlib.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fontlib.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/fontlib.cpp  1 Dec 2007 10:19:39 -0000       1.39
+++ server/fontlib.cpp  1 Dec 2007 15:40:59 -0000       1.40
@@ -5,7 +5,7 @@
 
 // A module to take care of all of gnash's loaded fonts.
 
-/* $Id: fontlib.cpp,v 1.39 2007/12/01 10:19:39 strk Exp $ */
+/* $Id: fontlib.cpp,v 1.40 2007/12/01 15:40:59 strk Exp $ */
 
 #include "tu_file.h"
 #include "gnash.h"
@@ -15,7 +15,6 @@
 #include "render.h"
 #include "shape_character_def.h"
 #include "styles.h"
-#include "tesselate.h"
 #include "movie_definition.h"
 
 // Define to the name of a default font.

Index: server/shape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shape.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- server/shape.cpp    1 Dec 2007 01:08:09 -0000       1.51
+++ server/shape.cpp    1 Dec 2007 15:40:59 -0000       1.52
@@ -21,7 +21,6 @@
 #include "shape.h"
 
 #include "tu_file.h"
-#include "tesselate.h"
 #include "rect.h"
 #include "log.h"
 
@@ -41,20 +40,6 @@
 // edge
 //
 
-void   edge::tesselate_curve() const
-    // Send this segment to the tesselator.
-{
-       if ( isStraight() )
-       {
-               //log_msg("is straight!!");
-               tesselate::add_line_segment(ap.x, ap.y);
-       }
-       else
-       {
-               tesselate::add_curve_segment(cp.x, cp.y, ap.x, ap.y);
-       }
-}
-
 /* public static */
 point
 edge::pointOnCurve(const point& A, const point& C, const point& B, float t)
@@ -335,20 +320,6 @@
     return;
 }
 
-void   path::tesselate() const
-    // Push this path into the tesselator.
-{
-    tesselate::begin_path(
-       m_fill0 - 1,
-       m_fill1 - 1,
-       m_line - 1,
-       ap.x, ap.y);
-    for (unsigned int i = 0; i < m_edges.size(); i++) {
-       m_edges[i].tesselate_curve();
-    }
-    tesselate::end_path();
-}
-
 void 
 path::drawLineTo(float dx, float dy)
 {
@@ -413,7 +384,6 @@
                        // TODO: find an apprpriate value for segCount based
                        //       on rendering scale ?
                        //
-                       float minDist = std::numeric_limits<float>::max();
                        int segCount = 10; 
                        point p0 = A;
                        for (int i=1; i<=segCount; ++i)
@@ -449,308 +419,6 @@
                 bind(&edge::transform, _1, ref(mat)));                
 }
 
-//
-// mesh
-//
-
-       
-mesh::mesh()
-{
-}
-
-
-void   mesh::set_tri_strip(const point pts[], int count)
-{
-    m_triangle_strip.resize(count * 2);        // 2 coords per point
-               
-    // convert to ints.
-    for (int i = 0; i < count; i++) {
-       m_triangle_strip[i * 2] = int16_t(pts[i].x);
-       m_triangle_strip[i * 2 + 1] = int16_t(pts[i].y);
-    }
-
-//             m_triangle_strip.resize(count);
-//             memcpy(&m_triangle_strip[0], &pts[0], count * sizeof(point));
-}
-
-
-
-
-//
-// line_strip
-//
-
-
-line_strip::line_strip()
-    // Default constructor, for std::vector<>.
-    :
-m_style(-1)
-{}
-
-
-line_strip::line_strip(int style, const point coords[], int coord_count)
-    // Construct the line strip (polyline) made up of the given sequence of 
points.
-    :
-m_style(style)
-{
-    assert(style >= 0);
-    assert(coords != NULL);
-    assert(coord_count > 1);
-
-//             m_coords.resize(coord_count);
-//             memcpy(&m_coords[0], coords, coord_count * sizeof(coords[0]));
-    m_coords.resize(coord_count * 2);  // 2 coords per vert
-               
-    // convert to ints.
-    for (int i = 0; i < coord_count; i++) {
-       m_coords[i * 2] = int16_t(coords[i].x);
-       m_coords[i * 2 + 1] = int16_t(coords[i].y);
-    }
-}
-
-
-
-
-
-// Utility: very simple greedy tri-stripper.  Useful for
-// stripping the stacks of trapezoids that come out of our
-// tesselator.
-class tri_stripper
-{
-public:
-    // A set of strips; we'll join them together into one
-    // strip during the flush.
-    std::vector< std::vector<point> >  m_strips;
-    int        m_last_strip_used;
-
-    tri_stripper()
-       : m_last_strip_used(-1)
-       {
-       }
-
-    void       add_trapezoid(const point& l0, const point& r0, const point& 
l1, const point& r1)
-       // Add two triangles to our strip.
-       {
-           // See if we can attach this mini-strip to an existing strip.
-
-           if (l0 != r0) {
-               // Check the next strip first; trapezoids will
-               // tend to arrive in rotating order through
-               // the active strips.
-               assert(m_last_strip_used >= -1 && m_last_strip_used < (int) 
m_strips.size());
-               int i = m_last_strip_used + 1, n = m_strips.size();
-               for ( ; i < n; i++)     {
-                   std::vector<point>& str = m_strips[i];
-                   assert(str.size() >= 3);    // should have at least one tri 
already.
-                               
-                   int last = str.size() - 1;
-                   if (str[last - 1] == l0 && str[last] == r0)
-                       {
-                           // Can join these tris to this strip.
-                           str.push_back(l1);
-                           str.push_back(r1);
-                           m_last_strip_used = i;
-                           return;
-                       }
-               }
-               for (i = 0; i <= m_last_strip_used; i++) {
-                   std::vector<point>& str = m_strips[i];
-                   assert(str.size() >= 3);    // should have at least one tri 
already.
-                               
-                   int last = str.size() - 1;
-                   if (str[last - 1] == l0 && str[last] == r0) {
-                       // Can join these tris to this strip.
-                       str.push_back(l1);
-                       str.push_back(r1);
-                       m_last_strip_used = i;
-                       return;
-                   }
-               }
-           }
-           // else this trapezoid is pointy on top, so
-           // it's almost certainly the start of a new
-           // strip.  Don't bother searching current
-           // strips.
-
-           // Can't join with existing strip, so start a new strip.
-           m_strips.resize(m_strips.size() + 1);
-           m_strips.back().resize(4);
-           m_strips.back()[0] = l0;
-           m_strips.back()[1] = r0;
-           m_strips.back()[2] = l1;
-           m_strips.back()[3] = r1;
-       }
-
-
-    void       flush(mesh_set* m, int style) const
-       // Join sub-strips together, and push the whole thing into the given 
mesh_set,
-       // under the given style.
-       {
-           if (m_strips.size()) {
-               std::vector<point>      big_strip;
-
-               big_strip = m_strips[0];
-               assert(big_strip.size() >= 3);
-
-               for (unsigned int i = 1, n = m_strips.size(); i < n; i++) {
-                   // Append to the big strip.
-                   const std::vector<point>&   str = m_strips[i];
-                   assert(str.size() >= 3);    // should have at least one tri 
already.
-                               
-                   int last = big_strip.size() - 1;
-                   if (big_strip[last] == str[1]
-                       && big_strip[last - 1] == str[0]) {
-                       // Strips fit right together.  Append.
-                       big_strip.insert(big_strip.end(), str.begin() + 2, 
str.end());
-                   } else if (big_strip[last] == str[0]
-                              && big_strip[last - 1] == str[1]) {
-                       // Strips fit together with a half-twist.
-                       point   to_dup = big_strip[last - 1];
-                       big_strip.push_back(to_dup);
-                       big_strip.insert(big_strip.end(), str.begin() + 2, 
str.end());
-                   } else {
-                       // Strips need a degenerate to link them together.
-                       point   to_dup = big_strip[last];
-                       big_strip.push_back(to_dup);
-                       big_strip.push_back(str[0]);
-                       big_strip.insert(big_strip.end(), str.begin(), 
str.end());
-                   }
-               }
-
-               m->set_tri_strip(style, &big_strip[0], big_strip.size());
-           }
-       }
-};
-
-
-//
-// mesh_set
-//
-
-
-mesh_set::mesh_set()
-    :
-//             m_last_frame_rendered(-1),
-    m_error_tolerance(0)       // invalid -- don't use this constructor; it's 
only here for array (@@ fix array)
-{
-}
-
-mesh_set::mesh_set(const tesselate::tesselating_shape* sh, float 
error_tolerance)
-    // Tesselate the shape's paths into a different mesh for each fill style.
-    :
-//             m_last_frame_rendered(0),
-m_error_tolerance(error_tolerance)
-{
-    class collect_traps : public tesselate::trapezoid_accepter
-    {
-    public:
-       mesh_set*       m;      // the mesh_set that receives trapezoids.
-
-       // strips-in-progress.
-       typedef std::map<int, tri_stripper*> StripsMap;
-       StripsMap m_strips;
-
-       collect_traps(mesh_set* set) : m(set) {}
-
-       ~collect_traps()
-       {
-               // Delete any unflushed strip
-               for (StripsMap::const_iterator it = m_strips.begin();
-                       it != m_strips.end(); ++it)
-               {
-                   tri_stripper* s = it->second;
-                   delete s;
-               }
-       }
-
-       // Overrides from trapezoid_accepter
-       void    accept_trapezoid(int style, const tesselate::trapezoid& tr)
-           {
-               // Add trapezoid to appropriate stripper.
-
-               StripsMap::iterator it = m_strips.find(style);
-               tri_stripper* s = NULL;
-               if ( it == m_strips.end() )
-               {
-                       s = new tri_stripper;
-                       m_strips[style] = s;
-               }
-               else
-               {
-                       s = it->second;
-               }
-
-               s->add_trapezoid(
-                   point(tr.m_lx0, tr.m_y0),
-                   point(tr.m_rx0, tr.m_y0),
-                   point(tr.m_lx1, tr.m_y1),
-                   point(tr.m_rx1, tr.m_y1));
-           }
-
-           // Remember this line strip in our mesh set.
-       void    accept_line_strip(int style, const point coords[], int 
coord_count)
-           {
-               m->add_line_strip(style, coords, coord_count);
-           }
-
-           // Push our strips into the mesh set.
-       void    flush() 
-           {
-               for (StripsMap::const_iterator it = m_strips.begin();
-                    it != m_strips.end();
-                    ++it)
-               {
-                   // Push strip into m.
-                   tri_stripper* s = it->second;
-                   s->flush(m, it->first);
-                                       
-                   delete s;
-               }
-               m_strips.clear();
-           }
-    };
-    collect_traps      accepter(this);
-
-    sh->tesselate(error_tolerance, &accepter);
-    accepter.flush();
-
-    // triangles should be collected now into the meshes for each fill style.
-}
-
-
-//     int     mesh_set::get_last_frame_rendered() const { return 
m_last_frame_rendered; }
-//     void    mesh_set::set_last_frame_rendered(int frame_counter) { 
m_last_frame_rendered = frame_counter; }
-
-
-
-void   mesh_set::set_tri_strip(int style, const point pts[], int count)
-    // Set mesh associated with the given fill style to the
-    // specified triangle strip.
-{
-    assert(style >= 0);
-    assert(style < 10000);     // sanity check
-
-    // Expand our mesh list if necessary.
-    if (style >= (int) m_meshes.size()) {
-       m_meshes.resize(style + 1);
-    }
-
-    m_meshes[style].set_tri_strip(pts, count);
-}
-
-       
-void   mesh_set::add_line_strip(int style, const point coords[], int 
coord_count)
-    // Add the specified line strip to our list of things to render.
-{
-    assert(style >= 0);
-    assert(style < 1000);      // sanity check
-    assert(coords != NULL);
-    assert(coord_count > 1);
-
-    m_line_strips.push_back(line_strip(style, coords, coord_count));
-}
-
-
 }      // end namespace gnash
 
 

Index: server/shape.h
===================================================================
RCS file: /sources/gnash/gnash/server/shape.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/shape.h      1 Dec 2007 01:08:09 -0000       1.35
+++ server/shape.h      1 Dec 2007 15:40:59 -0000       1.36
@@ -5,7 +5,7 @@
 
 // Quadratic bezier outline shapes, the basis for most SWF rendering.
 
-/* $Id: shape.h,v 1.35 2007/12/01 01:08:09 strk Exp $ */
+/* $Id: shape.h,v 1.36 2007/12/01 15:40:59 strk Exp $ */
 
 #ifndef GNASH_SHAPE_H
 #define GNASH_SHAPE_H
@@ -19,9 +19,6 @@
 // Forward declarations
 namespace gnash {
        class rect; // for path::expandBounds
-       namespace tesselate {
-               class tesselating_shape;
-       }
 }
 
 namespace gnash {
@@ -53,8 +50,6 @@
                {
                }
 
-               void    tesselate_curve() const;
-
                bool isStraight() const
                {
                        return cp == ap;
@@ -192,9 +187,6 @@
                ///
                void ray_crossing(int& ray_crossings, float x, float y) const;
 
-               /// Push the path into the tesselator.
-               void    tesselate() const;
-
                /// @{ Primitives for the Drawing API
                ///
                /// Name of these functions track Ming interface
@@ -372,60 +364,6 @@
 
        };
 
-       /// For holding a pre-tesselated shape.
-       class mesh
-       {
-       public:
-               mesh();
-
-               void    set_tri_strip(const point pts[], int count);
-
-
-       private:
-         friend class triangulating_render_handler; 
-               std::vector<int16_t>    m_triangle_strip;
-       };
-
-
-       /// For holding a line-strip (i.e. polyline).
-       class line_strip
-       {
-       public:
-               line_strip();
-               line_strip(int style, const point coords[], int coord_count);
-
-               int     get_style() const { return m_style; }
-       private:
-    friend class triangulating_render_handler; 
-               int     m_style;
-               std::vector<int16_t>    m_coords;
-       };
-
-
-       /// A whole shape, tesselated to a certain error tolerance.
-       class DSOEXPORT mesh_set
-       {
-       public:
-               mesh_set();
-               mesh_set(const tesselate::tesselating_shape* sh,
-                        float error_tolerance);
-
-//             int     get_last_frame_rendered() const;
-//             void    set_last_frame_rendered(int frame_counter);
-               float   get_error_tolerance() const { return m_error_tolerance; 
}
-
-               void    set_tri_strip(int style, const point pts[], int count);
-               void    add_line_strip(int style, const point coords[], int 
coord_count);
-
-       private:
-    friend class triangulating_render_handler; 
-//             int     m_last_frame_rendered;  // @@ Hm, we shouldn't 
spontaneously drop cached data I don't think...
-               float   m_error_tolerance;
-               std::vector<mesh>       m_meshes;       // One mesh per style.
-               std::vector<line_strip> m_line_strips;
-       };
-
-
 }      // end namespace gnash
 
 

Index: server/parser/morph2_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/morph2_character_def.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/parser/morph2_character_def.cpp      10 Nov 2007 14:39:52 -0000      
1.18
+++ server/parser/morph2_character_def.cpp      1 Dec 2007 15:40:59 -0000       
1.19
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: morph2_character_def.cpp,v 1.18 2007/11/10 14:39:52 strk Exp $ */
+/* $Id: morph2_character_def.cpp,v 1.19 2007/12/01 15:40:59 strk Exp $ */
 
 // Based on the public domain morph2.cpp of:
 // Thatcher Ulrich <address@hidden>, Mike Shaver <address@hidden> 2003,
@@ -99,7 +99,7 @@
 };
 
        morph2_character_def::morph2_character_def():
-               m_last_ratio(-1.0f), m_mesh(0)
+               m_last_ratio(-1.0f)
        {
                m_shape1 = new shape_character_def();
                m_shape2 = new shape_character_def();
@@ -192,18 +192,6 @@
     gnash::render::draw_shape_character(this, inst);
     }
 
-/*
-               matrix mat = inst->get_world_matrix();
-               cxform cx = inst->get_world_cxform();
-               float max_error = 20.0f / mat.get_max_scale() / 
inst->get_parent()->get_pixel_scale();
-               if (ratio != m_last_ratio)
-               {
-                       delete m_mesh;
-                       m_last_ratio = ratio;
-                       m_mesh = new mesh_set(this, max_error * 0.75f);
-               }
-       m_mesh->display(mat, cx, m_fill_styles, m_line_styles);
-*/
        }
 
 

Index: server/parser/morph2_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/morph2_character_def.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/parser/morph2_character_def.h        7 Aug 2007 20:53:10 -0000       
1.4
+++ server/parser/morph2_character_def.h        1 Dec 2007 15:40:59 -0000       
1.5
@@ -78,7 +78,6 @@
                int fill_style_count;
                int line_style_count;
                float m_last_ratio;
-               mesh_set*       m_mesh;
                mutable rect m_bound;
        };
 }

Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- server/parser/shape_character_def.cpp       1 Dec 2007 01:08:09 -0000       
1.53
+++ server/parser/shape_character_def.cpp       1 Dec 2007 15:40:59 -0000       
1.54
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: shape_character_def.cpp,v 1.53 2007/12/01 01:08:09 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.54 2007/12/01 15:40:59 strk Exp $ */
 
 // Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden> 
2003
 
@@ -160,7 +160,6 @@
 shape_character_def::shape_character_def(const shape_character_def& o)
   :
   character_def(o),
-  tesselate::tesselating_shape(o),
   m_fill_styles(o.m_fill_styles),
   m_line_styles(o.m_line_styles),
   m_paths(o.m_paths),
@@ -701,26 +700,6 @@
     fill_styles, line_styles);
 }
 
-
-
-
-void  shape_character_def::tesselate(float error_tolerance, 
tesselate::trapezoid_accepter* accepter) const
-    // Push our shape data through the tesselator.
-{
-    tesselate::begin_shape(accepter, error_tolerance);
-    for (unsigned int i = 0; i < m_paths.size(); i++) {
-  if (m_paths[i].m_new_shape == true) {
-      // Hm; should handle separate sub-shapes in a less lame way.
-      tesselate::end_shape();
-      tesselate::begin_shape(accepter, error_tolerance);
-  } else {
-      m_paths[i].tesselate();
-  }
-    }
-    tesselate::end_shape();
-}
-
-
 // TODO: this should be moved to libgeometry or something
 int curve_x_crossings(float x0, float y0, float x1, float y1, 
   float cx, float cy, float y, float &cross1, float &cross2)

Index: server/parser/shape_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/parser/shape_character_def.h 1 Dec 2007 01:08:10 -0000       1.19
+++ server/parser/shape_character_def.h 1 Dec 2007 15:40:59 -0000       1.20
@@ -5,14 +5,13 @@
 
 // Quadratic bezier outline shapes, the basis for most SWF rendering.
 
-/* $Id: shape_character_def.h,v 1.19 2007/12/01 01:08:10 strk Exp $ */
+/* $Id: shape_character_def.h,v 1.20 2007/12/01 15:40:59 strk Exp $ */
 
 #ifndef GNASH_SHAPE_CHARACTER_DEF_H
 #define GNASH_SHAPE_CHARACTER_DEF_H
 
 
 #include "character_def.h" // for inheritance of shape_character_def
-#include "tesselate.h" 
 #include "shape.h" // for path
 #include "rect.h" // for composition
 
@@ -30,10 +29,7 @@
        /// Represents the outline of one or more shapes, along with
        /// information on fill and line styles.
        //
-       /// Inheritance from tesselating_shape is only needed to expose a known 
interface
-       /// for mesh_set class use.
-       ///
-       class shape_character_def : public character_def, public 
tesselate::tesselating_shape
+       class shape_character_def : public character_def
        {
        public:
 
@@ -81,7 +77,6 @@
                        float pixel_scale,
                        const std::vector<fill_style>& fill_styles,
                        const std::vector<line_style>& line_styles) const;
-               virtual void    tesselate(float error_tolerance, 
tesselate::trapezoid_accepter* accepter) const;
 
                /// Get cached bounds of this shape.
                const rect&     get_bound() const { return m_bound; }
@@ -147,8 +142,6 @@
                        return *this;
                }
 
-               // Cached pre-tesselated meshes. (deprecated)
-               //mutable std::vector<mesh_set*>        m_cached_meshes;
        };
 
 }      // end namespace gnash

Index: server/tesselate.cpp
===================================================================
RCS file: server/tesselate.cpp
diff -N server/tesselate.cpp
--- server/tesselate.cpp        10 Nov 2007 11:51:43 -0000      1.15
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,561 +0,0 @@
-// tesselate.cpp       -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// 2D shape tesselator.  Actually a "trapezoidizer".  Takes line/curve
-// segments with a style index, and outputs trapezoids.
-//
-// Comments on tesselation strategies:
-//
-// Current method basically works but has some problems.  It's slow,
-// it generates lots of triangles where the poly edges are curvy, and
-// occasionally it makes a leak around very thin shapes.
-//
-// Shewchuk's constrained delaunay triangulator: not appropriate for
-// rendering; it's big thing is making roundish triangles, at the
-// expense of triangle count.  That's the right tradeoff for FEA
-// (Shewchuk's main target application), but the wrong tradeoff for
-// rendering; we don't have any particular problem with skinny
-// triangles.
-//
-// Something like "A Fast Trapezoidation Technique For Planar
-// Polygons".  The key improvement there is to only cut from a
-// vertex/event to the nearest adjacent edges, instead of slicing
-// across the entire set of active edges.  This sounds good.
-//
-// Or, "FIST: Fast Industrial-Strength Triangulation of Polygons" by
-// Martin Held.  This looks good; application is rasterization.  The
-// funny thing here is that they explicitly deal with holes by
-// inserting zero-area bridge edges to connect the holes with the
-// outer boundary, to make one continuous poly.  This seems a little
-// hacky and possibly tricky.
-//
-// Or, just optimize what we've got.  I took a quick look at the cairo
-// project's trapezoider -- it's very similar to ours but seems to do
-// its work in-place without resizing the edge list constantly, so it
-// should be pretty quick.  They do some high-precision integer voodoo
-// in their intercept calculation that I don't 100% understand.
-//
-//
-// Findings re SWF polygons:
-//
-// (Based on experiments with Flash MX 2004; old movies seem to obey
-// these rules as well, as far as I can tell):
-//
-// * no intersecting edges -- if you make intersections in the tool
-// (even by stretching curve segments around), the tool inserts verts
-// automatically.
-//
-// * left-fill and right-fill seem to be randomly selected.
-//
-// * individual paths (i.e. segment paths with a consistent set of
-// fill styles) are not closed
-//
-// * there's no odd-even insanity; the tool cleans up the poly if you
-// try to make self-intersections and flips and such.
-//
-// * if you duplicate the paths with two fill styles (so every path
-// has just one fill style), and reverse the right-fill paths so they
-// make left-fill paths, and then join open verts of the same fill
-// style, you will be left with a set of non-intersecting closed polys
-// with a consistent winding.  I.e. fairly well-behaved.  They may
-// have holes though.
-//
-// Current outlook: Any of "A Fast Trapezoidation", "FIST", or
-// cairo-style should work.  FIST will make the fewest tris (since it
-// doesn't add any verts).  Current method can be optimized as well --
-// can remove intersection checks (they're probably just harmful).
-//
-// FIST will probably be the most impervious to leaks, since it
-// rationally deals with self-intersection by just overlapping parts
-// of the tesselated poly.
-
-/* $Id: tesselate.cpp,v 1.15 2007/11/10 11:51:43 strk Exp $ */
-
-#include "tesselate.h"
-#include "types.h"
-#include "utility.h"
-#include "container.h"
-#include "Point2d.h"
-
-#include <vector>
-
-namespace gnash {
-namespace tesselate {
-
-       // Curve subdivision error tolerance.
-       static float    s_tolerance = 1.0f;
-       static trapezoid_accepter*      s_accepter = NULL;
-
-       trapezoid_accepter::~trapezoid_accepter()
-       {
-       }
-
-        class fill_segment
-       {
-       public:
-               point   m_begin;
-               point   m_end;
-               int     m_left_style, m_right_style, m_line_style;
-
-               fill_segment() {}
-
-               fill_segment(
-                       const point& a,
-                       const point& b,
-                       int left_style,
-                       int right_style,
-                       int line_style)
-                       :
-                       m_begin(a),
-                       m_end(b),
-                       m_left_style(left_style),
-                       m_right_style(right_style),
-                       m_line_style(line_style)
-               {
-                       // For rasterization, we want to ensure that
-                       // the segment always points towards positive
-                       // y...
-                       if (m_begin.y > m_end.y)
-                       {
-                               flip();
-                       }
-               }
-
-               void    flip()
-               // Exchange end points, and reverse fill sides.
-               {
-                       swap(&m_begin, &m_end);
-
-                       // swap fill styles...
-                       swap(&m_left_style, &m_right_style);
-               }
-
-               float   get_height() const
-               // Return segment height.
-               {
-                       assert(m_end.y >= m_begin.y);
-
-                       return m_end.y - m_begin.y;
-               }
-       };
-
-
-       // More Renderer state.
-       static std::vector<fill_segment>        s_current_segments;     // @@ 
should not dynamically resize this thing!
-       static std::vector<point>       s_current_path;                 // @@ 
should not dynamically resize this thing!
-       static point    s_last_point;
-       static int      s_current_left_style;
-       static int      s_current_right_style;
-       static int      s_current_line_style;
-       static bool     s_shape_has_line;       // flag to let us skip the line 
rendering if no line styles were set when defining the shape.
-       static bool     s_shape_has_fill;       // flag to let us skip the fill 
rendering if no fill styles were set when defining the shape.
-
-
-       static void     peel_off_and_emit(int i0, int i1, float y0, float y1);
-
-
-       void    begin_shape(trapezoid_accepter* accepter, float 
curve_error_tolerance)
-       {
-               assert(accepter);
-               s_accepter = accepter;
-
-               // ensure we're not already in a shape or path.
-               // make sure our shape state is cleared out.
-               assert(s_current_segments.size() == 0);
-               s_current_segments.resize(0);
-
-               assert(s_current_path.size() == 0);
-               s_current_path.resize(0);
-
-               assert(curve_error_tolerance > 0);
-               if (curve_error_tolerance > 0)
-               {
-                       s_tolerance = curve_error_tolerance;
-               }
-               else
-               {
-                       s_tolerance = 1.0f;
-               }
-
-               s_current_line_style = -1;
-               s_current_left_style = -1;
-               s_current_right_style = -1;
-               s_shape_has_fill = false;
-               s_shape_has_line = false;
-       }
-
-
-       static int      compare_segment_y(const void* a, const void* b)
-       // For sorting segments by m_begin.y, and then by height.
-       {
-               const fill_segment*     A = (const fill_segment*) a;
-               const fill_segment*     B = (const fill_segment*) b;
-
-               const float     ay0 = A->m_begin.y;
-               const float     by0 = B->m_begin.y;
-
-               if (ay0 < by0)
-               {
-                       return -1;
-               }
-               else if (ay0 == by0)
-               {
-                       const float     ah = A->get_height();
-                       const float     bh = B->get_height();
-
-                       if (ah < bh)
-                       {
-                               return -1;
-                       }
-                       else if (ah == bh)
-                       {
-                               return 0;
-                       }
-                       else
-                       {
-                               return 1;
-                       }
-               }
-               else
-               {
-                       return 1;
-               }
-       }
-
-
-       static int      compare_segment_x(const void* a, const void* b)
-       // For sorting segments by m_begin.x, and then by m_end.y.
-       {
-               const fill_segment*     A = (const fill_segment*) a;
-               const fill_segment*     B = (const fill_segment*) b;
-
-               const float     ax0 = A->m_begin.x;
-               const float     bx0 = B->m_begin.x;
-
-               if (ax0 < bx0)
-               {
-                       return -1;
-               }
-               else if (ax0 == bx0)
-               {
-                       const float     ax1 = A->m_end.y;
-                       const float     bx1 = B->m_end.y;
-
-                       if (ax1 < bx1)
-                       {
-                               return -1;
-                       }
-                       else if (ax1 == bx1)
-                       {
-                               return 0;
-                       }
-                       else
-                       {
-                               return 1;
-                       }
-               }
-               else
-               {
-                       return 1;
-               }
-       }
-
-
-       void    output_current_segments()
-       // Draw our shapes and lines, then clear the segment list.
-       {
-               if (s_shape_has_fill)
-               {
-                       //
-                       // Output the trapezoids making up the filled shape.
-                       //
-
-                       // sort by begining y (smaller first), then by height 
(shorter first)
-                       qsort(
-                               &s_current_segments[0],
-                               s_current_segments.size(),
-                               sizeof(s_current_segments[0]),
-                               compare_segment_y);
-               
-                       unsigned int    base = 0;
-                       while (base < s_current_segments.size())
-                       {
-                               float           ytop = 
s_current_segments[base].m_begin.y;
-                               unsigned int    next_base = base + 1;
-                               for (;;)
-                               {
-                                       if (next_base == 
s_current_segments.size()
-                                           || 
s_current_segments[next_base].m_begin.y > ytop)
-                                       {
-                                               break;
-                                       }
-                                       next_base++;
-                               }
-
-                               // sort this first part again by y
-                               qsort(
-                                       &s_current_segments[base],
-                                       next_base - base,
-                                       sizeof(s_current_segments[0]),
-                                       compare_segment_y);
-
-                               // s_current_segments[base] through 
s_current_segments[next_base - 1] is all the segs that start at ytop
-                               if (next_base >= s_current_segments.size()
-                                   || s_current_segments[base].m_end.y <= 
s_current_segments[next_base].m_begin.y)
-                               {
-                                       // No segments start between ytop and
-                                       // [base].m_end.y, so we can peel
-                                       // off that whole interval and render
-                                       // it right away.
-                                       float   ybottom = 
s_current_segments[base].m_end.y;
-                                       peel_off_and_emit(base, next_base, 
ytop, ybottom);
-
-                                       while (base < s_current_segments.size()
-                                              && 
s_current_segments[base].m_end.y <= ybottom)
-                                       {
-                                               base++;
-                                       }
-                               }
-                               else
-                               {
-                                       float   ybottom = 
s_current_segments[next_base].m_begin.y;
-                                       assert(ybottom > ytop);
-                                       peel_off_and_emit(base, next_base, 
ytop, ybottom);
-
-                                       // don't update base; it's still active.
-                               }
-                       }
-               }
-               
-               s_current_segments.clear();
-       }
-
-
-       void    peel_off_and_emit(int i0, int i1, float y0, float y1)
-       // Clip the interval [y0, y1] off of the segments from
-       // s_current_segments[i0 through (i1-1)] and emit the clipped
-       // trapezoids.  Modifies the values in s_current_segments.
-       {
-               assert(i0 < i1);
-
-               if (y0 == y1)
-               {
-                       // Don't bother doing any work...
-                       return;
-               }
-
-               // Peel off first.
-               std::vector<fill_segment>       slab;   // @@ make this use 
static storage
-               for (int i = i0; i < i1; i++)
-               {
-                       fill_segment*   f = &s_current_segments[i];
-                       assert(f->m_begin.y == y0);
-                       assert(f->m_end.y >= y1);
-
-                       float   dy = f->m_end.y - f->m_begin.y;
-                       float   t = 1.0f;
-                       if (dy > 0)
-                       {
-                               t = (y1 - f->m_begin.y) / dy;
-                       }
-                       point   intersection;
-                       intersection.y = y1;
-                       intersection.x = f->m_begin.x + (f->m_end.y - 
f->m_begin.x) * t;
-
-                       // Peel off.
-                       slab.push_back(*f);
-                       slab.back().m_end = intersection;
-
-                       // Modify segment.
-                       s_current_segments[i].m_begin = intersection;
-               }
-
-               // Sort by x.
-               qsort(&slab[0], slab.size(), sizeof(slab[0]), 
compare_segment_x);
-
-               // Emit the trapezoids in this slab.
-               if (slab.size() > 0
-                   && slab[0].m_left_style == -1
-                   && slab[0].m_right_style >= 0)
-               {
-                       // Reverse sense of polygon fill!  Right fill style is 
in charge.
-                       for (unsigned int i = 0; i < slab.size() - 1; i++)
-                       {
-                               if (slab[i].m_right_style >= 0)
-                               {
-                                       trapezoid       tr;
-                                       tr.m_y0 = slab[i].m_begin.y;
-                                       tr.m_y1 = slab[i].m_end.y;
-                                       tr.m_lx0 = slab[i].m_begin.x;
-                                       tr.m_lx1 = slab[i].m_end.y;
-                                       tr.m_rx0 = slab[i + 1].m_begin.x;
-                                       tr.m_rx1 = slab[i + 1].m_end.y;
-                                       
s_accepter->accept_trapezoid(slab[i].m_right_style, tr);
-                               }
-                       }
-               }
-               else
-               {
-                       for (unsigned int i = 0; i < slab.size() - 1; i++)
-                       {
-                               if (slab[i].m_left_style >= 0)
-                               {
-                                       trapezoid       tr;
-                                       tr.m_y0 = slab[i].m_begin.y;
-                                       tr.m_y1 = slab[i].m_end.y;
-                                       tr.m_lx0 = slab[i].m_begin.x;
-                                       tr.m_lx1 = slab[i].m_end.y;
-                                       tr.m_rx0 = slab[i + 1].m_begin.x;
-                                       tr.m_rx1 = slab[i + 1].m_end.y;
-                                       
s_accepter->accept_trapezoid(slab[i].m_left_style, tr);
-                               }
-                       }
-               }
-       }
-
-
-       void    end_shape()
-       {
-               output_current_segments();
-
-               s_accepter = NULL;
-
-               s_current_path.clear();
-       }
-
-
-       void    begin_path(int style_left, int style_right, int line_style, 
float ax, float ay)
-       // This call begins recording a sequence of segments, which
-       // all share the same fill & line styles.  Add segments to the
-       // shape using add_curve_segment() or add_line_segment(), and
-       // call end_path() when you're done with this sequence.
-       //
-       // Pass in -1 for styles that you want to disable.  Otherwise pass in
-       // the integral ID of the style for filling, to the left or right.
-       {
-               s_current_left_style = style_left;
-               s_current_right_style = style_right;
-               s_current_line_style = line_style;
-
-               s_last_point.x = ax;
-               s_last_point.y = ay;
-
-               assert(s_current_path.size() == 0);
-               s_current_path.resize(0);
-
-               s_current_path.push_back(s_last_point);
-
-               if (style_left != -1 || style_right != -1)
-               {
-                       s_shape_has_fill = true;
-               }
-
-               if (line_style != -1)
-               {
-                       s_shape_has_line = true;
-               }
-       }
-
-
-       void    add_line_segment(float ax, float ay)
-       // Add a line running from the previous anchor point to the
-       // given new anchor point.
-       {
-               point   p(ax, ay);
-
-               // s_current_segments is used for filling shapes.
-               s_current_segments.push_back(
-                       fill_segment(
-                               s_last_point,
-                               p,
-                               s_current_left_style,
-                               s_current_right_style,
-                               s_current_line_style));
-
-               s_last_point = p;
-
-               s_current_path.push_back(p);
-       }
-
-
-       static void     curve(float p0x, float p0y, float p1x, float p1y, float 
p2x, float p2y)
-       // Recursive routine to generate bezier curve within tolerance.
-       {
-#ifndef NDEBUG
-               static int      recursion_count = 0;
-               recursion_count++;
-               if (recursion_count > 500)
-               {
-                       abort();        // probably a bug!
-               }
-#endif // not NDEBUG
-
-               // @@ use class point in here?
-
-               // Midpoint on line between two endpoints.
-               float   midx = (p0x + p2x) * 0.5f;
-               float   midy = (p0y + p2y) * 0.5f;
-
-               // Midpoint on the curve.
-               float   qx = (midx + p1x) * 0.5f;
-               float   qy = (midy + p1y) * 0.5f;
-
-               float   dist = std::abs(midx - qx) + std::abs(midy - qy);
-
-               if (dist < s_tolerance)
-               {
-                       // Emit edge.
-//                     add_line_segment(qx, qy);
-                       add_line_segment(p2x, p2y);
-               }
-               else
-               {
-                       // Error is too large; subdivide.
-                       curve(p0x, p0y, (p0x + p1x) * 0.5f, (p0y + p1y) * 0.5f, 
qx, qy);
-                       curve(qx, qy, (p1x + p2x) * 0.5f, (p1y + p2y) * 0.5f, 
p2x, p2y);
-               }
-
-#ifndef NDEBUG
-               recursion_count--;
-#endif // not NDEBUG
-       }
-
-       
-       void    add_curve_segment(float cx, float cy, float ax, float ay)
-       // Add a curve segment to the shape.  The curve segment is a
-       // quadratic bezier, running from the previous anchor point to
-       // the given new anchor point (ax, ay), with (cx, cy) acting
-       // as the control point in between.
-       {
-               // Subdivide, and add line segments...
-               curve(s_last_point.x, s_last_point.y, cx, cy, ax, ay);
-       }
-
-
-       void    end_path()
-       // Mark the end of a set of edges that all use the same styles.
-       {
-               if (s_current_line_style >= 0 && s_current_path.size() > 1)
-               {
-                       //
-                       // Emit our line.
-                       //
-                       s_accepter->accept_line_strip(s_current_line_style, 
&s_current_path[0], s_current_path.size());
-               }
-
-               s_current_path.resize(0);
-       }
-
-
-}      // end namespace tesselate
-}      // end namespace gnash
-
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
-// indent-tabs-mode: t
-// End:

Index: server/tesselate.h
===================================================================
RCS file: server/tesselate.h
diff -N server/tesselate.h
--- server/tesselate.h  12 Nov 2007 08:39:27 -0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,75 +0,0 @@
-// tesselate.h -- Thatcher Ulrich <address@hidden> 2003
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
-
-// 2D shape tesselator.  Actually a "trapezoidizer".  Takes line/curve
-// segments with a style index, and outputs trapezoids.
-
-
-#ifndef GNASH_TESSELATE_H
-#define GNASH_TESSELATE_H
-
-
-#include "gnash.h"
-#include "types.h"
-#include "Point2d.h" // for point
-
-
-namespace gnash {
-namespace tesselate {
-
-struct trapezoid
-{
-       float   m_y0, m_y1;
-       float   m_lx0, m_lx1, m_rx0, m_rx1;
-};
-
-// Interface for receiving the results of
-// trapezoidation.
-class trapezoid_accepter
-{
-public:
-       virtual ~trapezoid_accepter();
-       virtual void    accept_trapezoid(int style, const trapezoid& tr) = 0;
-       virtual void    accept_line_strip(int style, const point coords[], int 
coord_count) = 0;
-};
-
-// A shape has one or more paths.  The paths in a
-// shape are tesselated together using a typical
-// polygon odd-even rule.
-//
-// The error tolerance tells the tesselator how much
-// geometric error is allowed along curve edges.
-void   begin_shape(trapezoid_accepter* accepter, float curve_error_tolerance);
-void   end_shape();
-
-// A path is enclosed within a shape.  If fill styles
-// are active, a path should be a closed shape
-// (i.e. the last point should match the first point).
-// Set your styles before rendering the path; all
-// segments in a path must have the same styles.
-void   begin_path(int style_left, int style_right, int line_style, float ax, 
float ay);
-void   add_line_segment(float ax, float ay);
-void   add_curve_segment(float cx, float cy, float ax, float ay);
-void   end_path();
-
-class tesselating_shape {
-public:
-       virtual ~tesselating_shape() {}
-       virtual void tesselate(float error_tolerance, 
-                              trapezoid_accepter *accepter) const = 0;
-};
-
-} // end namespace tesselate
-}// end namespace gnash
-
-
-#endif // GNASH_TESSELATE_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
-// indent-tabs-mode: t
-// End:




reply via email to

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