gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog backend/render_handler_agg.cpp ...
Date: Sat, 10 Nov 2007 14:39:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/11/10 14:39:52

Modified files:
        .              : ChangeLog 
        backend        : render_handler_agg.cpp render_handler_cairo.cpp 
                         render_handler_ogl.cpp 
        server         : shape.cpp shape.h 
        server/parser  : morph2_character_def.cpp 
                         shape_character_def.cpp 

Log message:
        Changed path and edge classes to store a point (Point2d<float>) for 
anchor and control points.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4824&r2=1.4825
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_agg.cpp?cvsroot=gnash&r1=1.116&r2=1.117
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_cairo.cpp?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.cpp?cvsroot=gnash&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/gnash/server/shape.h?cvsroot=gnash&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/morph2_character_def.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.47&r2=1.48

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4824
retrieving revision 1.4825
diff -u -b -r1.4824 -r1.4825
--- ChangeLog   10 Nov 2007 12:00:21 -0000      1.4824
+++ ChangeLog   10 Nov 2007 14:39:51 -0000      1.4825
@@ -1,5 +1,14 @@
 2007-11-10 Sandro Santilli <address@hidden>
 
+       * backend/render_handler_agg.cpp, backend/render_handler_cairo.cpp,
+         backend/render_handler_ogl.cpp, server/shape.cpp, server/shape.h,
+         server/parser/morph2_character_def.cpp,
+         server/parser/shape_character_def.cpp:
+         Changed path and edge classes to store a point (Point2d<float>)
+         for anchor and control points.
+
+2007-11-10 Sandro Santilli <address@hidden>
+
        * configure.ac: properly quote test arguments.
 
 2007-11-10 Sandro Santilli <address@hidden>

Index: backend/render_handler_agg.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -b -r1.116 -r1.117
--- backend/render_handler_agg.cpp      10 Nov 2007 11:51:41 -0000      1.116
+++ backend/render_handler_agg.cpp      10 Nov 2007 14:39:51 -0000      1.117
@@ -17,7 +17,7 @@
 
  
 
-/* $Id: render_handler_agg.cpp,v 1.116 2007/11/10 11:51:41 strk Exp $ */
+/* $Id: render_handler_agg.cpp,v 1.117 2007/11/10 14:39:51 strk Exp $ */
 
 // Original version by Udo Giacomozzi and Hannes Mayr, 
 // INDUNET GmbH (www.indunet.it)
@@ -1143,28 +1143,28 @@
     for (pno=0; pno<pcount; pno++) {
     
       path &the_path = paths_out[pno];     
-      point oldpnt(the_path.m_ax, the_path.m_ay);
+      point oldpnt(the_path.ap.x, the_path.ap.y);
       point newpnt;
       mat.transform(&newpnt, oldpnt);
-      the_path.m_ax = newpnt.x;    
-      the_path.m_ay = newpnt.y;
+      the_path.ap.x = newpnt.x;    
+      the_path.ap.y = newpnt.y;
       
       ecount = the_path.m_edges.size();
       for (eno=0; eno<ecount; eno++) {
       
         edge &the_edge = the_path.m_edges[eno];
         
-        oldpnt.x = the_edge.m_ax;
-        oldpnt.y = the_edge.m_ay;
+        oldpnt.x = the_edge.ap.x;
+        oldpnt.y = the_edge.ap.y;
         mat.transform(&newpnt, oldpnt);
-        the_edge.m_ax = newpnt.x;
-        the_edge.m_ay = newpnt.y;
+        the_edge.ap.x = newpnt.x;
+        the_edge.ap.y = newpnt.y;
         
-        oldpnt.x = the_edge.m_cx;
-        oldpnt.y = the_edge.m_cy;
+        oldpnt.x = the_edge.cp.x;
+        oldpnt.y = the_edge.cp.y;
         mat.transform(&newpnt, oldpnt);
-        the_edge.m_cx = newpnt.x;
-        the_edge.m_cy = newpnt.y;
+        the_edge.cp.x = newpnt.x;
+        the_edge.cp.y = newpnt.y;
       
       }          
       
@@ -1213,8 +1213,8 @@
       const gnash::path& this_path = paths[pno];
       agg::path_storage& new_path = dest[pno];
       
-      new_path.move_to(this_path.m_ax + subpixel_offset, 
-        this_path.m_ay + subpixel_offset);
+      new_path.move_to(this_path.ap.x + subpixel_offset, 
+        this_path.ap.y + subpixel_offset);
       
       size_t ecount = this_path.m_edges.size();
       
@@ -1223,13 +1223,13 @@
         const edge& this_edge = this_path.m_edges[eno];
         
         if (this_edge.is_straight())
-          new_path.line_to(this_edge.m_ax + subpixel_offset, 
-            this_edge.m_ay + subpixel_offset);
+          new_path.line_to(this_edge.ap.x + subpixel_offset, 
+            this_edge.ap.y + subpixel_offset);
         else
-          new_path.curve3(this_edge.m_cx + subpixel_offset, 
-            this_edge.m_cy + subpixel_offset,
-            this_edge.m_ax + subpixel_offset, 
-            this_edge.m_ay + subpixel_offset);       
+          new_path.curve3(this_edge.cp.x + subpixel_offset, 
+            this_edge.cp.y + subpixel_offset,
+            this_edge.ap.x + subpixel_offset, 
+            this_edge.ap.y + subpixel_offset);       
         
       }    
     }    
