vfs: check userland buffers before reading them.
[haiku.git] / headers / libs / agg / agg_conv_clip_polygon.h
blob87537638dcec59458eae3ece5e258bb0934e87e1
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.4
3 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
4 //
5 // Permission to copy, use, modify, sell and distribute this software
6 // is granted provided this copyright notice appears in all copies.
7 // This software is provided "as is" without express or implied
8 // warranty, and with no claim as to its suitability for any purpose.
9 //
10 //----------------------------------------------------------------------------
11 // Contact: mcseem@antigrain.com
12 // mcseemagg@yahoo.com
13 // http://www.antigrain.com
14 //----------------------------------------------------------------------------
16 // Polygon clipping converter
17 // There an optimized Liang-Basky algorithm is used.
18 // The algorithm doesn't optimize the degenerate edges, i.e. it will never
19 // break a closed polygon into two or more ones, instead, there will be
20 // degenerate edges coinciding with the respective clipping boundaries.
21 // This is a sub-optimal solution, because that optimization would require
22 // extra, rather expensive math while the rasterizer tolerates it quite well,
23 // without any considerable overhead.
25 //----------------------------------------------------------------------------
26 #ifndef AGG_CONV_CLIP_POLYGON_INCLUDED
27 #define AGG_CONV_CLIP_POLYGON_INCLUDED
29 #include "agg_basics.h"
30 #include "agg_conv_adaptor_vpgen.h"
31 #include "agg_vpgen_clip_polygon.h"
33 namespace agg
36 //=======================================================conv_clip_polygon
37 template<class VertexSource>
38 struct conv_clip_polygon : public conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon>
40 typedef conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon> base_type;
42 conv_clip_polygon(VertexSource& vs) :
43 conv_adaptor_vpgen<VertexSource, vpgen_clip_polygon>(vs) {}
45 void clip_box(double x1, double y1, double x2, double y2)
47 base_type::vpgen().clip_box(x1, y1, x2, y2);
50 double x1() const { return base_type::vpgen().x1(); }
51 double y1() const { return base_type::vpgen().y1(); }
52 double x2() const { return base_type::vpgen().x2(); }
53 double y2() const { return base_type::vpgen().y2(); }
55 private:
56 conv_clip_polygon(const conv_clip_polygon<VertexSource>&);
57 const conv_clip_polygon<VertexSource>&
58 operator = (const conv_clip_polygon<VertexSource>&);
63 #endif