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 [9/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/inc/agg_rasterizer_scanline_aa.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/inc/agg_rasterizer_scanline_aa.h?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/inc/agg_rasterizer_scanline_aa.h (original)
+++ incubator/ooo/trunk/main/agg/inc/agg_rasterizer_scanline_aa.h 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 
@@ -7,6 +7,8 @@
 // This software is provided "as is" without express or implied
 // warranty, and with no claim as to its suitability for any purpose.
 //
+//----------------------------------------------------------------------------
+//
 // The author gratefully acknowleges the support of David Turner, 
 // Robert Wilhelm, and Werner Lemberg - the authors of the FreeType 
 // libray - in producing this work. See http://www.freetype.org for details.
@@ -17,43 +19,24 @@
 //          http://www.antigrain.com
 //----------------------------------------------------------------------------
 //
-// Class rasterizer_scanline_aa
-//         
+// Adaptation for 32-bit screen coordinates has been sponsored by 
+// Liberty Technology Systems, Inc., visit http://lib-sys.com
 //
+// Liberty Technology Systems, Inc. is the provider of
+// PostScript and PDF technology for software developers.
+// 
 //----------------------------------------------------------------------------
 #ifndef AGG_RASTERIZER_SCANLINE_AA_INCLUDED
 #define AGG_RASTERIZER_SCANLINE_AA_INCLUDED
 
-#include <string.h>
-#include <math.h>
-#include "agg_basics.h"
-#include "agg_math.h"
+#include "agg_rasterizer_cells_aa.h"
+#include "agg_rasterizer_sl_clip.h"
 #include "agg_gamma_functions.h"
-#include "agg_clip_liang_barsky.h"
-#include "agg_render_scanlines.h"
 
 
 namespace agg
 {
 
-    //------------------------------------------------------------------------
-    // These constants determine the subpixel accuracy, to be more precise, 
-    // the number of bits of the fractional part of the coordinates. 
-    // The possible coordinate capacity in bits can be calculated by formula:
-    // sizeof(int) * 8 - poly_base_shift * 2, i.e, for 32-bit integers and
-    // 8-bits fractional part the capacity is 16 bits or [-32768...32767].
-    enum
-    {
-        poly_base_shift = 8,                       //----poly_base_shift
-        poly_base_size  = 1 << poly_base_shift,    //----poly_base_size 
-        poly_base_mask  = poly_base_size - 1       //----poly_base_mask 
-    };
-    
-    //--------------------------------------------------------------poly_coord
-    inline int poly_coord(double c)
-    {
-        return int(c * poly_base_size);
-    }
 
     //-----------------------------------------------------------------cell_aa
     // A pixel cell. There're no constructors defined and it was done 
@@ -61,90 +44,25 @@ namespace agg
     // array of cells.
     struct cell_aa
     {
-        int16 x;
-        int16 y;
-        int   packed_coord;
-        int   cover;
-        int   area;
-
-        void set(int x, int y, int c, int a);
-        void set_coord(int x, int y);
-        void set_cover(int c, int a);
-        void add_cover(int c, int a);
-    };
-
-
-    //--------------------------------------------------------------outline_aa
-    // An internal class that implements the main rasterization algorithm.
-    // Used in the rasterizer. Should not be used direcly.
-    class outline_aa
-    {
-        enum
-        {
-            cell_block_shift = 12,
-            cell_block_size  = 1 << cell_block_shift,
-            cell_block_mask  = cell_block_size - 1,
-            cell_block_pool  = 256,
-            cell_block_limit = 1024
-        };
-
-    public:
-
-        ~outline_aa();
-        outline_aa();
+        int x;
+        int y;
+        int cover;
+        int area;
 
-        void reset();
-
-        void move_to(int x, int y);
-        void line_to(int x, int y);
-
-        int min_x() const { return m_min_x; }
-        int min_y() const { return m_min_y; }
-        int max_x() const { return m_max_x; }
-        int max_y() const { return m_max_y; }
-
-        const cell_aa* const* cells();
-        unsigned num_cells() { cells(); return m_num_cells; }
-        bool sorted() const { return m_sorted; }
-
-    private:
-        outline_aa(const outline_aa&);
-        const outline_aa& operator = (const outline_aa&);
-
-        void set_cur_cell(int x, int y);
-        void add_cur_cell();
-        void sort_cells();
-        void render_hline(int ey, int x1, int y1, int x2, int y2);
-        void render_line(int x1, int y1, int x2, int y2);
-        void allocate_block();
-        
-        static void qsort_cells(cell_aa** start, unsigned num);
-
-    private:
-        unsigned  m_num_blocks;
-        unsigned  m_max_blocks;
-        unsigned  m_cur_block;
-        unsigned  m_num_cells;
-        cell_aa** m_cells;
-        cell_aa*  m_cur_cell_ptr;
-        cell_aa** m_sorted_cells;
-        unsigned  m_sorted_size;
-        cell_aa   m_cur_cell;
-        int       m_cur_x;
-        int       m_cur_y;
-        int       m_min_x;
-        int       m_min_y;
-        int       m_max_x;
-        int       m_max_y;
-        bool      m_sorted;
-    };
+        void initial()
+        {
+            x = 0x7FFFFFFF;
+            y = 0x7FFFFFFF;
+            cover = 0;
+            area  = 0;
+        }
 
+        void style(const cell_aa&) {}
 
-    //----------------------------------------------------------filling_rule_e
-    enum filling_rule_e
-    {
-        fill_non_zero,
-        fill_even_odd
+        int not_equal(int ex, int ey, const cell_aa&) const
+        {
+            return (ex - x) | (ey - y);
+        }
     };
 
 
@@ -152,7 +70,7 @@ namespace agg
     // Polygon rasterizer that is used to render filled polygons with 
     // high-quality Anti-Aliasing. Internally, by default, the class uses 
     // integer coordinates in format 24.8, i.e. 24 bits for integer part 
-    // and 8 bits for fractional - see poly_base_shift. This class can be 
+    // and 8 bits for fractional - see poly_subpixel_shift. This class can be 
     // used in the following  way:
     //
     // 1. filling_rule(filling_rule_e ft) - optional.
@@ -179,79 +97,72 @@ namespace agg
     //
     // filling_rule() and gamma() can be called anytime before "sweeping".
     //------------------------------------------------------------------------
-    template<unsigned XScale=1, unsigned AA_Shift=8> class rasterizer_scanline_aa
+    template<class Clip=rasterizer_sl_clip_int> class rasterizer_scanline_aa
     {
         enum status
         {
             status_initial,
+            status_move_to,
             status_line_to,
             status_closed
         };
 
-        struct iterator
-        {
-            const cell_aa* const* cells;
-            int                   cover;
-            int                   last_y;
-        };
-
     public:
-        enum
-        {
-            aa_shift = AA_Shift,
-            aa_num   = 1 << aa_shift,
-            aa_mask  = aa_num - 1,
-            aa_2num  = aa_num * 2,
-            aa_2mask = aa_2num - 1
+        typedef Clip                      clip_type;
+        typedef typename Clip::conv_type  conv_type;
+        typedef typename Clip::coord_type coord_type;
+
+        enum aa_scale_e
+        {
+            aa_shift  = 8,
+            aa_scale  = 1 << aa_shift,
+            aa_mask   = aa_scale - 1,
+            aa_scale2 = aa_scale * 2,
+            aa_mask2  = aa_scale2 - 1
         };
 
         //--------------------------------------------------------------------
         rasterizer_scanline_aa() : 
+            m_outline(),
+            m_clipper(),
             m_filling_rule(fill_non_zero),
-            m_clipped_start_x(0),
-            m_clipped_start_y(0),
+            m_auto_close(true),
             m_start_x(0),
             m_start_y(0),
-            m_prev_x(0),
-            m_prev_y(0),
-            m_prev_flags(0),
-            m_status(status_initial),
-            m_clipping(false)
+            m_status(status_initial)
         {
             int i;
-            for(i = 0; i < aa_num; i++) m_gamma[i] = i;
+            for(i = 0; i < aa_scale; i++) m_gamma[i] = i;
         }
 
         //--------------------------------------------------------------------
         template<class GammaF> 
         rasterizer_scanline_aa(const GammaF& gamma_function) : 
+            m_outline(),
+            m_clipper(m_outline),
             m_filling_rule(fill_non_zero),
-            m_clipped_start_x(0),
-            m_clipped_start_y(0),
+            m_auto_close(true),
             m_start_x(0),
             m_start_y(0),
-            m_prev_x(0),
-            m_prev_y(0),
-            m_prev_flags(0),
-            m_status(status_initial),
-            m_clipping(false)
+            m_status(status_initial)
         {
             gamma(gamma_function);
         }
 
         //--------------------------------------------------------------------
         void reset(); 
-        void filling_rule(filling_rule_e filling_rule);
-        void clip_box(double x1, double y1, double x2, double y2);
         void reset_clipping();
+        void clip_box(double x1, double y1, double x2, double y2);
+        void filling_rule(filling_rule_e filling_rule);
+        void auto_close(bool flag) { m_auto_close = flag; }
 
         //--------------------------------------------------------------------
         template<class GammaF> void gamma(const GammaF& gamma_function)
         { 
             int i;
-            for(i = 0; i < aa_num; i++)
+            for(i = 0; i < aa_scale; i++)
             {
-                m_gamma[i] = int(floor(gamma_function(double(i) / aa_mask) * aa_mask + 0.5));
+                m_gamma[i] = uround(gamma_function(double(i) / aa_mask) * aa_mask);
             }
         }
 
@@ -262,12 +173,31 @@ namespace agg
         }
 
         //--------------------------------------------------------------------
-        void add_vertex(double x, double y, unsigned cmd);
         void move_to(int x, int y);
         void line_to(int x, int y);
-        void close_polygon();
         void move_to_d(double x, double y);
         void line_to_d(double x, double y);
+        void close_polygon();
+        void add_vertex(double x, double y, unsigned cmd);
+
+        void edge(int x1, int y1, int x2, int y2);
+        void edge_d(double x1, double y1, double x2, double y2);
+
+        //-------------------------------------------------------------------
+        template<class VertexSource>
+        void add_path(VertexSource& vs, unsigned path_id=0)
+        {
+            double x;
+            double y;
+
+            unsigned cmd;
+            vs.rewind(path_id);
+            if(m_outline.sorted()) reset();
+            while(!is_stop(cmd = vs.vertex(&x, &y)))
+            {
+                add_vertex(x, y, cmd);
+            }
+        }
         
         //--------------------------------------------------------------------
         int min_x() const { return m_outline.min_x(); }
@@ -276,17 +206,22 @@ namespace agg
         int max_y() const { return m_outline.max_y(); }
 
         //--------------------------------------------------------------------
+        void sort();
+        bool rewind_scanlines();
+        bool navigate_scanline(int y);
+
+        //--------------------------------------------------------------------
         AGG_INLINE unsigned calculate_alpha(int area) const
         {
-            int cover = area >> (poly_base_shift*2 + 1 - aa_shift);
+            int cover = area >> (poly_subpixel_shift*2 + 1 - aa_shift);
 
             if(cover < 0) cover = -cover;
             if(m_filling_rule == fill_even_odd)
             {
-                cover &= aa_2mask;
-                if(cover > aa_num)
+                cover &= aa_mask2;
+                if(cover > aa_scale)
                 {
-                    cover = aa_2num - cover;
+                    cover = aa_scale2 - cover;
                 }
             }
             if(cover > aa_mask) cover = aa_mask;
@@ -294,164 +229,84 @@ namespace agg
         }
 
         //--------------------------------------------------------------------
-        void sort()
-        {
-            m_outline.cells();
-        }
-
-
-        //--------------------------------------------------------------------
-        bool rewind_scanlines()
-        {
-            close_polygon();
-            m_iterator.cells = m_outline.cells();
-            if(m_outline.num_cells() == 0) 
-            {
-                return false;
-            }
-            m_iterator.cover  = 0;
-            m_iterator.last_y = (*m_iterator.cells)->y;
-            return true;
-        }
-
-
-        //--------------------------------------------------------------------
         template<class Scanline> bool sweep_scanline(Scanline& sl)
         {
-            sl.reset_spans();
             for(;;)
             {
-                const cell_aa* cur_cell = *m_iterator.cells;
-                if(cur_cell == 0) return false;
-                ++m_iterator.cells;
-                m_iterator.last_y = cur_cell->y;
+                if(m_scan_y > m_outline.max_y()) return false;
+                sl.reset_spans();
+                unsigned num_cells = m_outline.scanline_num_cells(m_scan_y);
+                const cell_aa* const* cells = m_outline.scanline_cells(m_scan_y);
+                int cover = 0;
+
+                while(num_cells)
+                {
+                    const cell_aa* cur_cell = *cells;
+                    int x    = cur_cell->x;
+                    int area = cur_cell->area;
+                    unsigned alpha;
 
-                for(;;)
-                {
-                    int coord  = cur_cell->packed_coord;
-                    int area   = cur_cell->area; 
-                    int last_x = cur_cell->x;
-
-                    m_iterator.cover += cur_cell->cover;
+                    cover += cur_cell->cover;
 
-                    //accumulate all cells with the same coordinates
-                    for(; (cur_cell = *m_iterator.cells) != 0; ++m_iterator.cells)
+                    //accumulate all cells with the same X
+                    while(--num_cells)
                     {
-                        if(cur_cell->packed_coord != coord) break;
-                        area             += cur_cell->area;
-                        m_iterator.cover += cur_cell->cover;
+                        cur_cell = *++cells;
+                        if(cur_cell->x != x) break;
+                        area  += cur_cell->area;
+                        cover += cur_cell->cover;
                     }
 
-                    int alpha;
-                    if(cur_cell == 0 || cur_cell->y != m_iterator.last_y)
-                    {
-
-                        if(area)
-                        {
-                            alpha = calculate_alpha((m_iterator.cover << (poly_base_shift + 1)) - area);
-                            if(alpha)
-                            {
-                                sl.add_cell(last_x, alpha);
-                            }
-                            ++last_x;
-                        }
-                        break;
-                    }
-
-                    ++m_iterator.cells;
-
                     if(area)
                     {
-                        alpha = calculate_alpha((m_iterator.cover << (poly_base_shift + 1)) - area);
+                        alpha = calculate_alpha((cover << (poly_subpixel_shift + 1)) - area);
                         if(alpha)
                         {
-                            sl.add_cell(last_x, alpha);
+                            sl.add_cell(x, alpha);
                         }
-                        ++last_x;
+                        x++;
                     }
 
-                    if(cur_cell->x > last_x)
+                    if(num_cells && cur_cell->x > x)
                     {
-                        alpha = calculate_alpha(m_iterator.cover << (poly_base_shift + 1));
+                        alpha = calculate_alpha(cover << (poly_subpixel_shift + 1));
                         if(alpha)
                         {
-                            sl.add_span(last_x, cur_cell->x - last_x, alpha);
+                            sl.add_span(x, cur_cell->x - x, alpha);
                         }
                     }
                 }
-                if(sl.num_spans()) 
-                {
-                    sl.finalize(m_iterator.last_y);
-                    break;
-                }
+        
+                if(sl.num_spans()) break;
+                ++m_scan_y;
             }
+
+            sl.finalize(m_scan_y);
+            ++m_scan_y;
             return true;
         }
 
-
         //--------------------------------------------------------------------
         bool hit_test(int tx, int ty);
 
 
-        //--------------------------------------------------------------------
-        void add_xy(const double* x, const double* y, unsigned n)
-        {
-            if(n > 2)
-            {
-                move_to_d(*x++, *y++);
-                --n;
-                do
-                {
-                    line_to_d(*x++, *y++);
-                }
-                while(--n);
-            }
-        }
-
-        //-------------------------------------------------------------------
-        template<class VertexSource>
-        void add_path(VertexSource& vs, unsigned id=0)
-        {
-            double x;
-            double y;
-
-            unsigned cmd;
-            vs.rewind(id);
-            while(!is_stop(cmd = vs.vertex(&x, &y)))
-            {
-                add_vertex(x, y, cmd);
-            }
-        }
-
-
     private:
         //--------------------------------------------------------------------
         // Disable copying
-        rasterizer_scanline_aa(const rasterizer_scanline_aa<XScale, AA_Shift>&);
-        const rasterizer_scanline_aa<XScale, AA_Shift>& 
-            operator = (const rasterizer_scanline_aa<XScale, AA_Shift>&);
-
-        //--------------------------------------------------------------------
-        void move_to_no_clip(int x, int y);
-        void line_to_no_clip(int x, int y);
-        void close_polygon_no_clip();
-        void clip_segment(int x, int y);
+        rasterizer_scanline_aa(const rasterizer_scanline_aa<Clip>&);
+        const rasterizer_scanline_aa<Clip>& 
+        operator = (const rasterizer_scanline_aa<Clip>&);
 
     private:
-        outline_aa     m_outline;
-        int            m_gamma[aa_num];
+        rasterizer_cells_aa<cell_aa> m_outline;
+        clip_type      m_clipper;
+        int            m_gamma[aa_scale];
         filling_rule_e m_filling_rule;
-        int            m_clipped_start_x;
-        int            m_clipped_start_y;
-        int            m_start_x;
-        int            m_start_y;
-        int            m_prev_x;
-        int            m_prev_y;
-        unsigned       m_prev_flags;
+        bool           m_auto_close;
+        coord_type     m_start_x;
+        coord_type     m_start_y;
         unsigned       m_status;
-        rect           m_clip_box;
-        bool           m_clipping;
-        iterator       m_iterator;
+        int            m_scan_y;
     };
 
 
@@ -463,277 +318,189 @@ namespace agg
 
 
 
+
+
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::reset() 
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::reset() 
     { 
         m_outline.reset(); 
         m_status = status_initial;
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::filling_rule(filling_rule_e _filling_rule) 
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::filling_rule(filling_rule_e filling_rule) 
     { 
-        m_filling_rule = _filling_rule; 
+        m_filling_rule = filling_rule; 
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::clip_box(double x1, double y1, double x2, double y2)
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::clip_box(double x1, double y1, 
+                                                double x2, double y2)
     {
         reset();
-        m_clip_box = rect(poly_coord(x1), poly_coord(y1),
-                          poly_coord(x2), poly_coord(y2));
-        m_clip_box.normalize();
-        m_clipping = true;
+        m_clipper.clip_box(conv_type::upscale(x1), conv_type::upscale(y1), 
+                           conv_type::upscale(x2), conv_type::upscale(y2));
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::reset_clipping()
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::reset_clipping()
     {
         reset();
-        m_clipping = false;
+        m_clipper.reset_clipping();
     }
 
-
-
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::move_to_no_clip(int x, int y)
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::close_polygon()
     {
         if(m_status == status_line_to)
         {
-            close_polygon_no_clip();
+            m_clipper.line_to(m_outline, m_start_x, m_start_y);
+            m_status = status_closed;
         }
-        m_outline.move_to(x * XScale, y); 
-        m_clipped_start_x = x;
-        m_clipped_start_y = y;
-        m_status = status_line_to;
     }
 
-
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::line_to_no_clip(int x, int y)
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::move_to(int x, int y)
     {
-        if(m_status != status_initial)
-        {
-            m_outline.line_to(x * XScale, y); 
-            m_status = status_line_to;
-        }
+        if(m_outline.sorted()) reset();
+        if(m_auto_close) close_polygon();
+        m_clipper.move_to(m_start_x = conv_type::downscale(x), 
+                          m_start_y = conv_type::downscale(y));
+        m_status = status_move_to;
     }
 
-
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::close_polygon_no_clip()
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::line_to(int x, int y)
     {
-        if(m_status == status_line_to)
-        {
-            m_outline.line_to(m_clipped_start_x * XScale, m_clipped_start_y);
-            m_status = status_closed;
-        }
+        m_clipper.line_to(m_outline, 
+                          conv_type::downscale(x), 
+                          conv_type::downscale(y));
+        m_status = status_line_to;
     }
 
-
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::clip_segment(int x, int y) 
-    {
-        unsigned flags = clipping_flags(x, y, m_clip_box);
-        if(m_prev_flags == flags)
-        {
-            if(flags == 0)
-            {
-                if(m_status == status_initial)
-                {
-                    move_to_no_clip(x, y);
-                }
-                else
-                {
-                    line_to_no_clip(x, y);
-                }
-            }
-        }
-        else
-        {
-            int cx[4];
-            int cy[4];
-            unsigned n = clip_liang_barsky(m_prev_x, m_prev_y, 
-                                           x, y, 
-                                           m_clip_box, 
-                                           cx, cy);
-            const int* px = cx;
-            const int* py = cy;
-            while(n--)
-            {
-                if(m_status == status_initial)
-                {
-                    move_to_no_clip(*px++, *py++);
-                }
-                else
-                {
-                    line_to_no_clip(*px++, *py++);
-                }
-            }
-        }
-        m_prev_flags = flags;
-        m_prev_x = x;
-        m_prev_y = y;
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::move_to_d(double x, double y) 
+    { 
+        if(m_outline.sorted()) reset();
+        if(m_auto_close) close_polygon();
+        m_clipper.move_to(m_start_x = conv_type::upscale(x), 
+                          m_start_y = conv_type::upscale(y)); 
+        m_status = status_move_to;
     }
 
-
+    //------------------------------------------------------------------------
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::line_to_d(double x, double y) 
+    { 
+        m_clipper.line_to(m_outline, 
+                          conv_type::upscale(x), 
+                          conv_type::upscale(y)); 
+        m_status = status_line_to;
+    }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::add_vertex(double x, double y, unsigned cmd)
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::add_vertex(double x, double y, unsigned cmd)
     {
-        if(is_close(cmd))
+        if(is_move_to(cmd)) 
         {
-            close_polygon();
+            move_to_d(x, y);
         }
-        else
-        {
-            if(is_move_to(cmd)) 
-            {
-                move_to(poly_coord(x), poly_coord(y));
-            }
-            else 
-            {
-                if(is_vertex(cmd))
-                {
-                    line_to(poly_coord(x), poly_coord(y));
-                }
-            }
-        }
-    }
-
-
-
-    //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::move_to(int x, int y) 
-    { 
-        if(m_clipping)
+        else 
+        if(is_vertex(cmd))
         {
-            if(m_outline.sorted()) 
-            {
-                reset();
-            }
-            if(m_status == status_line_to)
-            {
-                close_polygon();
-            }
-            m_prev_x = m_start_x = x;
-            m_prev_y = m_start_y = y;
-            m_status = status_initial;
-            m_prev_flags = clipping_flags(x, y, m_clip_box);
-            if(m_prev_flags == 0)
-            {
-                move_to_no_clip(x, y);
-            }
+            line_to_d(x, y);
         }
         else
+        if(is_close(cmd))
         {
-            move_to_no_clip(x, y);
+            close_polygon();
         }
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::line_to(int x, int y) 
-    { 
-        if(m_clipping)
-        {
-            clip_segment(x, y);
-        }
-        else
-        {
-            line_to_no_clip(x, y);
-        }
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::edge(int x1, int y1, int x2, int y2)
+    {
+        if(m_outline.sorted()) reset();
+        m_clipper.move_to(conv_type::downscale(x1), conv_type::downscale(y1));
+        m_clipper.line_to(m_outline, 
+                          conv_type::downscale(x2), 
+                          conv_type::downscale(y2));
+        m_status = status_move_to;
     }
-
+    
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::close_polygon() 
-    { 
-        if(m_clipping)
-        {
-            clip_segment(m_start_x, m_start_y);
-        }
-        close_polygon_no_clip();
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::edge_d(double x1, double y1, 
+                                              double x2, double y2)
+    {
+        if(m_outline.sorted()) reset();
+        m_clipper.move_to(conv_type::upscale(x1), conv_type::upscale(y1)); 
+        m_clipper.line_to(m_outline, 
+                          conv_type::upscale(x2), 
+                          conv_type::upscale(y2)); 
+        m_status = status_move_to;
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::move_to_d(double x, double y) 
-    { 
-        move_to(poly_coord(x), poly_coord(y)); 
+    template<class Clip> 
+    void rasterizer_scanline_aa<Clip>::sort()
+    {
+        if(m_auto_close) close_polygon();
+        m_outline.sort_cells();
     }
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    void rasterizer_scanline_aa<XScale, AA_Shift>::line_to_d(double x, double y) 
-    { 
-        line_to(poly_coord(x), poly_coord(y)); 
+    template<class Clip> 
+    AGG_INLINE bool rasterizer_scanline_aa<Clip>::rewind_scanlines()
+    {
+        if(m_auto_close) close_polygon();
+        m_outline.sort_cells();
+        if(m_outline.total_cells() == 0) 
+        {
+            return false;
+        }
+        m_scan_y = m_outline.min_y();
+        return true;
     }
 
 
     //------------------------------------------------------------------------
-    template<unsigned XScale, unsigned AA_Shift> 
-    bool rasterizer_scanline_aa<XScale, AA_Shift>::hit_test(int tx, int ty)
+    template<class Clip> 
+    AGG_INLINE bool rasterizer_scanline_aa<Clip>::navigate_scanline(int y)
     {
-        close_polygon();
-        const cell_aa* const* cells = m_outline.cells();
-        if(m_outline.num_cells() == 0) return false;
-
-        int cover = 0;
-
-        const cell_aa* cur_cell = *cells++;
-        for(;;)
+        if(m_auto_close) close_polygon();
+        m_outline.sort_cells();
+        if(m_outline.total_cells() == 0 || 
+           y < m_outline.min_y() || 
+           y > m_outline.max_y()) 
         {
-            int alpha;
-            int coord  = cur_cell->packed_coord;
-            int x = cur_cell->x;
-            int y = cur_cell->y;
-
-            if(y > ty) return false;
-
-            int area   = cur_cell->area;
-            cover     += cur_cell->cover;
-
-            while((cur_cell = *cells++) != 0)
-            {
-                if(cur_cell->packed_coord != coord) break;
-                area  += cur_cell->area;
-                cover += cur_cell->cover;
-            }
+            return false;
+        }
+        m_scan_y = y;
+        return true;
+    }
 
-            if(area)
-            {
-                alpha = calculate_alpha((cover << (poly_base_shift + 1)) - area);
-                if(alpha)
-                {
-                    if(tx == x && ty == y) return true;
-                }
-                x++;
-            }
+    //------------------------------------------------------------------------
+    template<class Clip> 
+    bool rasterizer_scanline_aa<Clip>::hit_test(int tx, int ty)
+    {
+        if(!navigate_scanline(ty)) return false;
+        scanline_hit_test sl(tx);
+        sweep_scanline(sl);
+        return sl.hit();
+    }
 
-            if(!cur_cell) break;
 
-            if(cur_cell->x > x)
-            {
-                alpha = calculate_alpha(cover << (poly_base_shift + 1));
-                if(alpha)
-                {
-                    if(ty == y && tx >= x && tx <= cur_cell->x) return true;
-                }
-            }
-        }
-        return false;
-    }
 
 }
 

Added: incubator/ooo/trunk/main/agg/inc/agg_rasterizer_sl_clip.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/inc/agg_rasterizer_sl_clip.h?rev=1184758&view=auto
==============================================================================
--- incubator/ooo/trunk/main/agg/inc/agg_rasterizer_sl_clip.h (added)
+++ incubator/ooo/trunk/main/agg/inc/agg_rasterizer_sl_clip.h Sun Oct 16 04:13:16 2011
@@ -0,0 +1,351 @@
+//----------------------------------------------------------------------------
+// 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 
+// is granted provided this copyright notice appears in all copies. 
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+//----------------------------------------------------------------------------
+// Contact: mcseem@antigrain.com
+//          mcseemagg@yahoo.com
+//          http://www.antigrain.com
+//----------------------------------------------------------------------------
+#ifndef AGG_RASTERIZER_SL_CLIP_INCLUDED
+#define AGG_RASTERIZER_SL_CLIP_INCLUDED
+
+#include "agg_clip_liang_barsky.h"
+
+namespace agg
+{
+    //--------------------------------------------------------poly_max_coord_e
+    enum poly_max_coord_e
+    {
+        poly_max_coord = (1 << 30) - 1 //----poly_max_coord
+    };
+    
+    //------------------------------------------------------------ras_conv_int
+    struct ras_conv_int
+    {
+        typedef int coord_type;
+        static AGG_INLINE int mul_div(double a, double b, double c)
+        {
+            return iround(a * b / c);
+        }
+        static int xi(int v) { return v; }
+        static int yi(int v) { return v; }
+        static int upscale(double v) { return iround(v * poly_subpixel_scale); }
+        static int downscale(int v)  { return v; }
+    };
+
+    //--------------------------------------------------------ras_conv_int_sat
+    struct ras_conv_int_sat
+    {
+        typedef int coord_type;
+        static AGG_INLINE int mul_div(double a, double b, double c)
+        {
+            return saturation<poly_max_coord>::iround(a * b / c);
+        }
+        static int xi(int v) { return v; }
+        static int yi(int v) { return v; }
+        static int upscale(double v) 
+        { 
+            return saturation<poly_max_coord>::iround(v * poly_subpixel_scale); 
+        }
+        static int downscale(int v) { return v; }
+    };
+
+    //---------------------------------------------------------ras_conv_int_3x
+    struct ras_conv_int_3x
+    {
+        typedef int coord_type;
+        static AGG_INLINE int mul_div(double a, double b, double c)
+        {
+            return iround(a * b / c);
+        }
+        static int xi(int v) { return v * 3; }
+        static int yi(int v) { return v; }
+        static int upscale(double v) { return iround(v * poly_subpixel_scale); }
+        static int downscale(int v)  { return v; }
+    };
+
+    //-----------------------------------------------------------ras_conv_dbl
+    struct ras_conv_dbl
+    {
+        typedef double coord_type;
+        static AGG_INLINE double mul_div(double a, double b, double c)
+        {
+            return a * b / c;
+        }
+        static int xi(double v) { return iround(v * poly_subpixel_scale); }
+        static int yi(double v) { return iround(v * poly_subpixel_scale); }
+        static double upscale(double v) { return v; }
+        static double downscale(int v)  { return v / double(poly_subpixel_scale); }
+    };
+
+    //--------------------------------------------------------ras_conv_dbl_3x
+    struct ras_conv_dbl_3x
+    {
+        typedef double coord_type;
+        static AGG_INLINE double mul_div(double a, double b, double c)
+        {
+            return a * b / c;
+        }
+        static int xi(double v) { return iround(v * poly_subpixel_scale * 3); }
+        static int yi(double v) { return iround(v * poly_subpixel_scale); }
+        static double upscale(double v) { return v; }
+        static double downscale(int v)  { return v / double(poly_subpixel_scale); }
+    };
+
+
+
+
+
+    //------------------------------------------------------rasterizer_sl_clip
+    template<class Conv> class rasterizer_sl_clip
+    {
+    public:
+        typedef Conv                      conv_type;
+        typedef typename Conv::coord_type coord_type;
+        typedef rect_base<coord_type>     rect_type;
+
+        //--------------------------------------------------------------------
+        rasterizer_sl_clip() :  
+            m_clip_box(0,0,0,0),
+            m_x1(0),
+            m_y1(0),
+            m_f1(0),
+            m_clipping(false) 
+        {}
+
+        //--------------------------------------------------------------------
+        void reset_clipping()
+        {
+            m_clipping = false;
+        }
+
+        //--------------------------------------------------------------------
+        void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2)
+        {
+            m_clip_box = rect_type(x1, y1, x2, y2);
+            m_clip_box.normalize();
+            m_clipping = true;
+        }
+
+        //--------------------------------------------------------------------
+        void move_to(coord_type x1, coord_type y1)
+        {
+            m_x1 = x1;
+            m_y1 = y1;
+            if(m_clipping) m_f1 = clipping_flags(x1, y1, m_clip_box);
+        }
+
+    private:
+        //------------------------------------------------------------------------
+        template<class Rasterizer>
+        AGG_INLINE void line_clip_y(Rasterizer& ras,
+                                    coord_type x1, coord_type y1, 
+                                    coord_type x2, coord_type y2, 
+                                    unsigned   f1, unsigned   f2) const
+        {
+            f1 &= 10;
+            f2 &= 10;
+            if((f1 | f2) == 0)
+            {
+                // Fully visible
+                ras.line(Conv::xi(x1), Conv::yi(y1), Conv::xi(x2), Conv::yi(y2)); 
+            }
+            else
+            {
+                if(f1 == f2)
+                {
+                    // Invisible by Y
+                    return;
+                }
+
+                coord_type tx1 = x1;
+                coord_type ty1 = y1;
+                coord_type tx2 = x2;
+                coord_type ty2 = y2;
+
+                if(f1 & 8) // y1 < clip.y1
+                {
+                    tx1 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1);
+                    ty1 = m_clip_box.y1;
+                }
+
+                if(f1 & 2) // y1 > clip.y2
+                {
+                    tx1 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1);
+                    ty1 = m_clip_box.y2;
+                }
+
+                if(f2 & 8) // y2 < clip.y1
+                {
+                    tx2 = x1 + Conv::mul_div(m_clip_box.y1-y1, x2-x1, y2-y1);
+                    ty2 = m_clip_box.y1;
+                }
+
+                if(f2 & 2) // y2 > clip.y2
+                {
+                    tx2 = x1 + Conv::mul_div(m_clip_box.y2-y1, x2-x1, y2-y1);
+                    ty2 = m_clip_box.y2;
+                }
+                ras.line(Conv::xi(tx1), Conv::yi(ty1), 
+                         Conv::xi(tx2), Conv::yi(ty2)); 
+            }
+        }
+
+
+    public:
+        //--------------------------------------------------------------------
+        template<class Rasterizer>
+        void line_to(Rasterizer& ras, coord_type x2, coord_type y2)
+        {
+            if(m_clipping)
+            {
+                unsigned f2 = clipping_flags(x2, y2, m_clip_box);
+
+                if((m_f1 & 10) == (f2 & 10) && (m_f1 & 10) != 0)
+                {
+                    // Invisible by Y
+                    m_x1 = x2;
+                    m_y1 = y2;
+                    m_f1 = f2;
+                    return;
+                }
+
+                coord_type x1 = m_x1;
+                coord_type y1 = m_y1;
+                unsigned   f1 = m_f1;
+                coord_type y3, y4;
+                unsigned   f3, f4;
+
+                switch(((f1 & 5) << 1) | (f2 & 5))
+                {
+                case 0: // Visible by X
+                    line_clip_y(ras, x1, y1, x2, y2, f1, f2);
+                    break;
+
+                case 1: // x2 > clip.x2
+                    y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    line_clip_y(ras, x1, y1, m_clip_box.x2, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x2, y3, m_clip_box.x2, y2, f3, f2);
+                    break;
+
+                case 2: // x1 > clip.x2
+                    y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x2, y3, x2, y2, f3, f2);
+                    break;
+
+                case 3: // x1 > clip.x2 && x2 > clip.x2
+                    line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y2, f1, f2);
+                    break;
+
+                case 4: // x2 < clip.x1
+                    y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    line_clip_y(ras, x1, y1, m_clip_box.x1, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x1, y3, m_clip_box.x1, y2, f3, f2);
+                    break;
+
+                case 6: // x1 > clip.x2 && x2 < clip.x1
+                    y3 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1);
+                    y4 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    f4 = clipping_flags_y(y4, m_clip_box);
+                    line_clip_y(ras, m_clip_box.x2, y1, m_clip_box.x2, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x2, y3, m_clip_box.x1, y4, f3, f4);
+                    line_clip_y(ras, m_clip_box.x1, y4, m_clip_box.x1, y2, f4, f2);
+                    break;
+
+                case 8: // x1 < clip.x1
+                    y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x1, y3, x2, y2, f3, f2);
+                    break;
+
+                case 9:  // x1 < clip.x1 && x2 > clip.x2
+                    y3 = y1 + Conv::mul_div(m_clip_box.x1-x1, y2-y1, x2-x1);
+                    y4 = y1 + Conv::mul_div(m_clip_box.x2-x1, y2-y1, x2-x1);
+                    f3 = clipping_flags_y(y3, m_clip_box);
+                    f4 = clipping_flags_y(y4, m_clip_box);
+                    line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y3, f1, f3);
+                    line_clip_y(ras, m_clip_box.x1, y3, m_clip_box.x2, y4, f3, f4);
+                    line_clip_y(ras, m_clip_box.x2, y4, m_clip_box.x2, y2, f4, f2);
+                    break;
+
+                case 12: // x1 < clip.x1 && x2 < clip.x1
+                    line_clip_y(ras, m_clip_box.x1, y1, m_clip_box.x1, y2, f1, f2);
+                    break;
+                }
+                m_f1 = f2;
+            }
+            else
+            {
+                ras.line(Conv::xi(m_x1), Conv::yi(m_y1), 
+                         Conv::xi(x2),   Conv::yi(y2)); 
+            }
+            m_x1 = x2;
+            m_y1 = y2;
+        }
+
+
+    private:
+        rect_type        m_clip_box;
+        coord_type       m_x1;
+        coord_type       m_y1;
+        unsigned         m_f1;
+        bool             m_clipping;
+    };
+
+
+
+
+    //---------------------------------------------------rasterizer_sl_no_clip
+    class rasterizer_sl_no_clip
+    {
+    public:
+        typedef ras_conv_int conv_type;
+        typedef int          coord_type;
+
+        rasterizer_sl_no_clip() : m_x1(0), m_y1(0) {}
+
+        void reset_clipping() {}
+        void clip_box(coord_type x1, coord_type y1, coord_type x2, coord_type y2) {}
+        void move_to(coord_type x1, coord_type y1) { m_x1 = x1; m_y1 = y1; }
+
+        template<class Rasterizer>
+        void line_to(Rasterizer& ras, coord_type x2, coord_type y2) 
+        { 
+            ras.line(m_x1, m_y1, x2, y2); 
+            m_x1 = x2; 
+            m_y1 = y2;
+        }
+
+    private:
+        int m_x1, m_y1;
+    };
+
+
+    //                                         -----rasterizer_sl_clip_int
+    //                                         -----rasterizer_sl_clip_int_sat
+    //                                         -----rasterizer_sl_clip_int_3x
+    //                                         -----rasterizer_sl_clip_dbl
+    //                                         -----rasterizer_sl_clip_dbl_3x
+    //------------------------------------------------------------------------
+    typedef rasterizer_sl_clip<ras_conv_int>     rasterizer_sl_clip_int;
+    typedef rasterizer_sl_clip<ras_conv_int_sat> rasterizer_sl_clip_int_sat;
+    typedef rasterizer_sl_clip<ras_conv_int_3x>  rasterizer_sl_clip_int_3x;
+    typedef rasterizer_sl_clip<ras_conv_dbl>     rasterizer_sl_clip_dbl;
+    typedef rasterizer_sl_clip<ras_conv_dbl_3x>  rasterizer_sl_clip_dbl_3x;
+
+
+}
+
+#endif

Modified: incubator/ooo/trunk/main/agg/inc/agg_renderer_base.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/inc/agg_renderer_base.h?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/inc/agg_renderer_base.h (original)
+++ incubator/ooo/trunk/main/agg/inc/agg_renderer_base.h 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 
@@ -32,12 +32,18 @@ namespace agg
     public:
         typedef PixelFormat pixfmt_type;
         typedef typename pixfmt_type::color_type color_type;
+        typedef typename pixfmt_type::row_data row_data;
 
         //--------------------------------------------------------------------
-        renderer_base(pixfmt_type& _ren) :
-            m_ren(&_ren),
-            m_clip_box(0, 0, _ren.width() - 1, _ren.height() - 1)
+        renderer_base() : m_ren(0), m_clip_box(1, 1, 0, 0) {}
+        explicit renderer_base(pixfmt_type& ren) :
+            m_ren(&ren),
+            m_clip_box(0, 0, ren.width() - 1, ren.height() - 1)
+        {}
+        void attach(pixfmt_type& ren)
         {
+            m_ren = &ren;
+            m_clip_box = rect_i(0, 0, ren.width() - 1, ren.height() - 1);
         }
 
         //--------------------------------------------------------------------
@@ -51,9 +57,9 @@ namespace agg
         //--------------------------------------------------------------------
         bool clip_box(int x1, int y1, int x2, int y2)
         {
-            rect cb(x1, y1, x2, y2);
+            rect_i cb(x1, y1, x2, y2);
             cb.normalize();
-            if(cb.clip(rect(0, 0, width() - 1, height() - 1)))
+            if(cb.clip(rect_i(0, 0, width() - 1, height() - 1)))
             {
                 m_clip_box = cb;
                 return true;
@@ -99,24 +105,20 @@ namespace agg
             return x >= m_clip_box.x1 && y >= m_clip_box.y1 &&
                    x <= m_clip_box.x2 && y <= m_clip_box.y2;
         }
-        
-        //--------------------------------------------------------------------
-        void first_clip_box() {}
-        bool next_clip_box() { return false; }
 
         //--------------------------------------------------------------------
-        const rect& clip_box() const { return m_clip_box;    }
-        int         xmin()     const { return m_clip_box.x1; }
-        int         ymin()     const { return m_clip_box.y1; }
-        int         xmax()     const { return m_clip_box.x2; }
-        int         ymax()     const { return m_clip_box.y2; }
+        const rect_i& clip_box() const { return m_clip_box;    }
+        int           xmin()     const { return m_clip_box.x1; }
+        int           ymin()     const { return m_clip_box.y1; }
+        int           xmax()     const { return m_clip_box.x2; }
+        int           ymax()     const { return m_clip_box.y2; }
 
         //--------------------------------------------------------------------
-        const rect& bounding_clip_box() const { return m_clip_box;    }
-        int         bounding_xmin()     const { return m_clip_box.x1; }
-        int         bounding_ymin()     const { return m_clip_box.y1; }
-        int         bounding_xmax()     const { return m_clip_box.x2; }
-        int         bounding_ymax()     const { return m_clip_box.y2; }
+        const rect_i& bounding_clip_box() const { return m_clip_box;    }
+        int           bounding_xmin()     const { return m_clip_box.x1; }
+        int           bounding_ymin()     const { return m_clip_box.y1; }
+        int           bounding_xmax()     const { return m_clip_box.x2; }
+        int           bounding_ymax()     const { return m_clip_box.y2; }
 
         //--------------------------------------------------------------------
         void clear(const color_type& c)
@@ -131,6 +133,7 @@ namespace agg
             }
         }
           
+
         //--------------------------------------------------------------------
         void copy_pixel(int x, int y, const color_type& c)
         {
@@ -223,7 +226,7 @@ namespace agg
         //--------------------------------------------------------------------
         void copy_bar(int x1, int y1, int x2, int y2, const color_type& c)
         {
-            rect rc(x1, y1, x2, y2);
+            rect_i rc(x1, y1, x2, y2);
             rc.normalize();
             if(rc.clip(clip_box()))
             {
@@ -239,7 +242,7 @@ namespace agg
         void blend_bar(int x1, int y1, int x2, int y2, 
                        const color_type& c, cover_type cover)
         {
-            rect rc(x1, y1, x2, y2);
+            rect_i rc(x1, y1, x2, y2);
             rc.normalize();
             if(rc.clip(clip_box()))
             {
@@ -255,7 +258,6 @@ namespace agg
             }
         }
 
-
         //--------------------------------------------------------------------
         void blend_solid_hspan(int x, int y, int len, 
                                const color_type& c, 
@@ -302,11 +304,9 @@ namespace agg
             m_ren->blend_solid_vspan(x, y, len, c, covers);
         }
 
+
         //--------------------------------------------------------------------
-        void blend_color_hspan(int x, int y, int len, 
-                               const color_type* colors, 
-                               const cover_type* covers,
-                               cover_type cover = cover_full)
+        void copy_color_hspan(int x, int y, int len, const color_type* colors)
         {
             if(y > ymax()) return;
             if(y < ymin()) return;
@@ -316,7 +316,6 @@ namespace agg
                 int d = xmin() - x;
                 len -= d;
                 if(len <= 0) return;
-                if(covers) covers += d;
                 colors += d;
                 x = xmin();
             }
@@ -325,14 +324,12 @@ namespace agg
                 len = xmax() - x + 1;
                 if(len <= 0) return;
             }
-            m_ren->blend_color_hspan(x, y, len, colors, covers, cover);
+            m_ren->copy_color_hspan(x, y, len, colors);
         }
 
+
         //--------------------------------------------------------------------
-        void blend_color_vspan(int x, int y, int len, 
-                               const color_type* colors, 
-                               const cover_type* covers,
-                               cover_type cover = cover_full)
+        void copy_color_vspan(int x, int y, int len, const color_type* colors)
         {
             if(x > xmax()) return;
             if(x < xmin()) return;
@@ -342,7 +339,6 @@ namespace agg
                 int d = ymin() - y;
                 len -= d;
                 if(len <= 0) return;
-                if(covers) covers += d;
                 colors += d;
                 y = ymin();
             }
@@ -351,15 +347,15 @@ namespace agg
                 len = ymax() - y + 1;
                 if(len <= 0) return;
             }
-            m_ren->blend_color_vspan(x, y, len, colors, covers, cover);
+            m_ren->copy_color_vspan(x, y, len, colors);
         }
 
 
         //--------------------------------------------------------------------
