Skip to content
This repository
Browse code

agg::conv_transform: changed transformer to non-const reference (repl…

…aces ba270e0)
  • Loading branch information...
commit 44538e29d4a9db46a6d0cdc3383c8e97ed6fa02f 1 parent f3c774b
lightmare lightmare authored
15 deps/agg/include/agg_conv_transform.h
@@ -29,11 +29,8 @@ namespace agg
29 29 template<class VertexSource, class Transformer=trans_affine> class conv_transform
30 30 {
31 31 public:
32   - explicit conv_transform(VertexSource& source) :
33   - m_source(&source), m_trans() {}
34   -
35   - conv_transform(VertexSource& source, const Transformer& tr) :
36   - m_source(&source), m_trans(tr) {}
  32 + conv_transform(VertexSource& source, Transformer& tr) :
  33 + m_source(&source), m_trans(&tr) {}
37 34
38 35 void attach(VertexSource& source) { m_source = &source; }
39 36
@@ -47,14 +44,14 @@ namespace agg
47 44 unsigned cmd = m_source->vertex(x, y);
48 45 if(is_vertex(cmd))
49 46 {
50   - m_trans.transform(x, y);
  47 + m_trans->transform(x, y);
51 48 }
52 49 return cmd;
53 50 }
54 51
55   - void transformer(const Transformer& tr)
  52 + void transformer(Transformer& tr)
56 53 {
57   - m_trans = tr;
  54 + m_trans = &tr;
58 55 }
59 56
60 57 private:
@@ -63,7 +60,7 @@ namespace agg
63 60 operator = (const conv_transform<VertexSource>&);
64 61
65 62 VertexSource* m_source;
66   - Transformer m_trans;
  63 + const Transformer* m_trans;
67 64 };
68 65
69 66
13 include/mapnik/vertex_converters.hpp
@@ -190,16 +190,21 @@ template <typename T>
190 190 struct converter_traits<T,mapnik::affine_transform_tag>
191 191 {
192 192 typedef T geometry_type;
193   - typedef typename agg::conv_transform<geometry_type> conv_type;
  193 +
  194 + struct conv_type : public agg::conv_transform<geometry_type>
  195 + {
  196 + agg::trans_affine trans_;
  197 +
  198 + conv_type(geometry_type& geom)
  199 + : agg::conv_transform<geometry_type>(geom, trans_) {}
  200 + };
194 201
195 202 template <typename Args>
196 203 static void setup(geometry_type & geom, Args & args)
197 204 {
198 205 typename boost::mpl::at<Args,boost::mpl::int_<2> >::type sym = boost::fusion::at_c<2>(args);
199   - agg::trans_affine tr;
200 206 boost::array<double,6> const& m = sym.get_transform();
201   - tr.load_from(&m[0]);
202   - geom.transformer(tr);
  207 + geom.trans_.load_from(&m[0]);
203 208 }
204 209 };
205 210

0 comments on commit 44538e2

Please sign in to comment.
Something went wrong with that request. Please try again.