@@ -1265,8 +1265,8 @@
       const gnash::path& this_path = paths[pno];
       agg::path_storage& new_path = dest[pno];
       
-      float prev_ax = this_path.m_ax;
-      float prev_ay = this_path.m_ay;  
+      float prev_ax = this_path.ap.x;
+      float prev_ay = this_path.ap.y;  
       bool prev_align_x = true;
       bool prev_align_y = true;
       
@@ -1276,8 +1276,8 @@
         
         const edge& this_edge = this_path.m_edges[eno];
         
-        float this_ax = this_edge.m_ax;  
-        float this_ay = this_edge.m_ay;  
+        float this_ax = this_edge.ap.x;  
+        float this_ay = this_edge.ap.y;  
         
         if (this_edge.is_straight()) {
         
@@ -1346,8 +1346,8 @@
             new_path.move_to(prev_ax, prev_ay);
         
           // never align curves!
-          new_path.curve3(this_edge.m_cx + subpixel_offset, 
-            this_edge.m_cy + subpixel_offset,
+          new_path.curve3(this_edge.cp.x + subpixel_offset, 
+            this_edge.cp.y + subpixel_offset,
             this_ax + subpixel_offset, 
             this_ay + subpixel_offset);
             
@@ -1719,7 +1719,7 @@
                   this_path.m_fill1==0 ? -1 : 0);
                   
       // starting point of path
-      path.move_to(this_path.m_ax, this_path.m_ay);
+      path.move_to(this_path.ap.x, this_path.ap.y);
     
       unsigned int ecount = this_path.m_edges.size();
       for (unsigned int eno=0; eno<ecount; eno++) {
@@ -1727,10 +1727,10 @@
         const edge &this_edge = this_path.m_edges[eno];
 
         if (this_edge.is_straight())
-          path.line_to(this_edge.m_ax, this_edge.m_ay);
+          path.line_to(this_edge.ap.x, this_edge.ap.y);
         else
-          path.curve3(this_edge.m_cx, this_edge.m_cy,
-                      this_edge.m_ax, this_edge.m_ay);
+          path.curve3(this_edge.cp.x, this_edge.cp.y,
+                      this_edge.ap.x, this_edge.ap.y);
         
       } // for edge
       

Index: backend/render_handler_cairo.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_cairo.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- backend/render_handler_cairo.cpp    10 Nov 2007 11:51:42 -0000      1.30
+++ backend/render_handler_cairo.cpp    10 Nov 2007 14:39:52 -0000      1.31
@@ -425,17 +425,17 @@
 
   void add_path(cairo_t* cr, const path& cur_path)
   {  
-    cairo_move_to(cr, cur_path.m_ax, cur_path.m_ay);
+    cairo_move_to(cr, cur_path.ap.x, cur_path.ap.y);
     
-    float prev_x = cur_path.m_ax,
-          prev_y = cur_path.m_ay;
+    float prev_x = cur_path.ap.x,
+          prev_y = cur_path.ap.y;
     
     for (std::vector<edge>::const_iterator it = cur_path.m_edges.begin(),
          end = cur_path.m_edges.end(); it != end; ++it) {
       const edge& cur_edge = *it;
       
       if (cur_edge.is_straight()) {
-        cairo_line_to(cr, cur_edge.m_ax, cur_edge.m_ay);
+        cairo_line_to(cr, cur_edge.ap.x, cur_edge.ap.y);
       } else {
       
         // Cairo expects a cubic Bezier curve, while Flash gives us a
@@ -444,21 +444,21 @@
         const float two_thirds = 2.0/3.0;
         const float one_third = 1 - two_thirds;
         
-        float x1 = prev_x + two_thirds * (cur_edge.m_cx - prev_x);
-        float y1 = prev_y + two_thirds * (cur_edge.m_cy - prev_y);
+        float x1 = prev_x + two_thirds * (cur_edge.cp.x - prev_x);
+        float y1 = prev_y + two_thirds * (cur_edge.cp.y - prev_y);
         
-        float x2 = cur_edge.m_cx + one_third * (cur_edge.m_ax - cur_edge.m_cx);
-        float y2 = cur_edge.m_cy + one_third * (cur_edge.m_ay - cur_edge.m_cy);
+        float x2 = cur_edge.cp.x + one_third * (cur_edge.ap.x - cur_edge.cp.x);
+        float y2 = cur_edge.cp.y + one_third * (cur_edge.ap.y - cur_edge.cp.y);
         
-        const float& x3 = cur_edge.m_ax;
-        const float& y3 = cur_edge.m_ay;
+        const float& x3 = cur_edge.ap.x;
+        const float& y3 = cur_edge.ap.y;
     
     
         cairo_curve_to(cr, x1, y1, x2, y2, x3, y3);
       }
       
-      prev_x = cur_edge.m_ax;
-      prev_y = cur_edge.m_ay;
+      prev_x = cur_edge.ap.x;
+      prev_y = cur_edge.ap.y;
       
     }
   
@@ -749,28 +749,28 @@
     for (pno=0; pno<pcount; pno++) {
     
       path &the_path = paths_out[pno];     
-      point oldpnt(the_path.m_ax, the_path.m_ay);
+      point oldpnt(the_path.ap.x, the_path.ap.y);
       point newpnt;
       mat.transform(&newpnt, oldpnt);
-      the_path.m_ax = newpnt.x;    
-      the_path.m_ay = newpnt.y;
+      the_path.ap.x = newpnt.x;    
+      the_path.ap.y = newpnt.y;
       
       ecount = the_path.m_edges.size();
       for (eno=0; eno<ecount; eno++) {
       
         edge &the_edge = the_path.m_edges[eno];
         
-        oldpnt.x = the_edge.m_ax;
-        oldpnt.y = the_edge.m_ay;
+        oldpnt.x = the_edge.ap.x;
+        oldpnt.y = the_edge.ap.y;
         mat.transform(&newpnt, oldpnt);
-        the_edge.m_ax = newpnt.x;
-        the_edge.m_ay = newpnt.y;
+        the_edge.ap.x = newpnt.x;
+        the_edge.ap.y = newpnt.y;
         
-        oldpnt.x = the_edge.m_cx;
-        oldpnt.y = the_edge.m_cy;
+        oldpnt.x = the_edge.cp.x;
+        oldpnt.y = the_edge.cp.y;
         mat.transform(&newpnt, oldpnt);
-        the_edge.m_cx = newpnt.x;
-        the_edge.m_cy = newpnt.y;
+        the_edge.cp.x = newpnt.x;
+        the_edge.cp.y = newpnt.y;
       
       }          
       

Index: backend/render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- backend/render_handler_ogl.cpp      10 Nov 2007 11:51:42 -0000      1.88
+++ backend/render_handler_ogl.cpp      10 Nov 2007 14:39:52 -0000      1.89
@@ -259,12 +259,12 @@
         it != end; ++it) {
       const edge& the_edge = *it;
       
-      point target(the_edge.m_ax, the_edge.m_ay);
+      point target(the_edge.ap.x, the_edge.ap.y);
 
       if (the_edge.is_straight()) {
         shape_points.push_back(oglVertex(target));
       } else {
-        point control(the_edge.m_cx, the_edge.m_cy);
+        point control(the_edge.cp.x, the_edge.cp.y);
         
         trace_curve(anchor, control, target, shape_points);
       }
@@ -846,9 +846,9 @@
   void print_path(const path& path)
   {
     std::cout << "Origin: ("
-              << path.m_ax
+              << path.ap.x
               << ", "
-              << path.m_ay
+              << path.ap.y
               << ") fill0: "
               << path.m_fill0
               << " fill1: "
@@ -860,15 +860,15 @@
               << " number of edges: "
               << path.m_edges.size()
               << " edge endpoint: ("
-              << path.m_edges.back().m_ax
+              << path.m_edges.back().ap.x
               << ", "
-              << path.m_edges.back().m_ay
+              << path.m_edges.back().ap.y
               << " ) points:";
 
     for (std::vector<edge>::const_iterator it = path.m_edges.begin(), end = 
path.m_edges.end();
          it != end; ++it) {
       const edge& cur_edge = *it;
-      std::cout << "( " << cur_edge.m_ax << ", " << cur_edge.m_ay << ") ";
+      std::cout << "( " << cur_edge.ap.x << ", " << cur_edge.ap.y << ") ";
     }
     std::cout << std::endl;             
   }
@@ -879,35 +879,35 @@
   {
     const edge& cur_end = cur_path.m_edges.back();    
         
-    float prev_cx = cur_end.m_cx;
-    float prev_cy = cur_end.m_cy;        
+    float prev_cx = cur_end.cp.x;
+    float prev_cy = cur_end.cp.y;        
                 
-    path newpath(cur_end.m_ax, cur_end.m_ay, cur_path.m_fill1, 
cur_path.m_fill0, cur_path.m_line);
+    path newpath(cur_end.ap.x, cur_end.ap.y, cur_path.m_fill1, 
cur_path.m_fill0, cur_path.m_line);
     
-    float prev_ax = cur_end.m_ax;
-    float prev_ay = cur_end.m_ay; 
+    float prev_ax = cur_end.ap.x;
+    float prev_ay = cur_end.ap.y; 
 
     for (std::vector<edge>::const_reverse_iterator it = 
cur_path.m_edges.rbegin()+1, end = cur_path.m_edges.rend();
          it != end; ++it) {
       const edge& cur_edge = *it;
 
       if (prev_ax == prev_cx && prev_ay == prev_cy) {
-        prev_cx = cur_edge.m_ax;
-        prev_cy = cur_edge.m_ay;      
+        prev_cx = cur_edge.ap.x;
+        prev_cy = cur_edge.ap.y;      
       }
 
-      edge newedge(prev_cx, prev_cy, cur_edge.m_ax, cur_edge.m_ay); 
+      edge newedge(prev_cx, prev_cy, cur_edge.ap.x, cur_edge.ap.y); 
           
       newpath.m_edges.push_back(newedge);
           
-      prev_cx = cur_edge.m_cx;
-      prev_cy = cur_edge.m_cy;
-      prev_ax = cur_edge.m_ax;
-      prev_ay = cur_edge.m_ay;
+      prev_cx = cur_edge.cp.x;
+      prev_cy = cur_edge.cp.y;
+      prev_ax = cur_edge.ap.x;
+      prev_ay = cur_edge.ap.y;
            
     }
         
-    edge newlastedge(prev_cx, prev_cy, cur_path.m_ax, cur_path.m_ay);    
+    edge newlastedge(prev_cx, prev_cy, cur_path.ap.x, cur_path.ap.y);    
     newpath.m_edges.push_back(newlastedge);
         
     return newpath;
@@ -917,11 +917,11 @@
                                    std::list<const path*> path_refs)
   {
         
-    float target_x = to_connect.m_edges.back().m_ax;
-    float target_y = to_connect.m_edges.back().m_ay;
+    float target_x = to_connect.m_edges.back().ap.x;
+    float target_y = to_connect.m_edges.back().ap.y;
 
-    if (target_x == to_connect.m_ax &&
-        target_y == to_connect.m_ay) {
+    if (target_x == to_connect.ap.x &&
+        target_y == to_connect.ap.y) {
       return NULL;
     }
   
@@ -936,7 +936,7 @@
       }
       
             
-      if (cur_path->m_ax == target_x && cur_path->m_ay == target_y) {
+      if (cur_path->ap.x == target_x && cur_path->ap.y == target_y) {
  
         if (cur_path->m_fill1 != to_connect.m_fill1) {
           continue;
@@ -1133,8 +1133,8 @@
         continue;
       }
         
-      pathpoints[&cur_path] = interpolate(cur_path.m_edges, cur_path.m_ax,
-                                                            cur_path.m_ay);
+      pathpoints[&cur_path] = interpolate(cur_path.m_edges, cur_path.ap.x,
+                                                            cur_path.ap.y);
 
     }
     

Index: server/shape.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/shape.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- server/shape.cpp    10 Nov 2007 11:51:43 -0000      1.45
+++ server/shape.cpp    10 Nov 2007 14:39:52 -0000      1.46
@@ -42,30 +42,17 @@
 // edge
 //
 
-edge::edge()
-    :
-    m_cx(0), m_cy(0),
-    m_ax(0), m_ay(0)
-{}
-
-edge::edge(float cx, float cy, float ax, float ay)
-    :
-    m_cx(cx), m_cy(cy),
-    m_ax(ax), m_ay(ay)
-{
-}
-
 void   edge::tesselate_curve() const
     // Send this segment to the tesselator.
 {
        if ( is_straight() )
        {
                //log_msg("is straight!!");
-               tesselate::add_line_segment(m_ax, m_ay);
+               tesselate::add_line_segment(ap.x, ap.y);
        }
        else
        {
-               tesselate::add_curve_segment(m_cx, m_cy, m_ax, m_ay);
+               tesselate::add_curve_segment(cp.x, cp.y, ap.x, ap.y);
        }
 }
 
@@ -112,12 +99,6 @@
 }
 
 
-DSOEXPORT bool edge::is_straight() const
-{
-    return m_cx == m_ax && m_cy == m_ay;
-}
-
-
 //
 // path
 //
@@ -141,8 +122,8 @@
 void   path::reset(float ax, float ay, int fill0, int fill1, int line)
     // Reset all our members to the given values, and clear our edge list.
 {
-    m_ax = ax;
-    m_ay = ay;
+    ap.x = ax;
+    ap.y = ay;
     m_fill0 = fill0;
     m_fill1 = fill1;
     m_line = line;
@@ -174,21 +155,21 @@
                // bounds using the drawing API.                        
                float radius = thickness;
 
-               r.expand_to_circle(m_ax, m_ay, radius);
+               r.expand_to_circle(ap.x, ap.y, radius);
                for (unsigned int j = 0; j<nedges; j++)
                {
-                       r.expand_to_circle(m_edges[j].m_ax, m_edges[j].m_ay, 
radius);
-                       r.expand_to_circle(m_edges[j].m_cx, m_edges[j].m_cy, 
radius);
+                       r.expand_to_circle(m_edges[j].ap.x, m_edges[j].ap.y, 
radius);
+                       r.expand_to_circle(m_edges[j].cp.x, m_edges[j].cp.y, 
radius);
                }
 
                return;
        }
 
-       r.expand_to_point(m_ax, m_ay);
+       r.expand_to_point(ap.x, ap.y);
        for (unsigned int j = 0; j<nedges; j++)
        {
-               r.expand_to_point(m_edges[j].m_ax, p.m_edges[j].m_ay);
-                r.expand_to_point(m_edges[j].m_cx, p.m_edges[j].m_cy);
+               r.expand_to_point(m_edges[j].ap.x, p.m_edges[j].ap.y);
+                r.expand_to_point(m_edges[j].cp.x, p.m_edges[j].cp.y);
        }
 }
 
@@ -202,14 +183,14 @@
     // of crossings means the point is outside; an odd
     // number means it's inside.
 
-    float x0 = m_ax;
-    float y0 = m_ay;
+    float x0 = ap.x;
+    float y0 = ap.y;
 
     for (int i = 0, n = m_edges.size(); i < n; i++) {
        const edge& e = m_edges[i];
        
-       float x1 = e.m_ax;
-       float y1 = e.m_ay;
+       float x1 = e.ap.x;
+       float y1 = e.ap.y;
        
        if (e.is_straight()) {
            // Straight-line case.
@@ -246,8 +227,8 @@
            }
        } else {
            // Curve case.
-           float cx = e.m_cx;
-           float cy = e.m_cy;
+           float cx = e.cp.x;
+           float cy = e.cp.y;
 
            // Find whether & where the curve crosses y
            if ((y0 < y && y1 < y && cy < y)
@@ -329,7 +310,7 @@
        m_fill0 - 1,
        m_fill1 - 1,
        m_line - 1,
-       m_ax, m_ay);
+       ap.x, ap.y);
     for (unsigned int i = 0; i < m_edges.size(); i++) {
        m_edges[i].tesselate_curve();
     }
@@ -356,9 +337,9 @@
 
        // Close it with a straight edge if needed
        const edge& lastedge = m_edges.back();
-       if ( lastedge.m_ax != m_ax || lastedge.m_ay != m_ay )
+       if ( lastedge.ap.x != ap.x || lastedge.ap.y != ap.y )
        {
-               edge newedge(m_ax, m_ay, m_ax, m_ay);
+               edge newedge(ap.x, ap.y, ap.x, ap.y);
                m_edges.push_back(newedge);
        }
 }
@@ -370,11 +351,11 @@
 
        if ( ! nedges ) return false;
 
-       point px(m_ax, m_ay);
+       point px(ap.x, ap.y);
        for (size_t i=0; i<nedges; ++i)
        {
                const edge& e = m_edges[i];
-               point np(e.m_ax, e.m_ay);
+               point np(e.ap.x, e.ap.y);
 
                if ( e.is_straight() )
                {

Index: server/shape.h
===================================================================
RCS file: /sources/gnash/gnash/server/shape.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- server/shape.h      10 Nov 2007 11:51:43 -0000      1.30
+++ server/shape.h      10 Nov 2007 14:39:52 -0000      1.31
@@ -5,7 +5,7 @@
 
 // Quadratic bezier outline shapes, the basis for most SWF rendering.
 
-/* $Id: shape.h,v 1.30 2007/11/10 11:51:43 strk Exp $ */
+/* $Id: shape.h,v 1.31 2007/11/10 14:39:52 strk Exp $ */
 
 #ifndef GNASH_SHAPE_H
 #define GNASH_SHAPE_H
@@ -30,10 +30,35 @@
        class edge
        {
        public:
-               edge();
-               edge(float cx, float cy, float ax, float ay);
+               edge()
+                       :
+                       cp(),
+                       ap()
+               {
+               }
+
+               edge(float cx, float cy, float ax, float ay)
+                       :
+                       cp(cx, cy),
+                       ap(ax, ay)
+               {
+               }
+
+               edge(point ncp, point nap)
+                       :
+                       cp(ncp),
+                       ap(nap)
+               {
+               }
+
                void    tesselate_curve() const;
-               bool    is_straight() const;
+
+               bool isStraight() const
+               {
+                       return cp == ap;
+               }
+
+               bool is_straight() const { return isStraight(); }
 
                /// Return squared distance between point pt and segment A-B
                static float squareDistancePtSeg(const point& pt, const point& 
A, const point& B);
@@ -43,8 +68,8 @@
                
        //private:
                // *quadratic* bezier: point = p0 * t^2 + p1 * 2t(1-t) + p2 * 
(1-t)^2
-               float   m_cx, m_cy;             // "control" point
-               float   m_ax, m_ay;             // "anchor" point
+               point cp; // "control" point
+               point ap; // "anchor" point
        };
 
 
@@ -297,7 +322,7 @@
                unsigned m_line;
 
                /// Path/shape origin
-               float   m_ax, m_ay;
+               point ap; 
 
                /// Edges forming the path
                std::vector<edge> m_edges;

Index: server/parser/morph2_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/morph2_character_def.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/parser/morph2_character_def.cpp      26 Sep 2007 19:46:29 -0000      
1.17
+++ server/parser/morph2_character_def.cpp      10 Nov 2007 14:39:52 -0000      
1.18
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: morph2_character_def.cpp,v 1.17 2007/09/26 19:46:29 strk Exp $ */
+/* $Id: morph2_character_def.cpp,v 1.18 2007/11/10 14:39:52 strk Exp $ */
 
 // Based on the public domain morph2.cpp of:
 // Thatcher Ulrich <address@hidden>, Mike Shaver <address@hidden> 2003,
@@ -159,8 +159,8 @@
                        const path& p1 = i < paths1.size() ? paths1[i] : 
empty_path;
                        const path& p2 = n < paths2.size() ? paths2[n] : 
empty_path;
 
-                       float new_ax = flerp(p1.m_ax, p2.m_ax, ratio);
-                       float new_ay = flerp(p1.m_ay, p2.m_ay, ratio);
+                       float new_ax = flerp(p1.ap.x, p2.ap.x, ratio);
+                       float new_ay = flerp(p1.ap.y, p2.ap.y, ratio);
 
                        p.reset ( new_ax, new_ay, p1.getLeftFill(), 
p2.getRightFill(), p1.getLineStyle() );
 
@@ -174,10 +174,10 @@
                                const edge& e1 = j < p1.size() ? p1[j] : 
empty_edge;
                                const edge& e2 = k < p2.size() ? p2[k] : 
empty_edge;
 
-                               e.m_cx = flerp(e1.m_cx, e2.m_cx, ratio);
-                               e.m_cy = flerp(e1.m_cy, e2.m_cy, ratio);
-                               e.m_ax = flerp(e1.m_ax, e2.m_ax, ratio);
-                               e.m_ay = flerp(e1.m_ay, e2.m_ay, ratio);
+                               e.cp.x = flerp(e1.cp.x, e2.cp.x, ratio);
+                               e.cp.y = flerp(e1.cp.y, e2.cp.y, ratio);
+                               e.ap.x = flerp(e1.ap.x, e2.ap.x, ratio);
+                               e.ap.y = flerp(e1.ap.y, e2.ap.y, ratio);
                                k++;
                                if (p2.size() <= k)
                                {

Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/parser/shape_character_def.cpp       10 Nov 2007 11:51:44 -0000      
1.47
+++ server/parser/shape_character_def.cpp       10 Nov 2007 14:39:52 -0000      
1.48
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: shape_character_def.cpp,v 1.47 2007/11/10 11:51:44 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.48 2007/11/10 14:39:52 strk Exp $ */
 
 // Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden> 
2003
 
@@ -270,8 +270,8 @@
     y = move_y;
 
     // Set the beginning of the path.
-    current_path.m_ax = x;
-    current_path.m_ay = y;
+    current_path.ap.x = x;
+    current_path.ap.y = y;
 
 #if SHAPE_LOG
     IF_VERBOSE_PARSE
@@ -286,8 +286,8 @@
     if (! current_path.is_empty()) {
         m_paths.push_back(current_path);
         current_path.m_edges.resize(0);
-        current_path.m_ax = x;
-        current_path.m_ay = y;
+        current_path.ap.x = x;
+        current_path.ap.y = y;
     }
     unsigned style = in->read_uint(num_fill_bits);
     if (style > 0) {
@@ -329,8 +329,8 @@
     if (! current_path.is_empty()) {
         m_paths.push_back(current_path);
         current_path.m_edges.resize(0);
-        current_path.m_ax = x;
-        current_path.m_ay = y;
+        current_path.ap.x = x;
+        current_path.ap.y = y;
     }
     unsigned style = in->read_uint(num_fill_bits);
     if (style > 0) {
@@ -370,8 +370,8 @@
     if (! current_path.is_empty()) {
         m_paths.push_back(current_path);
         current_path.m_edges.resize(0);
-        current_path.m_ax = x;
-        current_path.m_ay = y;
+        current_path.ap.x = x;
+        current_path.ap.y = y;
     }
     unsigned style = in->read_uint(num_line_bits);
     if (style > 0) {
@@ -624,13 +624,13 @@
 
   glBegin(GL_LINE_STRIP);
 
-  mat.transform(&pt, point(p.m_ax, p.m_ay));
+  mat.transform(&pt, point(p.ap.x, p.ap.y));
   glVertex2f(pt.x, pt.y);
 
   for (unsigned int j = 0; j < p.m_edges.size(); j++) {
-      mat.transform(&pt, point(p.m_edges[j].m_cx, p.m_edges[j].m_cy));
+      mat.transform(&pt, point(p.m_edges[j].cp.x, p.m_edges[j].cp.y));
       glVertex2f(pt.x, pt.y);
-      mat.transform(&pt, point(p.m_edges[j].m_ax, p.m_edges[j].m_ay));
+      mat.transform(&pt, point(p.m_edges[j].ap.x, p.m_edges[j].ap.y));
       glVertex2f(pt.x, pt.y);
   }
 
@@ -641,8 +641,8 @@
   glBegin(GL_LINES);
   {for (unsigned int j = 0; j < p.m_edges.size(); j++)
       {
-    mat.transform(&p0, point(p.m_edges[j].m_cx, p.m_edges[j].m_cy));
-    mat.transform(&p1, point(p.m_edges[j].m_ax, p.m_edges[j].m_ay));
+    mat.transform(&p0, point(p.m_edges[j].cp.x, p.m_edges[j].cp.y));
+    mat.transform(&p1, point(p.m_edges[j].ap.x, p.m_edges[j].ap.y));
     dir = point(p1.x - p0.x, p1.y - p0.y);
     point_normalize(&dir);
     right = point(-dir.y, dir.x); // perpendicular
@@ -845,8 +845,8 @@
     const path& pth = m_paths[pno];
     unsigned nedges = pth.m_edges.size();
 
-    float next_pen_x = pth.m_ax;
-    float next_pen_y = pth.m_ay;
+    float next_pen_x = pth.ap.x;
+    float next_pen_y = pth.ap.y;
     float pen_x, pen_y;
     
     if (pth.m_new_shape) {
@@ -892,14 +892,14 @@
       pen_x = next_pen_x;
       pen_y = next_pen_y;
       
-      next_pen_x = edg.m_ax;   
-      next_pen_y = edg.m_ay;
+      next_pen_x = edg.ap.x;   
+      next_pen_y = edg.ap.y;
       
       /*
       printf("EDGE #%d #%d [ %d %d ] : %.2f / %.2f -> %.2f / %.2f\n", pno, eno,
         pth.m_fill0, pth.m_fill1, 
         pen_x, pen_y, 
-        edg.m_ax, edg.m_ay);
+        edg.ap.x, edg.ap.y);
       */
         
         
@@ -912,18 +912,18 @@
         // ==> straight line case
       
         // ignore horizontal lines
-        if (edg.m_ay == pen_y)   // TODO: better check for small difference? 
+        if (edg.ap.y == pen_y)   // TODO: better check for small difference? 
           continue;          
           
         // does this line cross the Y coordinate?
-        if ( ((pen_y <= y) && (edg.m_ay >= y))
-          || ((pen_y >= y) && (edg.m_ay <= y)) ) {
+        if ( ((pen_y <= y) && (edg.ap.y >= y))
+          || ((pen_y >= y) && (edg.ap.y <= y)) ) {
           
           // calculate X crossing
-          cross1 = pen_x + (edg.m_ax - pen_x) *  
-            (y - pen_y) / (edg.m_ay - pen_y);
+          cross1 = pen_x + (edg.ap.x - pen_x) *  
+            (y - pen_y) / (edg.ap.y - pen_y);
             
-          if (pen_y > edg.m_ay)
+          if (pen_y > edg.ap.y)
             dir1 = -1; // upward
           else
             dir1 = +1; // downward
@@ -941,8 +941,8 @@
       
         // ==> curve case
         
-        crosscount = curve_x_crossings(pen_x, pen_y, edg.m_ax, edg.m_ay,
-          edg.m_cx, edg.m_cy, y, cross1, cross2);
+        crosscount = curve_x_crossings(pen_x, pen_y, edg.ap.x, edg.ap.y,
+          edg.cp.x, edg.cp.y, y, cross1, cross2);
           
         dir1 = pen_y > y ? -1 : +1;
         dir2 = dir1 * (-1);     // second crossing always in opposite dir.




reply via email to

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