Fix wxGraphicsMatrix concatenation (Direct2D)

1. Elements of resulting matrix are modified directly (in-place) in Matrix3x2F::SetProduct() so none of the multiplied matrices can be the instance of the resulting matrix.
2. The parameter matrix in wxGraphicsMatrixData::Concat() should be a multiplicand, not a multiplier.

See #17670.
This commit is contained in:
Artur Wieczorek 2016-09-18 23:06:13 +02:00
parent c225774d94
commit b6d44d5329
2 changed files with 18 additions and 2 deletions

View File

@ -1525,10 +1525,21 @@ class wxGraphicsMatrix : public wxGraphicsObject
public:
/**
Concatenates the matrix passed with the current matrix.
The effect of the resulting transformation is to first apply
the transformation in @a t to the coordinates and then apply
the transformation in the current matrix to the coordinates.
@code
// matrix = t x matrix
@endcode
@param t
The parameter matrix is the multiplicand.
*/
virtual void Concat(const wxGraphicsMatrix* t);
/**
Concatenates the matrix passed with the current matrix.
@overload
*/
void Concat(const wxGraphicsMatrix& t);

View File

@ -915,7 +915,12 @@ wxD2DMatrixData::wxD2DMatrixData(wxGraphicsRenderer* renderer, const D2D1::Matri
void wxD2DMatrixData::Concat(const wxGraphicsMatrixData* t)
{
m_matrix.SetProduct(m_matrix, static_cast<const wxD2DMatrixData*>(t)->m_matrix);
// Elements of resulting matrix are modified in-place in SetProduct()
// so multiplied matrices cannot be the instances of the resulting matrix.
// Note that parameter matrix (t) is the multiplicand.
const D2D1::Matrix3x2F m1(static_cast<const wxD2DMatrixData*>(t)->m_matrix);
const D2D1::Matrix3x2F m2(m_matrix);
m_matrix.SetProduct(m1, m2);
}
void wxD2DMatrixData::Set(wxDouble a, wxDouble b, wxDouble c, wxDouble d, wxDouble tx, wxDouble ty)