agg::trans_affine: add static const identity, make mul/div operators const

(cherry picked from commit db47a6c9bad5828fe62b5c1c05661118e23ad218)
This commit is contained in:
Mickey Rose 2012-05-27 08:56:52 +02:00
parent 46c2d1c710
commit d346c57e17
2 changed files with 6 additions and 4 deletions

View file

@ -86,6 +86,7 @@ namespace agg
//---------------------------------------------------------------------- //----------------------------------------------------------------------
struct trans_affine struct trans_affine
{ {
static const trans_affine identity;
double sx, shy, shx, sy, tx, ty; double sx, shy, shx, sy, tx, ty;
//------------------------------------------ Construction //------------------------------------------ Construction
@ -210,15 +211,15 @@ namespace agg
} }
// Multiply the matrix by another one and return // Multiply the matrix by another one and return
// the result in a separete matrix. // the result in a separate matrix.
trans_affine operator * (const trans_affine& m) trans_affine operator * (const trans_affine& m) const
{ {
return trans_affine(*this).multiply(m); return trans_affine(*this).multiply(m);
} }
// Multiply the matrix by inverse of another one // Multiply the matrix by inverse of another one
// and return the result in a separete matrix. // and return the result in a separate matrix.
trans_affine operator / (const trans_affine& m) trans_affine operator / (const trans_affine& m) const
{ {
return trans_affine(*this).multiply_inv(m); return trans_affine(*this).multiply_inv(m);
} }

View file

@ -22,6 +22,7 @@
namespace agg namespace agg
{ {
const trans_affine trans_affine::identity;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
const trans_affine& trans_affine::parl_to_parl(const double* src, const trans_affine& trans_affine::parl_to_parl(const double* src,