vfs: check userland buffers before reading them.
[haiku.git] / headers / libs / agg / agg_conv_unclose_polygon.h
blob66ea45865a3a182f3c10360c36d8a872822423f8
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 #ifndef AGG_CONV_UNCLOSE_POLYGON_INCLUDED
17 #define AGG_CONV_UNCLOSE_POLYGON_INCLUDED
19 #include "agg_basics.h"
21 namespace agg
23 //====================================================conv_unclose_polygon
24 template<class VertexSource> class conv_unclose_polygon
26 public:
27 conv_unclose_polygon(VertexSource& vs) : m_source(&vs) {}
28 void attach(VertexSource& source) { m_source = &source; }
30 void rewind(unsigned path_id)
32 m_source->rewind(path_id);
35 unsigned vertex(double* x, double* y)
37 unsigned cmd = m_source->vertex(x, y);
38 if(is_end_poly(cmd)) cmd &= ~path_flags_close;
39 return cmd;
42 private:
43 conv_unclose_polygon(const conv_unclose_polygon<VertexSource>&);
44 const conv_unclose_polygon<VertexSource>&
45 operator = (const conv_unclose_polygon<VertexSource>&);
47 VertexSource* m_source;
52 #endif