-        void blend_opaque_color_hspan(int x, int y, int len, 
-                                      const color_type* colors, 
-                                      const cover_type* covers,
-                                      cover_type cover = cover_full)
+        void blend_color_hspan(int x, int y, int len, 
+                               const color_type* colors, 
+                               const cover_type* covers,
+                               cover_type cover = agg::cover_full)
         {
             if(y > ymax()) return;
             if(y < ymin()) return;
@@ -378,14 +374,14 @@ namespace agg
                 len = xmax() - x + 1;
                 if(len <= 0) return;
             }
-            m_ren->blend_opaque_color_hspan(x, y, len, colors, covers, cover);
+            m_ren->blend_color_hspan(x, y, len, colors, covers, cover);
         }
 
         //--------------------------------------------------------------------
-        void blend_opaque_color_vspan(int x, int y, int len, 
-                                      const color_type* colors, 
-                                      const cover_type* covers,
-                                      cover_type cover = cover_full)
+        void blend_color_vspan(int x, int y, int len, 
+                               const color_type* colors, 
+                               const cover_type* covers,
+                               cover_type cover = agg::cover_full)
         {
             if(x > xmax()) return;
             if(x < xmin()) return;
@@ -404,51 +400,14 @@ namespace agg
                 len = ymax() - y + 1;
                 if(len <= 0) return;
             }
