store Transformer by value in conv_transform

This commit is contained in:
Artem Pavlenko 2012-04-18 09:38:17 +01:00
parent 9af11c5ef2
commit ba270e07f2

View file

@ -29,8 +29,12 @@ namespace agg
template<class VertexSource, class Transformer=trans_affine> class conv_transform
{
public:
explicit conv_transform(VertexSource& source) :
m_source(&source), m_trans() {}
conv_transform(VertexSource& source, const Transformer& tr) :
m_source(&source), m_trans(&tr) {}
m_source(&source), m_trans(tr) {}
void attach(VertexSource& source) { m_source = &source; }
void rewind(unsigned path_id)
@ -43,14 +47,14 @@ namespace agg
unsigned cmd = m_source->vertex(x, y);
if(is_vertex(cmd))
{
m_trans->transform(x, y);
m_trans.transform(x, y);
}
return cmd;
}
void transformer(const Transformer& tr)
{
m_trans = &tr;
m_trans = tr;
}
private:
@ -59,7 +63,7 @@ namespace agg
operator = (const conv_transform<VertexSource>&);
VertexSource* m_source;
const Transformer* m_trans;
Transformer m_trans;
};