update dev300-m58
[ooovba.git] / agg / inc / agg_span_allocator.h
bloba3315b7d1b6b89f7944c3327b5f8d57bf99ff59d
1 //----------------------------------------------------------------------------
2 // Anti-Grain Geometry - Version 2.3
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_ALLOCATOR_INCLUDED
17 #define AGG_SPAN_ALLOCATOR_INCLUDED
19 #include "agg_basics.h"
21 namespace agg
23 //----------------------------------------------------------span_allocator
24 template<class ColorT> class span_allocator
26 public:
27 typedef ColorT color_type;
29 //--------------------------------------------------------------------
30 ~span_allocator()
32 delete [] m_span;
35 //--------------------------------------------------------------------
36 span_allocator() :
37 m_max_span_len(0),
38 m_span(0)
42 //--------------------------------------------------------------------
43 color_type* allocate(unsigned max_span_len)
45 if(max_span_len > m_max_span_len)
47 delete [] m_span;
48 m_span = new color_type[m_max_span_len = max_span_len];
50 return m_span;
53 //--------------------------------------------------------------------
54 color_type* span()
56 return m_span;
59 private:
60 //--------------------------------------------------------------------
61 span_allocator(const span_allocator<ColorT>&);
62 const span_allocator<ColorT>& operator = (const span_allocator<ColorT>&);
64 unsigned m_max_span_len;
65 color_type* m_span;
70 #endif