-            m_ren->blend_opaque_color_vspan(x, y, len, colors, covers, cover);
-        }
-
-
-        //--------------------------------------------------------------------
-        void blend_color_hspan_no_clip(int x, int y, int len, 
-                                       const color_type* colors, 
-                                       const cover_type* covers,
-                                       cover_type cover = cover_full)
-        {
-            m_ren->blend_color_hspan(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        void blend_color_vspan_no_clip(int x, int y, int len, 
-                                       const color_type* colors, 
-                                       const cover_type* covers,
-                                       cover_type cover = cover_full)
-        {
             m_ren->blend_color_vspan(x, y, len, colors, covers, cover);
         }
 
         //--------------------------------------------------------------------
-        void blend_opaque_color_hspan_no_clip(int x, int y, int len, 
-                                              const color_type* colors, 
-                                              const cover_type* covers,
-                                              cover_type cover = cover_full)
-        {
-            m_ren->blend_opaque_color_hspan(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        void blend_opaque_color_vspan_no_clip(int x, int y, int len, 
-                                              const color_type* colors, 
-                                              const cover_type* covers,
-                                              cover_type cover = cover_full)
-        {
-            m_ren->blend_opaque_color_vspan(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        rect clip_rect_area(rect& dst, rect& src, int wsrc, int hsrc) const
+        rect_i clip_rect_area(rect_i& dst, rect_i& src, int wsrc, int hsrc) const
         {
-            rect rc(0,0,0,0);
-            rect cb = clip_box();
+            rect_i rc(0,0,0,0);
+            rect_i cb = clip_box();
             ++cb.x2;
             ++cb.y2;
 
@@ -488,14 +447,14 @@ namespace agg
             return rc;
         }
 
-
         //--------------------------------------------------------------------
-        void copy_from(const rendering_buffer& src, 
-                       const rect* rect_src_ptr = 0, 
+        template<class RenBuf>
+        void copy_from(const RenBuf& src, 
+                       const rect_i* rect_src_ptr = 0, 
                        int dx = 0, 
                        int dy = 0)
         {
-            rect rsrc(0, 0, src.width(), src.height());
+            rect_i rsrc(0, 0, src.width(), src.height());
             if(rect_src_ptr)
             {
                 rsrc.x1 = rect_src_ptr->x1; 
@@ -505,12 +464,12 @@ namespace agg
             }
 
             // Version with xdst, ydst (absolute positioning)
-            //rect rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
+            //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
 
             // Version with dx, dy (relative positioning)
-            rect rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
+            rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
 
-            rect rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
+            rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
 
             if(rc.x2 > 0)
             {
@@ -534,16 +493,15 @@ namespace agg
             }
         }
 
-
-
         //--------------------------------------------------------------------
         template<class SrcPixelFormatRenderer>
         void blend_from(const SrcPixelFormatRenderer& src, 
-                       const rect* rect_src_ptr = 0, 
-                       int dx = 0, 
-                       int dy = 0)
+                        const rect_i* rect_src_ptr = 0, 
+                        int dx = 0, 
+                        int dy = 0,
+                        cover_type cover = agg::cover_full)
         {
-            rect rsrc(0, 0, src.width(), src.height());
+            rect_i rsrc(0, 0, src.width(), src.height());
             if(rect_src_ptr)
             {
                 rsrc.x1 = rect_src_ptr->x1; 
@@ -553,12 +511,11 @@ namespace agg
             }
 
             // Version with xdst, ydst (absolute positioning)
-            //rect rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
+            //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
 
             // Version with dx, dy (relative positioning)
-            rect rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
-
-            rect rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
+            rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
+            rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
 
             if(rc.x2 > 0)
             {
@@ -571,30 +528,103 @@ namespace agg
                 }
                 while(rc.y2 > 0)
                 {
-                    typename SrcPixelFormatRenderer::row_data span = src.span(rsrc.x1, rsrc.y1);
-                    if(span.ptr)
+                    typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
+                    if(rw.ptr)
                     {
                         int x1src = rsrc.x1;
                         int x1dst = rdst.x1;
                         int len   = rc.x2;
-                        if(span.x1 > x1src)
+                        if(rw.x1 > x1src)
                         {
-                            x1dst += span.x1 - x1src;
-                            len   -= span.x1 - x1src;
-                            x1src = span.x1;
+                            x1dst += rw.x1 - x1src;
+                            len   -= rw.x1 - x1src;
+                            x1src  = rw.x1;
                         }
                         if(len > 0)
                         {
-                            if(x1src + len-1 > span.x2)
+                            if(x1src + len-1 > rw.x2)
                             {
-                                len -= x1src + len - span.x2 - 1;
+                                len -= x1src + len - rw.x2 - 1;
                             }
                             if(len > 0)
                             {
-                                m_ren->blend_from(src, span.ptr,
+                                m_ren->blend_from(src,
                                                   x1dst, rdst.y1,
                                                   x1src, rsrc.y1,
-                                                  len);
+                                                  len,
+                                                  cover);
+                            }
+                        }
+                    }
+                    rdst.y1 += incy;
+                    rsrc.y1 += incy;
+                    --rc.y2;
+                }
+            }
+        }
+
+        //--------------------------------------------------------------------
+        template<class SrcPixelFormatRenderer>
+        void blend_from_color(const SrcPixelFormatRenderer& src, 
+                              const color_type& color,
+                              const rect_i* rect_src_ptr = 0, 
+                              int dx = 0, 
+                              int dy = 0,
+                              cover_type cover = agg::cover_full)
+        {
+            rect_i rsrc(0, 0, src.width(), src.height());
+            if(rect_src_ptr)
+            {
+                rsrc.x1 = rect_src_ptr->x1; 
+                rsrc.y1 = rect_src_ptr->y1;
+                rsrc.x2 = rect_src_ptr->x2 + 1;
+                rsrc.y2 = rect_src_ptr->y2 + 1;
+            }
+
+            // Version with xdst, ydst (absolute positioning)
+            //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
+
+            // Version with dx, dy (relative positioning)
+            rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
+            rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
+
+            if(rc.x2 > 0)
+            {
+                int incy = 1;
+                if(rdst.y1 > rsrc.y1)
+                {
+                    rsrc.y1 += rc.y2 - 1;
+                    rdst.y1 += rc.y2 - 1;
+                    incy = -1;
+                }
+                while(rc.y2 > 0)
+                {
+                    typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
+                    if(rw.ptr)
+                    {
+                        int x1src = rsrc.x1;
+                        int x1dst = rdst.x1;
+                        int len   = rc.x2;
+                        if(rw.x1 > x1src)
+                        {
+                            x1dst += rw.x1 - x1src;
+                            len   -= rw.x1 - x1src;
+                            x1src  = rw.x1;
+                        }
+                        if(len > 0)
+                        {
+                            if(x1src + len-1 > rw.x2)
+                            {
+                                len -= x1src + len - rw.x2 - 1;
+                            }
+                            if(len > 0)
+                            {
+                                m_ren->blend_from_color(src,
+                                                        color,
+                                                        x1dst, rdst.y1,
+                                                        x1src, rsrc.y1,
+                                                        len,
+                                                        cover);
                             }
                         }
                     }
@@ -605,11 +635,81 @@ namespace agg
             }
         }
 
+        //--------------------------------------------------------------------
+        template<class SrcPixelFormatRenderer>
+        void blend_from_lut(const SrcPixelFormatRenderer& src, 
+                            const color_type* color_lut,
+                            const rect_i* rect_src_ptr = 0, 
+                            int dx = 0, 
+                            int dy = 0,
+                            cover_type cover = agg::cover_full)
+        {
+            rect_i rsrc(0, 0, src.width(), src.height());
+            if(rect_src_ptr)
+            {
+                rsrc.x1 = rect_src_ptr->x1; 
+                rsrc.y1 = rect_src_ptr->y1;
+                rsrc.x2 = rect_src_ptr->x2 + 1;
+                rsrc.y2 = rect_src_ptr->y2 + 1;
+            }
+
+            // Version with xdst, ydst (absolute positioning)
+            //rect_i rdst(xdst, ydst, xdst + rsrc.x2 - rsrc.x1, ydst + rsrc.y2 - rsrc.y1);
+
+            // Version with dx, dy (relative positioning)
+            rect_i rdst(rsrc.x1 + dx, rsrc.y1 + dy, rsrc.x2 + dx, rsrc.y2 + dy);
+            rect_i rc = clip_rect_area(rdst, rsrc, src.width(), src.height());
 
+            if(rc.x2 > 0)
+            {
+                int incy = 1;
+                if(rdst.y1 > rsrc.y1)
+                {
+                    rsrc.y1 += rc.y2 - 1;
+                    rdst.y1 += rc.y2 - 1;
+                    incy = -1;
+                }
+                while(rc.y2 > 0)
+                {
+                    typename SrcPixelFormatRenderer::row_data rw = src.row(rsrc.y1);
+                    if(rw.ptr)
+                    {
+                        int x1src = rsrc.x1;
+                        int x1dst = rdst.x1;
+                        int len   = rc.x2;
+                        if(rw.x1 > x1src)
+                        {
+                            x1dst += rw.x1 - x1src;
+                            len   -= rw.x1 - x1src;
+                            x1src  = rw.x1;
+                        }
+                        if(len > 0)
+                        {
+                            if(x1src + len-1 > rw.x2)
+                            {
+                                len -= x1src + len - rw.x2 - 1;
+                            }
+                            if(len > 0)
+                            {
+                                m_ren->blend_from_lut(src,
+                                                      color_lut,
+                                                      x1dst, rdst.y1,
+                                                      x1src, rsrc.y1,
+                                                      len,
+                                                      cover);
+                            }
+                        }
+                    }
+                    rdst.y1 += incy;
+                    rsrc.y1 += incy;
+                    --rc.y2;
+                }
+            }
+        }
 
     private:
         pixfmt_type* m_ren;
-        rect         m_clip_box;
+        rect_i       m_clip_box;
     };
 
 

Modified: incubator/ooo/trunk/main/agg/inc/agg_renderer_markers.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/inc/agg_renderer_markers.h?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/inc/agg_renderer_markers.h (original)
+++ incubator/ooo/trunk/main/agg/inc/agg_renderer_markers.h 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,13 +65,12 @@ namespace agg
         //--------------------------------------------------------------------
         renderer_markers(base_ren_type& rbuf) :
             base_type(rbuf)
-        {
-        }
+        {}
 
         //--------------------------------------------------------------------
         bool visible(int x, int y, int r) const
         {
-            rect rc(x-r, y-r, x+y, y+r);
+            rect_i rc(x-r, y-r, x+y, y+r);
             return rc.clip(base_type::ren().bounding_clip_box());  
         }
 

Modified: incubator/ooo/trunk/main/agg/inc/agg_renderer_mclip.h
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/agg/inc/agg_renderer_mclip.h?rev=1184758&r1=1184757&r2=1184758&view=diff
==============================================================================
--- incubator/ooo/trunk/main/agg/inc/agg_renderer_mclip.h (original)
+++ incubator/ooo/trunk/main/agg/inc/agg_renderer_mclip.h 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 
@@ -33,14 +33,19 @@ namespace agg
     public:
         typedef PixelFormat pixfmt_type;
         typedef typename pixfmt_type::color_type color_type;
+        typedef typename pixfmt_type::row_data row_data;
         typedef renderer_base<pixfmt_type> base_ren_type;
 
         //--------------------------------------------------------------------
-        renderer_mclip(pixfmt_type& ren) :
-            m_ren(ren),
+        explicit renderer_mclip(pixfmt_type& pixf) :
+            m_ren(pixf),
             m_curr_cb(0),
             m_bounds(m_ren.xmin(), m_ren.ymin(), m_ren.xmax(), m_ren.ymax())
+        {}
+        void attach(pixfmt_type& pixf)
         {
+            m_ren.attach(pixf);
+            reset_clipping(true);
         }
           
         //--------------------------------------------------------------------
@@ -52,18 +57,18 @@ namespace agg
         unsigned height() const { return m_ren.height(); }
 
         //--------------------------------------------------------------------
-        const rect& clip_box() const { return m_ren.clip_box(); }
-        int         xmin()     const { return m_ren.xmin(); }
-        int         ymin()     const { return m_ren.ymin(); }
-        int         xmax()     const { return m_ren.xmax(); }
-        int         ymax()     const { return m_ren.ymax(); }
+        const rect_i& clip_box() const { return m_ren.clip_box(); }
+        int           xmin()     const { return m_ren.xmin(); }
+        int           ymin()     const { return m_ren.ymin(); }
+        int           xmax()     const { return m_ren.xmax(); }
+        int           ymax()     const { return m_ren.ymax(); }
 
         //--------------------------------------------------------------------
-        const rect& bounding_clip_box() const { return m_bounds;    }
-        int         bounding_xmin()     const { return m_bounds.x1; }
-        int         bounding_ymin()     const { return m_bounds.y1; }
-        int         bounding_xmax()     const { return m_bounds.x2; }
-        int         bounding_ymax()     const { return m_bounds.y2; }
+        const rect_i& bounding_clip_box() const { return m_bounds;    }
+        int           bounding_xmin()     const { return m_bounds.x1; }
+        int           bounding_ymin()     const { return m_bounds.y1; }
+        int           bounding_xmax()     const { return m_bounds.x2; }
+        int           bounding_ymax()     const { return m_bounds.y2; }
 
         //--------------------------------------------------------------------
         void first_clip_box() 
@@ -71,7 +76,7 @@ namespace agg
             m_curr_cb = 0;
             if(m_clip.size())
             {
-                const rect& cb = m_clip[0];
+                const rect_i& cb = m_clip[0];
                 m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2);
             }
         }
@@ -81,7 +86,7 @@ namespace agg
         { 
             if(++m_curr_cb < m_clip.size())
             {
-                const rect& cb = m_clip[m_curr_cb];
+                const rect_i& cb = m_clip[m_curr_cb];
                 m_ren.clip_box_naked(cb.x1, cb.y1, cb.x2, cb.y2);
                 return true;
             }
@@ -100,9 +105,9 @@ namespace agg
         //--------------------------------------------------------------------
         void add_clip_box(int x1, int y1, int x2, int y2)
         {
-            rect cb(x1, y1, x2, y2); 
+            rect_i cb(x1, y1, x2, y2); 
             cb.normalize();
-            if(cb.clip(rect(0, 0, width() - 1, height() - 1)))
+            if(cb.clip(rect_i(0, 0, width() - 1, height() - 1)))
             {
                 m_clip.add(cb);
                 if(cb.x1 < m_bounds.x1) m_bounds.x1 = cb.x1;
@@ -232,7 +237,6 @@ namespace agg
             while(next_clip_box());
         }
 
-
         //--------------------------------------------------------------------
         void blend_solid_hspan(int x, int y, int len, 
                                const color_type& c, const cover_type* covers)
@@ -257,22 +261,20 @@ namespace agg
             while(next_clip_box());
         }
 
+
         //--------------------------------------------------------------------
-        void blend_color_hspan(int x, int y, int len, 
-                               const color_type* colors, 
-                               const cover_type* covers,
-                               cover_type cover = cover_full)
+        void copy_color_hspan(int x, int y, int len, const color_type* colors)
         {
             first_clip_box();
             do
             {
-                m_ren.blend_color_hspan(x, y, len, colors, covers, cover);
+                m_ren.copy_color_hspan(x, y, len, colors);
             }
             while(next_clip_box());
         }
 
         //--------------------------------------------------------------------
-        void blend_color_vspan(int x, int y, int len, 
+        void blend_color_hspan(int x, int y, int len, 
                                const color_type* colors, 
                                const cover_type* covers,
                                cover_type cover = cover_full)
@@ -285,96 +287,60 @@ namespace agg
             while(next_clip_box());
         }
 
-
         //--------------------------------------------------------------------
-        void blend_qpaque_color_hspan(int x, int y, int len, 
-                                      const color_type* colors, 
-                                      const cover_type* covers,
-                                      cover_type cover = cover_full)
+        void blend_color_vspan(int x, int y, int len, 
+                               const color_type* colors, 
+                               const cover_type* covers,
+                               cover_type cover = cover_full)
         {
             first_clip_box();
             do
             {
-                m_ren.blend_opaque_color_hspan(x, y, len, colors, covers, cover);
+                m_ren.blend_color_vspan(x, y, len, colors, covers, cover);
             }
             while(next_clip_box());
         }
 
         //--------------------------------------------------------------------
-        void blend_opaque_color_vspan(int x, int y, int len, 
-                                      const color_type* colors, 
-                                      const cover_type* covers,
-                                      cover_type cover = cover_full)
+        void copy_from(const rendering_buffer& from, 
+                       const rect_i* rc=0, 
+                       int x_to=0, 
+                       int y_to=0)
         {
             first_clip_box();
             do
             {
-                m_ren.blend_opaque_color_hspan(x, y, len, colors, covers, cover);
+                m_ren.copy_from(from, rc, x_to, y_to);
             }
             while(next_clip_box());
         }
 
-
         //--------------------------------------------------------------------
-        void blend_color_hspan_no_clip(int x, int y, int len, 
-                                       const color_type* colors, 
-                                       const cover_type* covers,
-                                       cover_type cover = cover_full)
-        {
-            m_ren.blend_color_hspan_no_clip(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        void blend_color_vspan_no_clip(int x, int y, int len, 
-                                       const color_type* colors, 
-                                       const cover_type* covers,
-                                       cover_type cover = cover_full)
-        {
-            m_ren.blend_color_vspan_no_clip(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        void blend_opaque_color_hspan_no_clip(int x, int y, int len, 
-                                              const color_type* colors, 
-                                              const cover_type* covers,
-                                              cover_type cover = cover_full)
-        {
-            m_ren.blend_opaque_color_hspan_no_clip(x, y, len, colors, covers, cover);
-        }
-
-        //--------------------------------------------------------------------
-        void blend_opaque_color_vspan_no_clip(int x, int y, int len, 
-                                              const color_type* colors, 
-                                              const cover_type* covers,
-                                              cover_type cover = cover_full)
-        {
-            m_ren.blend_opaque_color_vspan_no_clip(x, y, len, colors, covers, cover);
-        }
-
-
-        //--------------------------------------------------------------------
-        void copy_from(const rendering_buffer& from, 
-                       const rect* rc=0, 
-                       int x_to=0, 
-                       int y_to=0)
+        template<class SrcPixelFormatRenderer>
+        void blend_from(const SrcPixelFormatRenderer& src, 
+                        const rect_i* rect_src_ptr = 0, 
+                        int dx = 0, 
+                        int dy = 0,
+                        cover_type cover = cover_full)
         {
             first_clip_box();
             do
             {
-                m_ren.copy_from(from, rc, x_to, y_to);
+                m_ren.blend_from(src, rect_src_ptr, dx, dy, cover);
             }
             while(next_clip_box());
         }
+
         
     private:
         renderer_mclip(const renderer_mclip<PixelFormat>&);
         const renderer_mclip<PixelFormat>& 
             operator = (const renderer_mclip<PixelFormat>&);
 
-        base_ren_type      m_ren;
-        pod_deque<rect, 4> m_clip;
-        unsigned           m_curr_cb;
-        rect               m_bounds;
+        base_ren_type          m_ren;
+        pod_bvector<rect_i, 4> m_clip;
+        unsigned               m_curr_cb;
+        rect_i                 m_bounds;
     };
 
 



Mime
View raw message