xref: /aosp_15_r20/external/pdfium/third_party/agg23/agg_render_scanlines.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 
2 //----------------------------------------------------------------------------
3 // Anti-Grain Geometry - Version 2.3
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
5 //
6 // Permission to copy, use, modify, sell and distribute this software
7 // is granted provided this copyright notice appears in all copies.
8 // This software is provided "as is" without express or implied
9 // warranty, and with no claim as to its suitability for any purpose.
10 //
11 //----------------------------------------------------------------------------
12 // Contact: [email protected]
13 //          [email protected]
14 //          http://www.antigrain.com
15 //----------------------------------------------------------------------------
16 #ifndef AGG_RENDER_SCANLINES_INCLUDED
17 #define AGG_RENDER_SCANLINES_INCLUDED
18 #include "agg_basics.h"
19 namespace pdfium
20 {
21 namespace agg
22 {
23 template<class Rasterizer, class Scanline, class Renderer>
render_scanlines(Rasterizer & ras,Scanline & sl,Renderer & ren,bool no_smooth)24 void render_scanlines(Rasterizer& ras, Scanline& sl, Renderer& ren, bool no_smooth)
25 {
26     if(ras.rewind_scanlines()) {
27         sl.reset(ras.min_x(), ras.max_x());
28         ren.prepare(unsigned(ras.max_x() - ras.min_x() + 2));
29         while(ras.sweep_scanline(sl, no_smooth)) {
30             ren.render(sl);
31         }
32     }
33 }
34 template<class Rasterizer, class Scanline, class Renderer,
35          class VertexSource, class ColorStorage, class PathId>
render_all_paths(Rasterizer & ras,Scanline & sl,Renderer & r,VertexSource & vs,const ColorStorage & as,const PathId & path_id,unsigned num_paths)36 void render_all_paths(Rasterizer& ras,
37                       Scanline& sl,
38                       Renderer& r,
39                       VertexSource& vs,
40                       const ColorStorage& as,
41                       const PathId& path_id,
42                       unsigned num_paths)
43 {
44     for(unsigned i = 0; i < num_paths; i++) {
45         ras.reset();
46         ras.add_path(vs, path_id[i]);
47         r.color(as[i]);
48         render_scanlines(ras, sl, r);
49     }
50 }
51 }
52 }  // namespace pdfium
53 #endif
54