Bug 985470 - Replace the Moz2D Matrix().Translate() calls with Matrix::Translation() for better perf. r=mattwoodrow

--HG--
extra : rebase_source : 7181564bdaa57a970a256e9676857a7195874631
This commit is contained in:
Jonathan Watt 2014-03-22 07:56:11 +08:00
parent 886ced8b00
commit 06a79a3b5a
4 changed files with 10 additions and 10 deletions

View File

@ -1108,8 +1108,8 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
return nullptr;
}
Matrix transform = Matrix().Translate(srcRect.x, srcRect.y) * mMatrix *
Matrix().Translate(-aRect.x, -aRect.y);
Matrix transform = Matrix::Translation(srcRect.x, srcRect.y) * mMatrix *
Matrix::Translation(-aRect.x, -aRect.y);
if (transform.IsIdentity() && srcRect.Size() == aRect.Size()) {
return input;
}

View File

@ -500,16 +500,16 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
!matrix2D.HasNonTranslation() &&
matrix2D.HasNonIntegerTranslation()) {
IntPoint snappedTranslation = RoundedToInt(matrix2D.GetTranslation());
Matrix snappedMatrix = Matrix().Translate(snappedTranslation.x,
snappedTranslation.y);
Matrix snappedMatrix = Matrix::Translation(snappedTranslation.x,
snappedTranslation.y);
result = Matrix4x4::From2D(snappedMatrix);
if (aResidualTransform) {
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
// (I.e., appying snappedMatrix after aResidualTransform gives the
// ideal transform.)
*aResidualTransform =
Matrix().Translate(matrix2D._31 - snappedTranslation.x,
matrix2D._32 - snappedTranslation.y);
Matrix::Translation(matrix2D._31 - snappedTranslation.x,
matrix2D._32 - snappedTranslation.y);
}
} else {
result = aTransform;

View File

@ -158,7 +158,7 @@ namespace FilterWrappers {
Offset(DrawTarget* aDT, FilterNode* aInputFilter, const IntPoint& aOffset)
{
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix().Translate(aOffset.x, aOffset.y));
filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix::Translation(aOffset.x, aOffset.y));
filter->SetInput(IN_TRANSFORM_IN, aInputFilter);
return filter;
}
@ -199,7 +199,7 @@ namespace FilterWrappers {
{
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX,
Matrix().Translate(aSurfacePosition.x, aSurfacePosition.y));
Matrix::Translation(aSurfacePosition.x, aSurfacePosition.y));
filter->SetInput(IN_TRANSFORM_IN, aSurface);
return filter;
}

View File

@ -239,7 +239,7 @@ nsSVGImageFrame::GetRasterImageTransform(int32_t aNativeWidth,
element->mPreserveAspectRatio);
return viewBoxTM *
gfx::Matrix().Translate(x, y) *
gfx::Matrix::Translation(x, y) *
gfx::ToMatrix(GetCanvasTM(aFor, aTransformRoot));
}
@ -255,7 +255,7 @@ nsSVGImageFrame::GetVectorImageTransform(uint32_t aFor,
// "native size" that the SVG image has, and it will handle viewBox and
// preserveAspectRatio on its own once we give it a region to draw into.
return gfx::Matrix().Translate(x, y) *
return gfx::Matrix::Translation(x, y) *
gfx::ToMatrix(GetCanvasTM(aFor, aTransformRoot));
}