incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1184758 [17/17] - in /incubator/ooo/trunk/main: ./ agg/inc/ agg/source/ solenv/config/
Date Sun, 16 Oct 2011 04:13:21 GMT
Modified: incubator/ooo/trunk/main/agg/source/agg_arc.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_arc.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_arc.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_arc.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -65,7 +65,7 @@ namespace agg
     unsigned arc::vertex(double* x, double* y)
     {
         if(is_stop(m_path_cmd)) return path_cmd_stop;
-        if((m_angle < m_end) != m_ccw)
+        if((m_angle < m_end - m_da/4) != m_ccw)
         {
             *x = m_x + cos(m_end) * m_rx;
             *y = m_y + sin(m_end) * m_ry;
@@ -86,7 +86,8 @@ namespace agg
     //------------------------------------------------------------------------
     void arc::normalize(double a1, double a2, bool ccw)
     {
-        m_da = fabs(1.0 / ((m_rx + m_ry) * 0.5 * m_scale));
+        double ra = (fabs(m_rx) + fabs(m_ry)) / 2;
+        m_da = acos(ra / (ra + 0.125 / m_scale)) * 2;
         if(ccw)
         {
             while(a2 < a1) a2 += pi * 2.0;

Modified: incubator/ooo/trunk/main/agg/source/agg_arrowhead.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_arrowhead.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_arrowhead.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_arrowhead.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -42,11 +42,11 @@ namespace agg
 
 
     //------------------------------------------------------------------------
-    void arrowhead::rewind(unsigned id)
+    void arrowhead::rewind(unsigned path_id)
     {
-        m_curr_id = id;
+        m_curr_id = path_id;
         m_curr_coord = 0;
-        if(id == 0)
+        if(path_id == 0)
         {
             if(!m_tail_flag)
             {
@@ -66,12 +66,12 @@ namespace agg
             m_cmd[3] = path_cmd_line_to;
             m_cmd[4] = path_cmd_line_to;
             m_cmd[5] = path_cmd_line_to;
-            m_cmd[7] = (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_ccw;
+            m_cmd[7] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
             m_cmd[6] = path_cmd_stop;
             return;
         }
 
-        if(id == 1)
+        if(path_id == 1)
         {
             if(!m_head_flag)
             {
@@ -87,7 +87,7 @@ namespace agg
             m_cmd[1] = path_cmd_line_to;
             m_cmd[2] = path_cmd_line_to;
             m_cmd[3] = path_cmd_line_to;
-            m_cmd[4] = (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_ccw;
+            m_cmd[4] = path_cmd_end_poly | path_flags_close | path_flags_ccw;
             m_cmd[5] = path_cmd_stop;
             return;
         }

Modified: incubator/ooo/trunk/main/agg/source/agg_bezier_arc.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_bezier_arc.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_bezier_arc.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_bezier_arc.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -26,6 +26,14 @@
 namespace agg
 {
 
+    // This epsilon is used to prevent us from adding degenerate curves 
+    // (converging to a single point).
+    // The value isn't very critical. Function arc_to_bezier() has a limit 
+    // of the sweep_angle. If fabs(sweep_angle) exceeds pi/2 the curve 
+    // becomes inaccurate. But slight exceeding is quite appropriate.
+    //-------------------------------------------------bezier_arc_angle_epsilon
+    const double bezier_arc_angle_epsilon = 0.01;
+
     //------------------------------------------------------------arc_to_bezier
     void arc_to_bezier(double cx, double cy, double rx, double ry, 
                        double start_angle, double sweep_angle,
@@ -69,29 +77,44 @@ namespace agg
         if(sweep_angle >=  2.0 * pi) sweep_angle =  2.0 * pi;
         if(sweep_angle <= -2.0 * pi) sweep_angle = -2.0 * pi;
 
+        if(fabs(sweep_angle) < 1e-10)
+        {
+            m_num_vertices = 4;
+            m_cmd = path_cmd_line_to;
+            m_vertices[0] = x + rx * cos(start_angle);
+            m_vertices[1] = y + ry * sin(start_angle);
+            m_vertices[2] = x + rx * cos(start_angle + sweep_angle);
+            m_vertices[3] = y + ry * sin(start_angle + sweep_angle);
+            return;
+        }
+
         double total_sweep = 0.0;
         double local_sweep = 0.0;
+        double prev_sweep;
         m_num_vertices = 2;
+        m_cmd = path_cmd_curve4;
         bool done = false;
         do
         {
             if(sweep_angle < 0.0)
             {
+                prev_sweep  = total_sweep;
                 local_sweep = -pi * 0.5;
                 total_sweep -= pi * 0.5;
-                if(total_sweep <= sweep_angle)
+                if(total_sweep <= sweep_angle + bezier_arc_angle_epsilon)
                 {
-                    local_sweep = sweep_angle - (total_sweep + pi * 0.5);
+                    local_sweep = sweep_angle - prev_sweep;
                     done = true;
                 }
             }
             else
             {
+                prev_sweep  = total_sweep;
                 local_sweep =  pi * 0.5;
                 total_sweep += pi * 0.5;
-                if(total_sweep >= sweep_angle)
+                if(total_sweep >= sweep_angle - bezier_arc_angle_epsilon)
                 {
-                    local_sweep = sweep_angle - (total_sweep - pi * 0.5);
+                    local_sweep = sweep_angle - prev_sweep;
                     done = true;
                 }
             }
@@ -129,8 +152,6 @@ namespace agg
         double dx2 = (x0 - x2) / 2.0;
         double dy2 = (y0 - y2) / 2.0;
 
-        // Convert angle from degrees to radians
-        //------------------------
         double cos_a = cos(angle);
         double sin_a = sin(angle);
 

Modified: incubator/ooo/trunk/main/agg/source/agg_bspline.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_bspline.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_bspline.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_bspline.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -17,26 +17,16 @@
 //
 //----------------------------------------------------------------------------
 
-
 #include "agg_bspline.h"
 
 namespace agg
 {
-
-    //------------------------------------------------------------------------
-    bspline::~bspline()
-    {
-        delete [] m_am;
-    }
-
-
     //------------------------------------------------------------------------
     bspline::bspline() :
         m_max(0),
         m_num(0),
         m_x(0),
         m_y(0),
-        m_am(0),
         m_last_idx(-1)
     {
     }
@@ -47,7 +37,6 @@ namespace agg
         m_num(0),
         m_x(0),
         m_y(0),
-        m_am(0),
         m_last_idx(-1)
     {
         init(num);
@@ -59,7 +48,6 @@ namespace agg
         m_num(0),
         m_x(0),
         m_y(0),
-        m_am(0),
         m_last_idx(-1)
     {
         init(num, x, y);
@@ -71,11 +59,10 @@ namespace agg
     {
         if(max > 2 && max > m_max)
         {
-            delete [] m_am;
-            m_am = new double[max * 3];
+            m_am.resize(max * 3);
             m_max = max;
-            m_x = m_am + m_max;
-            m_y = m_am + m_max * 2;
+            m_x   = &m_am[m_max];
+            m_y   = &m_am[m_max * 2];
         }
         m_num = 0;
         m_last_idx = -1;
@@ -103,7 +90,6 @@ namespace agg
             double* temp; 
             double* r; 
             double* s;
-            double* al; 
             double h, p, d, f, e;
     
             for(k = 0; k < m_num; k++) 
@@ -113,8 +99,8 @@ namespace agg
 
             n1 = 3 * m_num;
 
-            al = new double[n1];
-            temp = al;
+            pod_array<double> al(n1);
+            temp = &al[0];
 
             for(k = 0; k < n1; k++) 
             {
@@ -155,7 +141,6 @@ namespace agg
                 al[k]   = al[k] * al[k + 1] + s[k];
                 m_am[k] = al[k];
             }
-            delete [] al;
         }
         m_last_idx = -1;
     }

Modified: incubator/ooo/trunk/main/agg/source/agg_curves.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_curves.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_curves.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_curves.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -12,21 +12,38 @@
 //          mcseemagg@yahoo.com
 //          http://www.antigrain.com
 //----------------------------------------------------------------------------
-//
-// classes curve3 and curve4
-//
-//----------------------------------------------------------------------------
 
 #include <math.h>
 #include "agg_curves.h"
+#include "agg_math.h"
 
 namespace agg
 {
 
     //------------------------------------------------------------------------
-    void curve3::init(double x1, double y1, 
-                      double x2, double y2, 
-                      double x3, double y3)
+    const double curve_distance_epsilon                  = 1e-30;
+    const double curve_collinearity_epsilon              = 1e-30;
+    const double curve_angle_tolerance_epsilon           = 0.01;
+    enum curve_recursion_limit_e { curve_recursion_limit = 32 };
+
+
+
+    //------------------------------------------------------------------------
+    void curve3_inc::approximation_scale(double s) 
+    { 
+        m_scale = s;
+    }
+
+    //------------------------------------------------------------------------
+    double curve3_inc::approximation_scale() const 
+    { 
+        return m_scale;
+    }
+
+    //------------------------------------------------------------------------
+    void curve3_inc::init(double x1, double y1, 
+                          double x2, double y2, 
+                          double x3, double y3)
     {
         m_start_x = x1;
         m_start_y = y1;
@@ -40,11 +57,11 @@ namespace agg
 
         double len = sqrt(dx1 * dx1 + dy1 * dy1) + sqrt(dx2 * dx2 + dy2 * dy2); 
 
-        m_num_steps = int(len * 0.25 * m_scale);
+        m_num_steps = uround(len * 0.25 * m_scale);
 
-        if(m_num_steps < 2)
+        if(m_num_steps < 4)
         {
-            m_num_steps = 2;   
+            m_num_steps = 4;   
         }
 
         double subdivide_step  = 1.0 / m_num_steps;
@@ -65,11 +82,8 @@ namespace agg
         m_step = m_num_steps;
     }
 
-
-
-
     //------------------------------------------------------------------------
-    void curve3::rewind(unsigned)
+    void curve3_inc::rewind(unsigned)
     {
         if(m_num_steps == 0)
         {
@@ -83,11 +97,8 @@ namespace agg
         m_dfy  = m_saved_dfy;
     }
 
-
-
-
     //------------------------------------------------------------------------
-    unsigned curve3::vertex(double* x, double* y)
+    unsigned curve3_inc::vertex(double* x, double* y)
     {
         if(m_step < 0) return path_cmd_stop;
         if(m_step == m_num_steps)
@@ -114,23 +125,141 @@ namespace agg
         return path_cmd_line_to;
     }
 
+    //------------------------------------------------------------------------
+    void curve3_div::init(double x1, double y1, 
+                          double x2, double y2, 
+                          double x3, double y3)
+    {
+        m_points.remove_all();
+        m_distance_tolerance_square = 0.5 / m_approximation_scale;
+        m_distance_tolerance_square *= m_distance_tolerance_square;
+        bezier(x1, y1, x2, y2, x3, y3);
+        m_count = 0;
+    }
 
+    //------------------------------------------------------------------------
+    void curve3_div::recursive_bezier(double x1, double y1, 
+                                      double x2, double y2, 
+                                      double x3, double y3,
+                                      unsigned level)
+    {
+        if(level > curve_recursion_limit) 
+        {
+            return;
+        }
 
+        // Calculate all the mid-points of the line segments
+        //----------------------
+        double x12   = (x1 + x2) / 2;                
+        double y12   = (y1 + y2) / 2;
+        double x23   = (x2 + x3) / 2;
+        double y23   = (y2 + y3) / 2;
+        double x123  = (x12 + x23) / 2;
+        double y123  = (y12 + y23) / 2;
+
+        double dx = x3-x1;
+        double dy = y3-y1;
+        double d = fabs(((x2 - x3) * dy - (y2 - y3) * dx));
+        double da;
+
+        if(d > curve_collinearity_epsilon)
+        { 
+            // Regular case
+            //-----------------
+            if(d * d <= m_distance_tolerance_square * (dx*dx + dy*dy))
+            {
+                // If the curvature doesn't exceed the distance_tolerance value
+                // we tend to finish subdivisions.
+                //----------------------
+                if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+                {
+                    m_points.add(point_d(x123, y123));
+                    return;
+                }
+
+                // Angle & Cusp Condition
+                //----------------------
+                da = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
+                if(da >= pi) da = 2*pi - da;
+
+                if(da < m_angle_tolerance)
+                {
+                    // Finally we can stop the recursion
+                    //----------------------
+                    m_points.add(point_d(x123, y123));
+                    return;                 
+                }
+            }
+        }
+        else
+        {
+            // Collinear case
+            //------------------
+            da = dx*dx + dy*dy;
+            if(da == 0)
+            {
+                d = calc_sq_distance(x1, y1, x2, y2);
+            }
+            else
+            {
+                d = ((x2 - x1)*dx + (y2 - y1)*dy) / da;
+                if(d > 0 && d < 1)
+                {
+                    // Simple collinear case, 1---2---3
+                    // We can leave just two endpoints
+                    return;
+                }
+                     if(d <= 0) d = calc_sq_distance(x2, y2, x1, y1);
+                else if(d >= 1) d = calc_sq_distance(x2, y2, x3, y3);
+                else            d = calc_sq_distance(x2, y2, x1 + d*dx, y1 + d*dy);
+            }
+            if(d < m_distance_tolerance_square)
+            {
+                m_points.add(point_d(x2, y2));
+                return;
+            }
+        }
 
+        // Continue subdivision
+        //----------------------
+        recursive_bezier(x1, y1, x12, y12, x123, y123, level + 1); 
+        recursive_bezier(x123, y123, x23, y23, x3, y3, level + 1); 
+    }
 
+    //------------------------------------------------------------------------
+    void curve3_div::bezier(double x1, double y1, 
+                            double x2, double y2, 
+                            double x3, double y3)
+    {
+        m_points.add(point_d(x1, y1));
+        recursive_bezier(x1, y1, x2, y2, x3, y3, 0);
+        m_points.add(point_d(x3, y3));
+    }
 
 
 
 
 
+    //------------------------------------------------------------------------
+    void curve4_inc::approximation_scale(double s) 
+    { 
+        m_scale = s;
+    }
 
+    //------------------------------------------------------------------------
+    double curve4_inc::approximation_scale() const 
+    { 
+        return m_scale;
+    }
 
+    //------------------------------------------------------------------------
+    static double MSC60_fix_ICE(double v) { return v; }
 
     //------------------------------------------------------------------------
-    void curve4::init(double x1, double y1, 
-                      double x2, double y2, 
-                      double x3, double y3,
-                      double x4, double y4)
+    void curve4_inc::init(double x1, double y1, 
+                          double x2, double y2, 
+                          double x3, double y3,
+                          double x4, double y4)
     {
         m_start_x = x1;
         m_start_y = y1;
@@ -144,25 +273,29 @@ namespace agg
         double dx3 = x4 - x3;
         double dy3 = y4 - y3;
 
-        double len = sqrt(dx1 * dx1 + dy1 * dy1) + 
-                     sqrt(dx2 * dx2 + dy2 * dy2) + 
-                     sqrt(dx3 * dx3 + dy3 * dy3);
-
-        m_num_steps = int(len * 0.25 * m_scale);
+        double len = (sqrt(dx1 * dx1 + dy1 * dy1) + 
+                      sqrt(dx2 * dx2 + dy2 * dy2) + 
+                      sqrt(dx3 * dx3 + dy3 * dy3)) * 0.25 * m_scale;
+
+#if defined(_MSC_VER) && _MSC_VER <= 1200
+        m_num_steps = uround(MSC60_fix_ICE(len));
+#else
+        m_num_steps = uround(len);
+#endif
 
-        if(m_num_steps < 2)
+        if(m_num_steps < 4)
         {
-            m_num_steps = 2;   
+            m_num_steps = 4;   
         }
 
         double subdivide_step  = 1.0 / m_num_steps;
         double subdivide_step2 = subdivide_step * subdivide_step;
         double subdivide_step3 = subdivide_step * subdivide_step * subdivide_step;
 
-	    double pre1 = 3.0 * subdivide_step;
-	    double pre2 = 3.0 * subdivide_step2;
-	    double pre4 = 6.0 * subdivide_step2;
-	    double pre5 = 6.0 * subdivide_step3;
+        double pre1 = 3.0 * subdivide_step;
+        double pre2 = 3.0 * subdivide_step2;
+        double pre4 = 6.0 * subdivide_step2;
+        double pre5 = 6.0 * subdivide_step3;
 	
         double tmp1x = x1 - x2 * 2.0 + x3;
         double tmp1y = y1 - y2 * 2.0 + y3;
@@ -185,11 +318,8 @@ namespace agg
         m_step = m_num_steps;
     }
 
-
-
-
     //------------------------------------------------------------------------
-    void curve4::rewind(unsigned)
+    void curve4_inc::rewind(unsigned)
     {
         if(m_num_steps == 0)
         {
@@ -205,12 +335,8 @@ namespace agg
         m_ddfy = m_saved_ddfy;
     }
 
-
-
-
-
     //------------------------------------------------------------------------
-    unsigned curve4::vertex(double* x, double* y)
+    unsigned curve4_inc::vertex(double* x, double* y)
     {
         if(m_step < 0) return path_cmd_stop;
         if(m_step == m_num_steps)
@@ -220,6 +346,7 @@ namespace agg
             --m_step;
             return path_cmd_move_to;
         }
+
         if(m_step == 0)
         {
             *x = m_end_x;
@@ -227,12 +354,14 @@ namespace agg
             --m_step;
             return path_cmd_line_to;
         }
-        m_fx   += m_dfx; 
+
+        m_fx   += m_dfx;
         m_fy   += m_dfy;
         m_dfx  += m_ddfx; 
         m_dfy  += m_ddfy; 
         m_ddfx += m_dddfx; 
         m_ddfy += m_dddfy; 
+
         *x = m_fx;
         *y = m_fy;
         --m_step;
@@ -242,5 +371,241 @@ namespace agg
 
 
 
+    //------------------------------------------------------------------------
+    void curve4_div::init(double x1, double y1, 
+                          double x2, double y2, 
+                          double x3, double y3,
+                          double x4, double y4)
+    {
+        m_points.remove_all();
+        m_distance_tolerance_square = 0.5 / m_approximation_scale;
+        m_distance_tolerance_square *= m_distance_tolerance_square;
+        bezier(x1, y1, x2, y2, x3, y3, x4, y4);
+        m_count = 0;
+    }
+
+    //------------------------------------------------------------------------
+    void curve4_div::recursive_bezier(double x1, double y1, 
+                                      double x2, double y2, 
+                                      double x3, double y3, 
+                                      double x4, double y4,
+                                      unsigned level)
+    {
+        if(level > curve_recursion_limit) 
+        {
+            return;
+        }
+
+        // Calculate all the mid-points of the line segments
+        //----------------------
+        double x12   = (x1 + x2) / 2;
+        double y12   = (y1 + y2) / 2;
+        double x23   = (x2 + x3) / 2;
+        double y23   = (y2 + y3) / 2;
+        double x34   = (x3 + x4) / 2;
+        double y34   = (y3 + y4) / 2;
+        double x123  = (x12 + x23) / 2;
+        double y123  = (y12 + y23) / 2;
+        double x234  = (x23 + x34) / 2;
+        double y234  = (y23 + y34) / 2;
+        double x1234 = (x123 + x234) / 2;
+        double y1234 = (y123 + y234) / 2;
+
+
+        // Try to approximate the full cubic curve by a single straight line
+        //------------------
+        double dx = x4-x1;
+        double dy = y4-y1;
+
+        double d2 = fabs(((x2 - x4) * dy - (y2 - y4) * dx));
+        double d3 = fabs(((x3 - x4) * dy - (y3 - y4) * dx));
+        double da1, da2, k;
+
+        switch((int(d2 > curve_collinearity_epsilon) << 1) +
+                int(d3 > curve_collinearity_epsilon))
+        {
+        case 0:
+            // All collinear OR p1==p4
+            //----------------------
+            k = dx*dx + dy*dy;
+            if(k == 0)
+            {
+                d2 = calc_sq_distance(x1, y1, x2, y2);
+                d3 = calc_sq_distance(x4, y4, x3, y3);
+            }
+            else
+            {
+                k   = 1 / k;
+                da1 = x2 - x1;
+                da2 = y2 - y1;
+                d2  = k * (da1*dx + da2*dy);
+                da1 = x3 - x1;
+                da2 = y3 - y1;
+                d3  = k * (da1*dx + da2*dy);
+                if(d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1)
+                {
+                    // Simple collinear case, 1---2---3---4
+                    // We can leave just two endpoints
+                    return;
+                }
+                     if(d2 <= 0) d2 = calc_sq_distance(x2, y2, x1, y1);
+                else if(d2 >= 1) d2 = calc_sq_distance(x2, y2, x4, y4);
+                else             d2 = calc_sq_distance(x2, y2, x1 + d2*dx, y1 + d2*dy);
+
+                     if(d3 <= 0) d3 = calc_sq_distance(x3, y3, x1, y1);
+                else if(d3 >= 1) d3 = calc_sq_distance(x3, y3, x4, y4);
+                else             d3 = calc_sq_distance(x3, y3, x1 + d3*dx, y1 + d3*dy);
+            }
+            if(d2 > d3)
+            {
+                if(d2 < m_distance_tolerance_square)
+                {
+                    m_points.add(point_d(x2, y2));
+                    return;
+                }
+            }
+            else
+            {
+                if(d3 < m_distance_tolerance_square)
+                {
+                    m_points.add(point_d(x3, y3));
+                    return;
+                }
+            }
+            break;
+
+        case 1:
+            // p1,p2,p4 are collinear, p3 is significant
+            //----------------------
+            if(d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy))
+            {
+                if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+                {
+                    m_points.add(point_d(x23, y23));
+                    return;
+                }
+
+                // Angle Condition
+                //----------------------
+                da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2));
+                if(da1 >= pi) da1 = 2*pi - da1;
+
+                if(da1 < m_angle_tolerance)
+                {
+                    m_points.add(point_d(x2, y2));
+                    m_points.add(point_d(x3, y3));
+                    return;
+                }
+
+                if(m_cusp_limit != 0.0)
+                {
+                    if(da1 > m_cusp_limit)
+                    {
+                        m_points.add(point_d(x3, y3));
+                        return;
+                    }
+                }
+            }
+            break;
+
+        case 2:
+            // p1,p3,p4 are collinear, p2 is significant
+            //----------------------
+            if(d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy))
+            {
+                if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+                {
+                    m_points.add(point_d(x23, y23));
+                    return;
+                }
+
+                // Angle Condition
+                //----------------------
+                da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1));
+                if(da1 >= pi) da1 = 2*pi - da1;
+
+                if(da1 < m_angle_tolerance)
+                {
+                    m_points.add(point_d(x2, y2));
+                    m_points.add(point_d(x3, y3));
+                    return;
+                }
+
+                if(m_cusp_limit != 0.0)
+                {
+                    if(da1 > m_cusp_limit)
+                    {
+                        m_points.add(point_d(x2, y2));
+                        return;
+                    }
+                }
+            }
+            break;
+
+        case 3: 
+            // Regular case
+            //-----------------
+            if((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy))
+            {
+                // If the curvature doesn't exceed the distance_tolerance value
+                // we tend to finish subdivisions.
+                //----------------------
+                if(m_angle_tolerance < curve_angle_tolerance_epsilon)
+                {
+                    m_points.add(point_d(x23, y23));
+                    return;
+                }
+
+                // Angle & Cusp Condition
+                //----------------------
+                k   = atan2(y3 - y2, x3 - x2);
+                da1 = fabs(k - atan2(y2 - y1, x2 - x1));
+                da2 = fabs(atan2(y4 - y3, x4 - x3) - k);
+                if(da1 >= pi) da1 = 2*pi - da1;
+                if(da2 >= pi) da2 = 2*pi - da2;
+
+                if(da1 + da2 < m_angle_tolerance)
+                {
+                    // Finally we can stop the recursion
+                    //----------------------
+                    m_points.add(point_d(x23, y23));
+                    return;
+                }
+
+                if(m_cusp_limit != 0.0)
+                {
+                    if(da1 > m_cusp_limit)
+                    {
+                        m_points.add(point_d(x2, y2));
+                        return;
+                    }
+
+                    if(da2 > m_cusp_limit)
+                    {
+                        m_points.add(point_d(x3, y3));
+                        return;
+                    }
+                }
+            }
+            break;
+        }
+
+        // Continue subdivision
+        //----------------------
+        recursive_bezier(x1, y1, x12, y12, x123, y123, x1234, y1234, level + 1); 
+        recursive_bezier(x1234, y1234, x234, y234, x34, y34, x4, y4, level + 1); 
+    }
+
+    //------------------------------------------------------------------------
+    void curve4_div::bezier(double x1, double y1, 
+                            double x2, double y2, 
+                            double x3, double y3, 
+                            double x4, double y4)
+    {
+        m_points.add(point_d(x1, y1));
+        recursive_bezier(x1, y1, x2, y2, x3, y3, x4, y4, 0);
+        m_points.add(point_d(x4, y4));
+    }
+
 }
 

Modified: incubator/ooo/trunk/main/agg/source/agg_embedded_raster_fonts.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_embedded_raster_fonts.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_embedded_raster_fonts.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_embedded_raster_fonts.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 

Modified: incubator/ooo/trunk/main/agg/source/agg_gsv_text.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_gsv_text.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_gsv_text.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_gsv_text.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -19,6 +19,8 @@
 #include <string.h>
 #include <stdio.h>
 #include "agg_gsv_text.h"
+#include "agg_bounding_rect.h"
+
 
 
 namespace agg
@@ -480,16 +482,6 @@ namespace agg
         0xf6,0xfa,0x04,0x06,0x08,0xfa
     };
 
-
-
-    //-------------------------------------------------------------------------
-    gsv_text::~gsv_text()
-    {
-        if(m_loaded_font) delete [] m_loaded_font;
-        if(m_text_buf)    delete [] m_text_buf;
-    }
-
-
     //-------------------------------------------------------------------------
     gsv_text::gsv_text() :
       m_x(0.0),
@@ -500,11 +492,10 @@ namespace agg
       m_space(0.0),
       m_line_space(0.0),
       m_text(m_chr),
-      m_text_buf(0),
-      m_buf_size(0), 
+      m_text_buf(),
       m_cur_chr(m_chr),
       m_font(gsv_default_font),
-      m_loaded_font(0),
+      m_loaded_font(),
       m_status(initial),
       m_big_endian(false),
       m_flip(false)
@@ -515,13 +506,11 @@ namespace agg
         if(*(char*)&t == 0) m_big_endian = true;
     }
 
-
-
     //-------------------------------------------------------------------------
-    void gsv_text::font(const void* _font)
+    void gsv_text::font(const void* font)
     {
-        m_font = _font;
-        if(m_font == 0) m_font = m_loaded_font;
+        m_font = font;
+        if(m_font == 0) m_font = &m_loaded_font[0];
     }
 
     //-------------------------------------------------------------------------
@@ -532,15 +521,15 @@ namespace agg
     }
 
     //-------------------------------------------------------------------------
-    void gsv_text::space(double _space)
+    void gsv_text::space(double space)
     {
-        m_space = _space;
+        m_space = space;
     }
 
     //-------------------------------------------------------------------------
-    void gsv_text::line_space(double _line_space)
+    void gsv_text::line_space(double line_space)
     {
-        m_line_space = _line_space;
+        m_line_space = line_space;
     }
 
     //-------------------------------------------------------------------------
@@ -551,13 +540,10 @@ namespace agg
         //if(m_flip) m_y += m_height;
     }
 
-
     //-------------------------------------------------------------------------
     void gsv_text::load_font(const char* file)
     {
-        if(m_loaded_font) delete [] m_loaded_font;
-        m_loaded_font = 0;
-
+        m_loaded_font.resize(0);
         FILE* fd = fopen(file, "rb");
         if(fd)
         {
@@ -568,36 +554,32 @@ namespace agg
             fseek(fd, 0l, SEEK_SET);
             if(len > 0)
             {
-                m_loaded_font = new char [len];
-                fread(m_loaded_font, 1, len, fd);
-                m_font = m_loaded_font;
+                m_loaded_font.resize(len);
+                fread(&m_loaded_font[0], 1, len, fd);
+                m_font = &m_loaded_font[0];
             }
             fclose(fd);
         }
     }
 
-
     //-------------------------------------------------------------------------
-    void gsv_text::text(const char* _text)
+    void gsv_text::text(const char* text)
     {
-        if(_text == 0)
+        if(text == 0)
         {
             m_chr[0] = 0;
             m_text = m_chr;
             return;
         }
-        unsigned new_size = strlen(_text) + 1;
-        if(new_size > m_buf_size)
+        unsigned new_size = strlen(text) + 1;
+        if(new_size > m_text_buf.size())
         {
-            if(m_text_buf) delete [] m_text_buf;
-            m_text_buf = new char [m_buf_size = new_size];
+            m_text_buf.resize(new_size);
         }
-        memcpy(m_text_buf, _text, new_size);
-        m_text = m_text_buf;
+        memcpy(&m_text_buf[0], text, new_size);
+        m_text = &m_text_buf[0];
     }
 
-
-
     //-------------------------------------------------------------------------
     void gsv_text::rewind(unsigned)
     {
@@ -614,7 +596,6 @@ namespace agg
         m_cur_chr = m_text;
     }
 
-
     //-------------------------------------------------------------------------
     unsigned gsv_text::vertex(double* x, double* y)
     {
@@ -622,7 +603,6 @@ namespace agg
         int8 yc, yf;
         int dx, dy;
         bool quit = false;
-
         
         while(!quit)
         {
@@ -683,6 +663,13 @@ namespace agg
         return path_cmd_stop;
     }
 
+    //-------------------------------------------------------------------------
+    double gsv_text::text_width()
+    {
+        double x1, y1, x2, y2;
+        bounding_rect_single(*this, 0, &x1, &y1, &x2, &y2);
+        return x2 - x1;
+    }
 
 
 }

Modified: incubator/ooo/trunk/main/agg/source/agg_image_filters.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_image_filters.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_image_filters.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_image_filters.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -23,32 +23,16 @@
 
 namespace agg
 {
-
-    //--------------------------------------------------------------------
-    image_filter_lut::~image_filter_lut()
-    {
-        delete [] m_weight_array;
-    }
-
-
-    //--------------------------------------------------------------------
-    image_filter_lut::image_filter_lut() :
-        m_weight_array(0),
-        m_max_size(0)
-    {}
-
     //--------------------------------------------------------------------
-    void image_filter_lut::realloc(double _radius)
+    void image_filter_lut::realloc_lut(double radius)
     {
-        m_radius = _radius;
-        m_diameter = unsigned(ceil(_radius)) * 2;
+        m_radius = radius;
+        m_diameter = uceil(radius) * 2;
         m_start = -int(m_diameter / 2 - 1);
         unsigned size = m_diameter << image_subpixel_shift;
-        if(size > m_max_size)
+        if(size > m_weight_array.size())
         {
-            delete [] m_weight_array;
-            m_weight_array = new int16 [size];
-            m_max_size = size;
+            m_weight_array.resize(size);
         }
     }
 
@@ -66,7 +50,7 @@ namespace agg
         unsigned i;
         int flip = 1;
 
-        for(i = 0; i < image_subpixel_size; i++)
+        for(i = 0; i < image_subpixel_scale; i++)
         {
             for(;;)
             {
@@ -74,31 +58,30 @@ namespace agg
                 unsigned j;
                 for(j = 0; j < m_diameter; j++)
                 {
-                    sum += m_weight_array[j * image_subpixel_size + i];
+                    sum += m_weight_array[j * image_subpixel_scale + i];
                 }
 
-                if(sum == image_filter_size) break;
+                if(sum == image_filter_scale) break;
 
-                double k = double(image_filter_size) / double(sum);
+                double k = double(image_filter_scale) / double(sum);
                 sum = 0;
                 for(j = 0; j < m_diameter; j++)
                 {
-                    sum += m_weight_array[j * image_subpixel_size + i] = 
-                        int16(m_weight_array[j * image_subpixel_size + i] * k);
+                    sum +=     m_weight_array[j * image_subpixel_scale + i] = 
+                        iround(m_weight_array[j * image_subpixel_scale + i] * k);
                 }
 
-                sum -= image_filter_size;
-                int16 inc = (sum > 0) ? -1 : 1;
+                sum -= image_filter_scale;
+                int inc = (sum > 0) ? -1 : 1;
 
                 for(j = 0; j < m_diameter && sum; j++)
                 {
                     flip ^= 1;
                     unsigned idx = flip ? m_diameter/2 + j/2 : m_diameter/2 - j/2;
-                    int v = m_weight_array[idx * image_subpixel_size + i];
-                    if(v < image_filter_size)
+                    int v = m_weight_array[idx * image_subpixel_scale + i];
+                    if(v < image_filter_scale)
                     {
-                        m_weight_array[idx * image_subpixel_size + i] =
-							m_weight_array[idx * image_subpixel_size + i] + inc;
+                        m_weight_array[idx * image_subpixel_scale + i] += inc;
                         sum += inc;
                     }
                 }

Modified: incubator/ooo/trunk/main/agg/source/agg_line_aa_basics.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_line_aa_basics.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_line_aa_basics.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_line_aa_basics.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -41,9 +41,9 @@ namespace agg
     //         (7)111 | 101(5) 
     //   [2]          |          [3]
     //               <3> 
-    //                                                  0,1,2,3,4,5,6,7 
-    int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 };
-    int8u line_parameters::s_diagonal_quadrant[8]   = { 0,1,2,1,0,3,2,3 };
+    //                                                        0,1,2,3,4,5,6,7 
+    const int8u line_parameters::s_orthogonal_quadrant[8] = { 0,0,1,1,3,3,2,2 };
+    const int8u line_parameters::s_diagonal_quadrant[8]   = { 0,1,2,1,0,3,2,3 };
 
 
 
@@ -69,14 +69,14 @@ namespace agg
         // Check if the bisectrix is too short
         double dx = tx - l2.x1;
         double dy = ty - l2.y1;
-        if((int)sqrt(dx * dx + dy * dy) < line_subpixel_size)
+        if((int)sqrt(dx * dx + dy * dy) < line_subpixel_scale)
         {
             *x = (l2.x1 + l2.x1 + (l2.y1 - l1.y1) + (l2.y2 - l2.y1)) >> 1;
             *y = (l2.y1 + l2.y1 - (l2.x1 - l1.x1) - (l2.x2 - l2.x1)) >> 1;
             return;
         }
-        *x = int(tx);
-        *y = int(ty);
+        *x = iround(tx);
+        *y = iround(ty);
     }
 
 }

Modified: incubator/ooo/trunk/main/agg/source/agg_line_profile_aa.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_line_profile_aa.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_line_profile_aa.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_line_profile_aa.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -42,39 +42,38 @@ namespace agg
     //---------------------------------------------------------------------
     line_profile_aa::value_type* line_profile_aa::profile(double w)
     {
-        m_subpixel_width = int(w * subpixel_size);
-        unsigned size = m_subpixel_width + subpixel_size * 6;
-        if(size > m_size)
+        m_subpixel_width = uround(w * subpixel_scale);
+        unsigned size = m_subpixel_width + subpixel_scale * 6;
+        if(size > m_profile.size())
         {
-            delete [] m_profile;
-            m_profile = new value_type[m_size = size];
+            m_profile.resize(size);
         }
-        return m_profile;
+        return &m_profile[0];
     }
 
 
     //---------------------------------------------------------------------
-    void line_profile_aa::set(double center_width, double _smoother_width)
+    void line_profile_aa::set(double center_width, double smoother_width)
     {
         double base_val = 1.0;
-        if(center_width == 0.0)   center_width = 1.0 / subpixel_size;
-        if(_smoother_width == 0.0) _smoother_width = 1.0 / subpixel_size;
+        if(center_width == 0.0)   center_width = 1.0 / subpixel_scale;
+        if(smoother_width == 0.0) smoother_width = 1.0 / subpixel_scale;
 
-        double _width = center_width + _smoother_width;
-        if(_width < m_min_width)
+        double width = center_width + smoother_width;
+        if(width < m_min_width)
         {
-            double k = _width / m_min_width;
+            double k = width / m_min_width;
             base_val *= k;
             center_width /= k;
-            _smoother_width /= k;
+            smoother_width /= k;
         }
 
-        value_type* ch = profile(center_width + _smoother_width);
+        value_type* ch = profile(center_width + smoother_width);
 
-        unsigned subpixel_center_width = unsigned(center_width * subpixel_size);
-        unsigned subpixel_smoother_width = unsigned(_smoother_width * subpixel_size);
+        unsigned subpixel_center_width = unsigned(center_width * subpixel_scale);
+        unsigned subpixel_smoother_width = unsigned(smoother_width * subpixel_scale);
 
-        value_type* ch_center   = ch + subpixel_size*2;
+        value_type* ch_center   = ch + subpixel_scale*2;
         value_type* ch_smoother = ch_center + subpixel_center_width;
 
         unsigned i;
@@ -97,7 +96,7 @@ namespace agg
         unsigned n_smoother = profile_size() - 
                               subpixel_smoother_width - 
                               subpixel_center_width - 
-                              subpixel_size*2;
+                              subpixel_scale*2;
 
         val = m_gamma[0];
         for(i = 0; i < n_smoother; i++)
@@ -106,7 +105,7 @@ namespace agg
         }
 
         ch = ch_center;
-        for(i = 0; i < subpixel_size*2; i++)
+        for(i = 0; i < subpixel_scale*2; i++)
         {
             *--ch = *ch_center++;
         }

Modified: incubator/ooo/trunk/main/agg/source/agg_rounded_rect.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_rounded_rect.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_rounded_rect.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_rounded_rect.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -152,7 +152,7 @@ namespace agg
             else return path_cmd_line_to;
 
         case 8:
-            cmd = (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_ccw;
+            cmd = path_cmd_end_poly | path_flags_close | path_flags_ccw;
             m_status++;
             break;
         }

Modified: incubator/ooo/trunk/main/agg/source/agg_sqrt_tables.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_sqrt_tables.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_sqrt_tables.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_sqrt_tables.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -21,7 +21,7 @@
 
 namespace agg
 {
-    int16u g_sqrt_table[1024] = 
+    int16u g_sqrt_table[1024] =                       //----------g_sqrt_table
     {
         0,
         2048,2896,3547,4096,4579,5017,5418,5793,6144,6476,6792,7094,7384,7663,7932,8192,8444,
@@ -100,7 +100,7 @@ namespace agg
     };
 
 
-    int8 g_elder_bit_table[256] = 
+    int8 g_elder_bit_table[256] =          //---------g_elder_bit_table
     {
         0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
         5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,

Modified: incubator/ooo/trunk/main/agg/source/agg_trans_affine.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_trans_affine.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_trans_affine.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_trans_affine.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -27,12 +27,12 @@ namespace agg
     const trans_affine& trans_affine::parl_to_parl(const double* src, 
                                                    const double* dst)
     {
-        m0 = src[2] - src[0];
-        m1 = src[3] - src[1];
-        m2 = src[4] - src[0];
-        m3 = src[5] - src[1];
-        m4 = src[0];
-        m5 = src[1];
+        sx  = src[2] - src[0];
+        shy = src[3] - src[1];
+        shx = src[4] - src[0];
+        sy  = src[5] - src[1];
+        tx  = src[0];
+        ty  = src[1];
         invert();
         multiply(trans_affine(dst[2] - dst[0], dst[3] - dst[1], 
                               dst[4] - dst[0], dst[5] - dst[1],
@@ -69,15 +69,15 @@ namespace agg
     //------------------------------------------------------------------------
     const trans_affine& trans_affine::multiply(const trans_affine& m)
     {
-        double t0 = m0 * m.m0 + m1 * m.m2;
-        double t2 = m2 * m.m0 + m3 * m.m2;
-        double t4 = m4 * m.m0 + m5 * m.m2 + m.m4;
-        m1 = m0 * m.m1 + m1 * m.m3;
-        m3 = m2 * m.m1 + m3 * m.m3;
-        m5 = m4 * m.m1 + m5 * m.m3 + m.m5;
-        m0 = t0;
-        m2 = t2;
-        m4 = t4;
+        double t0 = sx  * m.sx + shy * m.shx;
+        double t2 = shx * m.sx + sy  * m.shx;
+        double t4 = tx  * m.sx + ty  * m.shx + m.tx;
+        shy = sx  * m.shy + shy * m.sy;
+        sy  = shx * m.shy + sy  * m.sy;
+        ty  = tx  * m.shy + ty  * m.sy + m.ty;
+        sx  = t0;
+        shx = t2;
+        tx  = t4;
         return *this;
     }
 
@@ -85,18 +85,18 @@ namespace agg
     //------------------------------------------------------------------------
     const trans_affine& trans_affine::invert()
     {
-        double d  = determinant();
+        double d  = determinant_reciprocal();
 
-        double t0 =  m3 * d;
-               m3 =  m0 * d;
-               m1 = -m1 * d;
-               m2 = -m2 * d;
+        double t0  =  sy  * d;
+               sy  =  sx  * d;
+               shy = -shy * d;
+               shx = -shx * d;
 
-        double t4 = -m4 * t0 - m5 * m2;
-               m5 = -m4 * m1 - m5 * m3;
+        double t4 = -tx * t0  - ty * shx;
+               ty = -tx * shy - ty * sy;
 
-        m0 = t0;
-        m4 = t4;
+        sx = t0;
+        tx = t4;
         return *this;
     }
 
@@ -104,55 +104,55 @@ namespace agg
    //------------------------------------------------------------------------
     const trans_affine& trans_affine::flip_x()
     {
-        m0 = -m0;
-        m1 = -m1;
-        m4 = -m4;
+        sx  = -sx;
+        shy = -shy;
+        tx  = -tx;
         return *this;
     }
 
     //------------------------------------------------------------------------
     const trans_affine& trans_affine::flip_y()
     {
-        m2 = -m2;
-        m3 = -m3;
-        m5 = -m5;
+        shx = -shx;
+        sy  = -sy;
+        ty  = -ty;
         return *this;
     }
 
     //------------------------------------------------------------------------
     const trans_affine& trans_affine::reset()
     {
-        m0 = m3 = 1.0; 
-        m1 = m2 = m4 = m5 = 0.0;
+        sx  = sy  = 1.0; 
+        shy = shx = tx = ty = 0.0;
         return *this;
     }
 
     //------------------------------------------------------------------------
-    inline bool is_equal_eps(double v1, double v2, double epsilon)
+    bool trans_affine::is_identity(double epsilon) const
     {
-        return fabs(v1 - v2) < epsilon;
+        return is_equal_eps(sx,  1.0, epsilon) &&
+               is_equal_eps(shy, 0.0, epsilon) &&
+               is_equal_eps(shx, 0.0, epsilon) && 
+               is_equal_eps(sy,  1.0, epsilon) &&
+               is_equal_eps(tx,  0.0, epsilon) &&
+               is_equal_eps(ty,  0.0, epsilon);
     }
 
     //------------------------------------------------------------------------
-    bool trans_affine::is_identity(double epsilon) const
+    bool trans_affine::is_valid(double epsilon) const
     {
-        return is_equal_eps(m0, 1.0, epsilon) &&
-               is_equal_eps(m1, 0.0, epsilon) &&
-               is_equal_eps(m2, 0.0, epsilon) && 
-               is_equal_eps(m3, 1.0, epsilon) &&
-               is_equal_eps(m4, 0.0, epsilon) &&
-               is_equal_eps(m5, 0.0, epsilon);
+        return fabs(sx) > epsilon && fabs(sy) > epsilon;
     }
 
     //------------------------------------------------------------------------
     bool trans_affine::is_equal(const trans_affine& m, double epsilon) const
     {
-        return is_equal_eps(m0, m.m0, epsilon) &&
-               is_equal_eps(m1, m.m1, epsilon) &&
-               is_equal_eps(m2, m.m2, epsilon) && 
-               is_equal_eps(m3, m.m3, epsilon) &&
-               is_equal_eps(m4, m.m4, epsilon) &&
-               is_equal_eps(m5, m.m5, epsilon);
+        return is_equal_eps(sx,  m.sx,  epsilon) &&
+               is_equal_eps(shy, m.shy, epsilon) &&
+               is_equal_eps(shx, m.shx, epsilon) && 
+               is_equal_eps(sy,  m.sy,  epsilon) &&
+               is_equal_eps(tx,  m.tx,  epsilon) &&
+               is_equal_eps(ty,  m.ty,  epsilon);
     }
 
     //------------------------------------------------------------------------
@@ -170,13 +170,12 @@ namespace agg
     //------------------------------------------------------------------------
     void trans_affine::translation(double* dx, double* dy) const
     {
-        trans_affine t(*this);
-        t *= trans_affine_rotation(-rotation());
-        t.transform(dx, dy);
+        *dx = tx;
+        *dy = ty;
     }
 
     //------------------------------------------------------------------------
-    void trans_affine::scaling(double* sx, double* sy) const
+    void trans_affine::scaling(double* x, double* y) const
     {
         double x1 = 0.0;
         double y1 = 0.0;
@@ -186,8 +185,8 @@ namespace agg
         t *= trans_affine_rotation(-rotation());
         t.transform(&x1, &y1);
         t.transform(&x2, &y2);
-        *sx = x2 - x1;
-        *sy = y2 - y1;
+        *x = x2 - x1;
+        *y = y2 - y1;
     }
 
 

Modified: incubator/ooo/trunk/main/agg/source/agg_trans_double_path.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_trans_double_path.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_trans_double_path.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_trans_double_path.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -21,10 +21,10 @@ namespace agg
 
     //------------------------------------------------------------------------
     trans_double_path::trans_double_path() :
-        m_base_length(0.0),
-        m_base_height(1.0),
         m_kindex1(0.0),
         m_kindex2(0.0),
+        m_base_length(0.0),
+        m_base_height(1.0),
         m_status1(initial),
         m_status2(initial),
         m_preserve_x_scale(true)
@@ -101,6 +101,7 @@ namespace agg
         double dist;
         double d;
 
+        vertices.close(false);
         if(vertices.size() > 2)
         {
             if(vertices[vertices.size() - 2].dist * 10.0 < 
@@ -118,7 +119,6 @@ namespace agg
         }
 
         dist = 0;
-        vertices.close(false);
         for(i = 0; i < vertices.size(); i++)
         {
             vertex_dist& v = vertices[i];
@@ -228,7 +228,7 @@ namespace agg
             }
             else
             {
-                i = (unsigned)floor(*x * kindex);
+                i = unsigned(*x * kindex);
                 j = i + 1;
                 dd = vertices[j].dist - vertices[i].dist;
                 d = ((*x * kindex) - i) * dd;

Modified: incubator/ooo/trunk/main/agg/source/agg_trans_single_path.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_trans_single_path.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_trans_single_path.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_trans_single_path.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -70,6 +70,7 @@ namespace agg
             double dist;
             double d;
 
+            m_src_vertices.close(false);
             if(m_src_vertices.size() > 2)
             {
                 if(m_src_vertices[m_src_vertices.size() - 2].dist * 10.0 < 
@@ -87,13 +88,12 @@ namespace agg
             }
 
             dist = 0.0;
-            m_src_vertices.close(false);
             for(i = 0; i < m_src_vertices.size(); i++)
             {
                 vertex_dist& v = m_src_vertices[i];
-                double _d = v.dist;
+                double d = v.dist;
                 v.dist = dist;
-                dist += _d;
+                dist += d;
             }
             m_kindex = (m_src_vertices.size() - 1) / dist;
             m_status = ready;
@@ -180,7 +180,7 @@ namespace agg
                 }
                 else
                 {
-                    i = (unsigned)floor(*x * m_kindex);
+                    i = unsigned(*x * m_kindex);
                     j = i + 1;
                     dd = m_src_vertices[j].dist - m_src_vertices[i].dist;
                     d = ((*x * m_kindex) - i) * dd;

Modified: incubator/ooo/trunk/main/agg/source/agg_trans_warp_magnifier.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_trans_warp_magnifier.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_trans_warp_magnifier.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_trans_warp_magnifier.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -40,10 +40,30 @@ namespace agg
     //------------------------------------------------------------------------
     void trans_warp_magnifier::inverse_transform(double* x, double* y) const
     {
-        trans_warp_magnifier t(*this);
-        t.magnification(1.0 / m_magn);
-        t.radius(m_radius * m_magn);
-        t.transform(x, y);
+        // New version by Andrew Skalkin
+        //-----------------
+        double dx = *x - m_xc;
+        double dy = *y - m_yc;
+        double r = sqrt(dx * dx + dy * dy);
+
+        if(r < m_radius * m_magn) 
+        {
+            *x = m_xc + dx / m_magn;
+            *y = m_yc + dy / m_magn;
+        }
+        else
+        {
+            double rnew = r - m_radius * (m_magn - 1.0);
+            *x = m_xc + rnew * dx / r; 
+            *y = m_yc + rnew * dy / r;
+        }
+
+        // Old version
+        //-----------------
+        //trans_warp_magnifier t(*this);
+        //t.magnification(1.0 / m_magn);
+        //t.radius(m_radius * m_magn);
+        //t.transform(x, y);
     }
 
 

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_bspline.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_bspline.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_bspline.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_bspline.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -47,13 +47,13 @@ namespace agg
         m_status = initial;
         if(is_move_to(cmd))
         {
-            m_src_vertices.modify_last(point_type(x, y));
+            m_src_vertices.modify_last(point_d(x, y));
         }
         else
         {
             if(is_vertex(cmd))
             {
-                m_src_vertices.add(point_type(x, y));
+                m_src_vertices.add(point_d(x, y));
             }
             else
             {
@@ -113,8 +113,8 @@ namespace agg
             }
             m_spline_x.prepare();
             m_spline_y.prepare();
-            m_status = ready;
         }
+        m_status = ready;
     }
 
 

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_contour.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_contour.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_contour.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_contour.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -25,16 +25,10 @@ namespace agg
 
     //------------------------------------------------------------------------
     vcgen_contour::vcgen_contour() :
+        m_stroker(),
+        m_width(1),
         m_src_vertices(),
         m_out_vertices(),
-        m_width(1.0),
-        m_line_join(bevel_join),
-        m_inner_line_join(miter_join_revert),
-        m_approx_scale(1.0),
-        m_abs_width(1.0),
-        m_signed_width(1.0),
-        m_miter_limit(4.0),
-        m_inner_miter_limit(1.0 + 1.0/64.0),
         m_status(initial),
         m_src_vertex(0),
         m_closed(0),
@@ -43,26 +37,15 @@ namespace agg
     {
     }
 
-
     //------------------------------------------------------------------------
     void vcgen_contour::remove_all()
     {
         m_src_vertices.remove_all();
         m_closed = 0;
         m_orientation = 0;
-        m_abs_width = fabs(m_width);
-        m_signed_width = m_width;
         m_status = initial;
     }
 
-
-    //------------------------------------------------------------------------
-    void vcgen_contour::miter_limit_theta(double t)
-    { 
-        m_miter_limit = 1.0 / sin(t * 0.5) ;
-    }
-
-
     //------------------------------------------------------------------------
     void vcgen_contour::add_vertex(double x, double y, unsigned cmd)
     {
@@ -91,14 +74,12 @@ namespace agg
         }
     }
 
-
     //------------------------------------------------------------------------
     void vcgen_contour::rewind(unsigned)
     {
         if(m_status == initial)
         {
             m_src_vertices.close(true);
-            m_signed_width = m_width;
             if(m_auto_detect)
             {
                 if(!is_oriented(m_orientation))
@@ -110,14 +91,13 @@ namespace agg
             }
             if(is_oriented(m_orientation))
             {
-                m_signed_width = is_ccw(m_orientation) ? m_width : -m_width;
+                m_stroker.width(is_ccw(m_orientation) ? m_width : -m_width);
             }
         }
         m_status = ready;
         m_src_vertex = 0;
     }
 
-
     //------------------------------------------------------------------------
     unsigned vcgen_contour::vertex(double* x, double* y)
     {
@@ -146,18 +126,12 @@ namespace agg
                     m_status = end_poly;
                     break;
                 }
-                stroke_calc_join(m_out_vertices, 
-                                 m_src_vertices.prev(m_src_vertex), 
-                                 m_src_vertices.curr(m_src_vertex), 
-                                 m_src_vertices.next(m_src_vertex), 
-                                 m_src_vertices.prev(m_src_vertex).dist,
-                                 m_src_vertices.curr(m_src_vertex).dist,
-                                 m_signed_width, 
-                                 m_line_join,
-                                 m_inner_line_join,
-                                 m_miter_limit,
-                                 m_inner_miter_limit,
-                                 m_approx_scale);
+                m_stroker.calc_join(m_out_vertices, 
+                                    m_src_vertices.prev(m_src_vertex), 
+                                    m_src_vertices.curr(m_src_vertex), 
+                                    m_src_vertices.next(m_src_vertex), 
+                                    m_src_vertices.prev(m_src_vertex).dist,
+                                    m_src_vertices.curr(m_src_vertex).dist);
                 ++m_src_vertex;
                 m_status = out_vertices;
                 m_out_vertex = 0;
@@ -169,7 +143,7 @@ namespace agg
                 }
                 else
                 {
-                    const point_type& c = m_out_vertices[m_out_vertex++];
+                    const point_d& c = m_out_vertices[m_out_vertex++];
                     *x = c.x;
                     *y = c.y;
                     return cmd;
@@ -179,7 +153,7 @@ namespace agg
             case end_poly:
                 if(!m_closed) return path_cmd_stop;
                 m_status = stop;
-                return (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_ccw;
+                return path_cmd_end_poly | path_flags_close | path_flags_ccw;
 
             case stop:
                 return path_cmd_stop;

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_dash.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_dash.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_dash.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_dash.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -169,7 +169,7 @@ namespace agg
                 {
                     double dash_rest = m_dashes[m_curr_dash] - m_curr_dash_start;
 
-                    unsigned _cmd = (m_curr_dash & 1) ? 
+                    unsigned cmd = (m_curr_dash & 1) ? 
                                    path_cmd_move_to : 
                                    path_cmd_line_to;
 
@@ -217,11 +217,9 @@ namespace agg
                             }
                         }
                     }
-                    return _cmd;
+                    return cmd;
                 }
-                
-				// statement unreachable
-				//break;
+                break;
 
             case stop:
                 cmd = path_cmd_stop;

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_markers_term.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_markers_term.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_markers_term.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_markers_term.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -73,9 +73,9 @@ namespace agg
 
 
     //------------------------------------------------------------------------
-    void vcgen_markers_term::rewind(unsigned id)
+    void vcgen_markers_term::rewind(unsigned path_id)
     {
-        m_curr_id = id * 2;
+        m_curr_id = path_id * 2;
         m_curr_idx = m_curr_id;
     }
 

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_smooth_poly1.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_smooth_poly1.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_smooth_poly1.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_smooth_poly1.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -184,8 +184,7 @@ namespace agg
                     m_status = ctrl1;
                     return path_cmd_curve4;
                 }
-				// statement unreachable
-                //break;
+                break;
 
             case ctrl_b:
                 *x = m_ctrl2_x;

Modified: incubator/ooo/trunk/main/agg/source/agg_vcgen_stroke.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vcgen_stroke.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vcgen_stroke.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vcgen_stroke.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -25,16 +25,10 @@ namespace agg
 
     //------------------------------------------------------------------------
     vcgen_stroke::vcgen_stroke() :
+        m_stroker(),
         m_src_vertices(),
         m_out_vertices(),
-        m_width(0.5),
-        m_miter_limit(4.0),
-        m_inner_miter_limit(1.0 + 1.0/64.0),
-        m_approx_scale(1.0),
         m_shorten(0.0),
-        m_line_cap(butt_cap),
-        m_line_join(miter_join),
-        m_inner_line_join(miter_join_revert),
         m_closed(0),
         m_status(initial),
         m_src_vertex(0),
@@ -42,14 +36,6 @@ namespace agg
     {
     }
 
-
-    //------------------------------------------------------------------------
-    void vcgen_stroke::miter_limit_theta(double t)
-    { 
-        m_miter_limit = 1.0 / sin(t * 0.5) ;
-    }
-
-
     //------------------------------------------------------------------------
     void vcgen_stroke::remove_all()
     {
@@ -80,7 +66,6 @@ namespace agg
         }
     }
 
-
     //------------------------------------------------------------------------
     void vcgen_stroke::rewind(unsigned)
     {
@@ -120,13 +105,10 @@ namespace agg
                 break;
 
             case cap1:
-                stroke_calc_cap(m_out_vertices,
-                                m_src_vertices[0], 
-                                m_src_vertices[1], 
-                                m_src_vertices[0].dist,
-                                m_line_cap,
-                                m_width,
-                                m_approx_scale);
+                m_stroker.calc_cap(m_out_vertices,
+                                   m_src_vertices[0], 
+                                   m_src_vertices[1], 
+                                   m_src_vertices[0].dist);
                 m_src_vertex = 1;
                 m_prev_status = outline1;
                 m_status = out_vertices;
@@ -134,13 +116,10 @@ namespace agg
                 break;
 
             case cap2:
-                stroke_calc_cap(m_out_vertices,
-                                m_src_vertices[m_src_vertices.size() - 1], 
-                                m_src_vertices[m_src_vertices.size() - 2], 
-                                m_src_vertices[m_src_vertices.size() - 2].dist,
-                                m_line_cap,
-                                m_width,
-                                m_approx_scale);
+                m_stroker.calc_cap(m_out_vertices,
+                                   m_src_vertices[m_src_vertices.size() - 1], 
+                                   m_src_vertices[m_src_vertices.size() - 2], 
+                                   m_src_vertices[m_src_vertices.size() - 2].dist);
                 m_prev_status = outline2;
                 m_status = out_vertices;
                 m_out_vertex = 0;
@@ -164,18 +143,12 @@ namespace agg
                         break;
                     }
                 }
-                stroke_calc_join(m_out_vertices, 
-                                 m_src_vertices.prev(m_src_vertex), 
-                                 m_src_vertices.curr(m_src_vertex), 
-                                 m_src_vertices.next(m_src_vertex), 
-                                 m_src_vertices.prev(m_src_vertex).dist,
-                                 m_src_vertices.curr(m_src_vertex).dist,
-                                 m_width, 
-                                 m_line_join,
-                                 m_inner_line_join,
-                                 m_miter_limit,
-                                 m_inner_miter_limit,
-                                 m_approx_scale);
+                m_stroker.calc_join(m_out_vertices, 
+                                    m_src_vertices.prev(m_src_vertex), 
+                                    m_src_vertices.curr(m_src_vertex), 
+                                    m_src_vertices.next(m_src_vertex), 
+                                    m_src_vertices.prev(m_src_vertex).dist,
+                                    m_src_vertices.curr(m_src_vertex).dist);
                 ++m_src_vertex;
                 m_prev_status = m_status;
                 m_status = out_vertices;
@@ -195,18 +168,12 @@ namespace agg
                 }
 
                 --m_src_vertex;
-                stroke_calc_join(m_out_vertices,
-                                 m_src_vertices.next(m_src_vertex), 
-                                 m_src_vertices.curr(m_src_vertex), 
-                                 m_src_vertices.prev(m_src_vertex), 
-                                 m_src_vertices.curr(m_src_vertex).dist, 
-                                 m_src_vertices.prev(m_src_vertex).dist,
-                                 m_width, 
-                                 m_line_join,
-                                 m_inner_line_join,
-                                 m_miter_limit,
-                                 m_inner_miter_limit,
-                                 m_approx_scale);
+                m_stroker.calc_join(m_out_vertices,
+                                    m_src_vertices.next(m_src_vertex), 
+                                    m_src_vertices.curr(m_src_vertex), 
+                                    m_src_vertices.prev(m_src_vertex), 
+                                    m_src_vertices.curr(m_src_vertex).dist, 
+                                    m_src_vertices.prev(m_src_vertex).dist);
 
                 m_prev_status = m_status;
                 m_status = out_vertices;
@@ -220,7 +187,7 @@ namespace agg
                 }
                 else
                 {
-                    const point_type& c = m_out_vertices[m_out_vertex++];
+                    const point_d& c = m_out_vertices[m_out_vertex++];
                     *x = c.x;
                     *y = c.y;
                     return cmd;
@@ -229,11 +196,11 @@ namespace agg
 
             case end_poly1:
                 m_status = m_prev_status;
-                return (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_ccw;
+                return path_cmd_end_poly | path_flags_close | path_flags_ccw;
 
             case end_poly2:
                 m_status = m_prev_status;
-                return (unsigned)path_cmd_end_poly | (unsigned)path_flags_close | (unsigned)path_flags_cw;
+                return path_cmd_end_poly | path_flags_close | path_flags_cw;
 
             case stop:
                 cmd = path_cmd_stop;

Modified: incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polygon.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polygon.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polygon.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polygon.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 

Modified: incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polyline.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polyline.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polyline.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vpgen_clip_polyline.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 
@@ -13,19 +13,17 @@
 //          http://www.antigrain.com
 //----------------------------------------------------------------------------
 
-#include <math.h>
 #include "agg_vpgen_clip_polyline.h"
+#include "agg_clip_liang_barsky.h"
 
 namespace agg
 {
-    static double clip_epsilon = 1e-10;
-
-
     //----------------------------------------------------------------------------
     void vpgen_clip_polyline::reset()
     {
         m_vertex = 0;
         m_num_vertices = 0;
+        m_move_to = false;
     }
 
     //----------------------------------------------------------------------------
@@ -33,99 +31,38 @@ namespace agg
     {
         m_vertex = 0;
         m_num_vertices = 0;
-        m_f1 = clipping_flags(x, y);
-        if(m_f1 == 0)
-        {
-            m_x[0] = x;
-            m_y[0] = y;
-            m_cmd[0] = path_cmd_move_to;
-            m_num_vertices = 1;
-        }
         m_x1 = x;
         m_y1 = y;
+        m_move_to = true;
     }
 
-
     //----------------------------------------------------------------------------
-    bool vpgen_clip_polyline::move_point(double& x, double& y, unsigned& flags)
+    void vpgen_clip_polyline::line_to(double x, double y)
     {
-       double bound;
-
-       if(flags & (clip_x1 | clip_x2)) 
-       {
-           bound = (flags & clip_x1) ? m_clip_box.x1 : m_clip_box.x2;
-           y = (bound - m_x1) * (m_y2 - m_y1) / (m_x2 - m_x1) + m_y1;
-           x = bound;
-           flags = clipping_flags_y(y);
-       }
-       if(fabs(m_y2 - m_y1) < clip_epsilon && fabs(m_x2 - m_x1) < clip_epsilon) 
-       {
-           return false;
-       }
-       if(flags & (clip_y1 | clip_y2)) 
-       {
-           bound = (flags & clip_y1) ? m_clip_box.y1 : m_clip_box.y2;
-           x = (bound - m_y1) * (m_x2 - m_x1) / (m_y2 - m_y1) + m_x1;
-           y = bound;
-       }
-       flags = 0;
-       return true;
-    }
+        double x2 = x;
+        double y2 = y;
+        unsigned flags = clip_line_segment(&m_x1, &m_y1, &x2, &y2, m_clip_box);
 
-    //----------------------------------------------------------------------------
-    void vpgen_clip_polyline::clip_line_segment()
-    {
-        if((m_f1 & m_f2) == 0)
+        m_vertex = 0;
+        m_num_vertices = 0;
+        if((flags & 4) == 0)
         {
-            if(m_f1) 
-            {   
-                if(!move_point(m_x1, m_y1, m_f1)) return;
-                if(m_f1) return;
+            if((flags & 1) != 0 || m_move_to)
+            {
                 m_x[0] = m_x1;
                 m_y[0] = m_y1;
                 m_cmd[0] = path_cmd_move_to;
                 m_num_vertices = 1;
             }
-            if(m_f2) 
-            {                    // Move Point 2
-                if(!move_point(m_x2, m_y2, m_f2)) return;
-            }
-            m_x[m_num_vertices] = m_x2;
-            m_y[m_num_vertices] = m_y2;
+            m_x[m_num_vertices] = x2;
+            m_y[m_num_vertices] = y2;
             m_cmd[m_num_vertices++] = path_cmd_line_to;
+            m_move_to = (flags & 2) != 0;
         }
-    }
-
-
-
-    //----------------------------------------------------------------------------
-    void vpgen_clip_polyline::line_to(double x, double y)
-    {
-        m_vertex = 0;
-        m_num_vertices = 0;
-        unsigned f = m_f2 = clipping_flags(m_x2 = x, m_y2 = y);
-
-        if(m_f2 == m_f1)
-        {
-            if(m_f2 == 0)
-            {
-                m_x[0] = x;
-                m_y[0] = y;
-                m_cmd[0] = path_cmd_line_to;
-                m_num_vertices = 1;
-            }
-        }
-        else
-        {
-            clip_line_segment();
-        }
-
-        m_f1 = f;
         m_x1 = x;
         m_y1 = y;
     }
 
-
     //----------------------------------------------------------------------------
     unsigned vpgen_clip_polyline::vertex(double* x, double* y)
     {
@@ -137,6 +74,4 @@ namespace agg
         }
         return path_cmd_stop;
     }
-
-
 }

Modified: incubator/ooo/trunk/main/agg/source/agg_vpgen_segmentator.cpp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/agg_vpgen_segmentator.cpp?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/agg_vpgen_segmentator.cpp (original)
+++ incubator/ooo/trunk/main/agg/source/agg_vpgen_segmentator.cpp Sun Oct 16 04:13:16 2011
@@ -1,5 +1,5 @@
 //----------------------------------------------------------------------------
-// Anti-Grain Geometry - Version 2.3
+// Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
 // Permission to copy, use, modify, sell and distribute this software 

Modified: incubator/ooo/trunk/main/agg/source/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/source/makefile.mk?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/source/makefile.mk (original)
+++ incubator/ooo/trunk/main/agg/source/makefile.mk Sun Oct 16 04:13:16 2011
@@ -50,8 +50,6 @@ SLOFILES= \
 		$(SLO)$/agg_image_filters.obj			\
 		$(SLO)$/agg_line_aa_basics.obj			\
 		$(SLO)$/agg_line_profile_aa.obj			\
-		$(SLO)$/agg_path_storage.obj			\
-		$(SLO)$/agg_rasterizer_scanline_aa.obj	\
 		$(SLO)$/agg_rounded_rect.obj			\
 		$(SLO)$/agg_sqrt_tables.obj				\
 		$(SLO)$/agg_trans_affine.obj			\

Modified: incubator/ooo/trunk/main/configure.in
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/configure.in?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/configure.in (original)
+++ incubator/ooo/trunk/main/configure.in Sun Oct 16 04:13:16 2011
@@ -19,9 +19,9 @@ echo "$@" >config.parms
 AC_ARG_WITH(gnu-patch,
 [  --with-gnu-patch        Specify location of GNU patch on Solaris or FreeBSD
 ],,)
-AC_ARG_WITH(agg,
-[  --without-agg           Disable the use of agg altogether
-],,with_agg=yes)
+AC_ARG_ENABLE(agg,
+[  --enable-agg           Use of agg altogether
+],,)
 AC_ARG_WITH(gnu-cp,
 [  --with-gnu-cp           Specify location of GNU cp on Solaris or FreeBSD
 ],,)
@@ -5098,15 +5098,15 @@ AC_SUBST(OPENSSL_CFLAGS)
 AC_SUBST(OPENSSL_LIBS)
 
 dnl ===================================================================
-dnl Test for disabling agg
+dnl Test for enabling agg
 dnl ===================================================================
 AC_MSG_CHECKING([whether to enable agg])
-if test "$with_agg" = "no"; then
-  AC_MSG_RESULT([no])
-else
+if test "$enable_agg" = "yes"; then
   AC_MSG_RESULT([yes])
-  ENABLE_AGG=YES
   AC_SUBST(ENABLE_AGG)
+else
+  AC_MSG_RESULT([no])
+  ENABLE_AGG=NO
 
   dnl ===================================================================
   dnl Check for system AGG
@@ -5141,7 +5141,7 @@ else
   else
          AC_MSG_RESULT([internal])
          SYSTEM_AGG=NO
-         AGG_VERSION=2300
+         AGG_VERSION=2400
          BUILD_TYPE="$BUILD_TYPE AGG"
   fi
   AC_SUBST(SYSTEM_AGG)

Modified: incubator/ooo/trunk/main/solenv/config/sooo340.ini
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/config/sooo340.ini?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/config/sooo340.ini (original)
+++ incubator/ooo/trunk/main/solenv/config/sooo340.ini Sun Oct 16 04:13:16 2011
@@ -13,7 +13,7 @@ common
             CONFIG_PROJECT config_office
             DIC_ALL TRUE
             ENABLEUNICODE TRUE
-            ENABLE_AGG YES
+            ENABLE_AGG NO
             ENABLE_CUPS TRUE
             ENABLE_DIRECTX TRUE
             ENABLE_FONTCONFIG TRUE



Mime
View raw message