Bug 885621. Fix gfxPattern::GetMatrix() with azure and add GetInverseMatrix(). r=bas

Currently SetMatrix will take the Inverse of the passed in matrix but GetMatrix
doesn't not invert it on the way out. This fixes that and adds a
GetInverseMatrix() so that we don't double invert it when we need the inverse.

--HG--
extra : rebase_source : 6bb2049ccee22c62b1825687ecd09ddd1aad8b2e
This commit is contained in:
Jeff Muizelaar 2013-06-21 14:55:24 -04:00
parent 30d6de5fab
commit 971ac55d18
3 changed files with 19 additions and 2 deletions

View File

@ -1431,8 +1431,7 @@ gfxContext::Mask(gfxPattern *pattern)
}
if (needsClip) {
Matrix mat = ToMatrix(pattern->GetMatrix());
mat.Invert();
Matrix mat = ToMatrix(pattern->GetInverseMatrix());
mat = mat * GetDTTransform();
mDT->SetTransform(mat);

View File

@ -122,6 +122,23 @@ gfxPattern::GetMatrix() const
cairo_matrix_t mat;
cairo_pattern_get_matrix(mPattern, &mat);
return gfxMatrix(*reinterpret_cast<gfxMatrix*>(&mat));
} else {
// invert at the higher precision of gfxMatrix
// cause we need to convert at some point anyways
gfxMatrix mat = ThebesMatrix(mTransform);
mat.Invert();
return mat;
}
}
gfxMatrix
gfxPattern::GetInverseMatrix() const
{
if (mPattern) {
cairo_matrix_t mat;
cairo_pattern_get_matrix(mPattern, &mat);
cairo_matrix_invert(&mat);
return gfxMatrix(*reinterpret_cast<gfxMatrix*>(&mat));
} else {
return ThebesMatrix(mTransform);
}

View File

@ -41,6 +41,7 @@ public:
void SetMatrix(const gfxMatrix& matrix);
gfxMatrix GetMatrix() const;
gfxMatrix GetInverseMatrix() const;
/* Get an Azure Pattern for the current Cairo pattern. aPattern transform
* specifies the transform that was set on the DrawTarget when the pattern