vfs: check userland buffers before reading them.
[haiku.git] / headers / libs / agg / agg_vpgen_clip_polyline.h
blobb070a7759e59af5d91692c645f63ad5b49797ca3
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_VPGEN_CLIP_POLYLINE_INCLUDED
17 #define AGG_VPGEN_CLIP_POLYLINE_INCLUDED
19 #include "agg_basics.h"
21 namespace agg
24 //======================================================vpgen_clip_polyline
26 // See Implementation agg_vpgen_clip_polyline.cpp
28 class vpgen_clip_polyline
30 public:
31 vpgen_clip_polyline() :
32 m_clip_box(0, 0, 1, 1),
33 m_x1(0),
34 m_y1(0),
35 m_num_vertices(0),
36 m_vertex(0),
37 m_move_to(false)
41 void clip_box(double x1, double y1, double x2, double y2)
43 m_clip_box.x1 = x1;
44 m_clip_box.y1 = y1;
45 m_clip_box.x2 = x2;
46 m_clip_box.y2 = y2;
47 m_clip_box.normalize();
50 double x1() const { return m_clip_box.x1; }
51 double y1() const { return m_clip_box.y1; }
52 double x2() const { return m_clip_box.x2; }
53 double y2() const { return m_clip_box.y2; }
55 static bool auto_close() { return false; }
56 static bool auto_unclose() { return true; }
58 void reset();
59 void move_to(double x, double y);
60 void line_to(double x, double y);
61 unsigned vertex(double* x, double* y);
63 private:
64 rect_d m_clip_box;
65 double m_x1;
66 double m_y1;
67 double m_x[2];
68 double m_y[2];
69 unsigned m_cmd[2];
70 unsigned m_num_vertices;
71 unsigned m_vertex;
72 bool m_move_to;
78 #endif