vfs: check userland buffers before reading them.
[haiku.git] / headers / libs / agg / agg_span_interpolator_adaptor.h
blob17ea71291b03eb67ef79328985c39967080f3149
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_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED
17 #define AGG_SPAN_INTERPOLATOR_ADAPTOR_INCLUDED
19 #include "agg_basics.h"
21 namespace agg
24 //===============================================span_interpolator_adaptor
25 template<class Interpolator, class Distortion>
26 class span_interpolator_adaptor : public Interpolator
28 public:
29 typedef Interpolator base_type;
30 typedef typename base_type::trans_type trans_type;
31 typedef Distortion distortion_type;
33 //--------------------------------------------------------------------
34 span_interpolator_adaptor() {}
35 span_interpolator_adaptor(const trans_type& trans,
36 const distortion_type& dist) :
37 base_type(trans),
38 m_distortion(&dist)
42 //--------------------------------------------------------------------
43 span_interpolator_adaptor(const trans_type& trans,
44 const distortion_type& dist,
45 double x, double y, unsigned len) :
46 base_type(trans, x, y, len),
47 m_distortion(&dist)
51 //--------------------------------------------------------------------
52 const distortion_type& distortion() const
54 return *m_distortion;
57 //--------------------------------------------------------------------
58 void distortion(const distortion_type& dist)
60 m_distortion = dist;
63 //--------------------------------------------------------------------
64 void coordinates(int* x, int* y) const
66 base_type::coordinates(x, y);
67 m_distortion->calculate(x, y);
70 private:
71 //--------------------------------------------------------------------
72 const distortion_type* m_distortion;
77 #endif