mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1301027 - Remove the matrix * point operator and replace it with TransformPoint methods. r=Bas
This commit is contained in:
parent
d3c8d3fae3
commit
56e5119c61
@ -207,7 +207,7 @@ DOMMatrixReadOnly::TransformPoint(const DOMPointInit& point) const
|
||||
transformedPoint.z = point.mZ;
|
||||
transformedPoint.w = point.mW;
|
||||
|
||||
transformedPoint = *mMatrix3D * transformedPoint;
|
||||
transformedPoint = mMatrix3D->TransformPoint(transformedPoint);
|
||||
|
||||
retval->SetX(transformedPoint.x);
|
||||
retval->SetY(transformedPoint.y);
|
||||
@ -222,7 +222,7 @@ DOMMatrixReadOnly::TransformPoint(const DOMPointInit& point) const
|
||||
transformedPoint.z = point.mZ;
|
||||
transformedPoint.w = point.mW;
|
||||
|
||||
transformedPoint = tempMatrix * transformedPoint;
|
||||
transformedPoint = tempMatrix.TransformPoint(transformedPoint);
|
||||
|
||||
retval->SetX(transformedPoint.x);
|
||||
retval->SetY(transformedPoint.y);
|
||||
@ -233,7 +233,7 @@ DOMMatrixReadOnly::TransformPoint(const DOMPointInit& point) const
|
||||
transformedPoint.x = point.mX;
|
||||
transformedPoint.y = point.mY;
|
||||
|
||||
transformedPoint = *mMatrix2D * transformedPoint;
|
||||
transformedPoint = mMatrix2D->TransformPoint(transformedPoint);
|
||||
|
||||
retval->SetX(transformedPoint.x);
|
||||
retval->SetY(transformedPoint.y);
|
||||
|
@ -3310,7 +3310,7 @@ CanvasRenderingContext2D::ArcTo(double aX1, double aY1, double aX2,
|
||||
return;
|
||||
}
|
||||
|
||||
p0 = invTransform * mDSPathBuilder->CurrentPoint();
|
||||
p0 = invTransform.TransformPoint(mDSPathBuilder->CurrentPoint());
|
||||
}
|
||||
|
||||
Point p1(aX1, aY1);
|
||||
@ -3393,10 +3393,10 @@ CanvasRenderingContext2D::Rect(double aX, double aY, double aW, double aH)
|
||||
mPathBuilder->LineTo(Point(aX, aY + aH));
|
||||
mPathBuilder->Close();
|
||||
} else {
|
||||
mDSPathBuilder->MoveTo(mTarget->GetTransform() * Point(aX, aY));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(aX + aW, aY));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(aX + aW, aY + aH));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform() * Point(aX, aY + aH));
|
||||
mDSPathBuilder->MoveTo(mTarget->GetTransform().TransformPoint(Point(aX, aY)));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform().TransformPoint(Point(aX + aW, aY)));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform().TransformPoint(Point(aX + aW, aY + aH)));
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform().TransformPoint(Point(aX, aY + aH)));
|
||||
mDSPathBuilder->Close();
|
||||
}
|
||||
}
|
||||
|
@ -305,8 +305,8 @@ public:
|
||||
if (mPathBuilder) {
|
||||
mPathBuilder->MoveTo(mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
|
||||
} else {
|
||||
mDSPathBuilder->MoveTo(mTarget->GetTransform() *
|
||||
mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
|
||||
mDSPathBuilder->MoveTo(mTarget->GetTransform().TransformPoint(
|
||||
mozilla::gfx::Point(ToFloat(aX), ToFloat(aY))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,10 +326,10 @@ public:
|
||||
mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
|
||||
} else {
|
||||
mozilla::gfx::Matrix transform = mTarget->GetTransform();
|
||||
mDSPathBuilder->QuadraticBezierTo(transform *
|
||||
mozilla::gfx::Point(ToFloat(aCpx), ToFloat(aCpy)),
|
||||
transform *
|
||||
mozilla::gfx::Point(ToFloat(aX), ToFloat(aY)));
|
||||
mDSPathBuilder->QuadraticBezierTo(transform.TransformPoint(
|
||||
mozilla::gfx::Point(ToFloat(aCpx), ToFloat(aCpy))),
|
||||
transform.TransformPoint(
|
||||
mozilla::gfx::Point(ToFloat(aX), ToFloat(aY))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ public:
|
||||
if (mPathBuilder) {
|
||||
mPathBuilder->LineTo(aPoint);
|
||||
} else {
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform() * aPoint);
|
||||
mDSPathBuilder->LineTo(mTarget->GetTransform().TransformPoint(aPoint));
|
||||
}
|
||||
}
|
||||
|
||||
@ -529,9 +529,9 @@ public:
|
||||
mPathBuilder->BezierTo(aCP1, aCP2, aCP3);
|
||||
} else {
|
||||
mozilla::gfx::Matrix transform = mTarget->GetTransform();
|
||||
mDSPathBuilder->BezierTo(transform * aCP1,
|
||||
transform * aCP2,
|
||||
transform * aCP3);
|
||||
mDSPathBuilder->BezierTo(transform.TransformPoint(aCP1),
|
||||
transform.TransformPoint(aCP2),
|
||||
transform.TransformPoint(aCP3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ DOMSVGPoint::MatrixTransform(dom::SVGMatrix& matrix)
|
||||
float x = HasOwner() ? InternalItem().mX : mPt.mX;
|
||||
float y = HasOwner() ? InternalItem().mY : mPt.mY;
|
||||
|
||||
Point pt = ToMatrix(matrix.GetMatrix()) * Point(x, y);
|
||||
Point pt = ToMatrix(matrix.GetMatrix()).TransformPoint(Point(x, y));
|
||||
nsCOMPtr<nsISVGPoint> newPoint = new DOMSVGPoint(pt);
|
||||
return newPoint.forget();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ SVGCircleElement::GetGeometryBounds(Rect* aBounds,
|
||||
|
||||
if (r <= 0.f) {
|
||||
// Rendering of the element is disabled
|
||||
*aBounds = Rect(aToBoundsSpace * Point(x, y), Size());
|
||||
*aBounds = Rect(aToBoundsSpace.TransformPoint(Point(x, y)), Size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ SVGEllipseElement::GetGeometryBounds(Rect* aBounds,
|
||||
|
||||
if (rx <= 0.f || ry <= 0.f) {
|
||||
// Rendering of the element is disabled
|
||||
*aBounds = Rect(aToBoundsSpace * Point(x, y), Size());
|
||||
*aBounds = Rect(aToBoundsSpace.TransformPoint(Point(x, y)), Size());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -157,8 +157,8 @@ SVGLineElement::GetGeometryBounds(Rect* aBounds,
|
||||
GetAnimatedLengthValues(&x1, &y1, &x2, &y2, nullptr);
|
||||
|
||||
if (aStrokeOptions.mLineWidth <= 0) {
|
||||
*aBounds = Rect(aToBoundsSpace * Point(x1, y1), Size());
|
||||
aBounds->ExpandToEnclose(aToBoundsSpace * Point(x2, y2));
|
||||
*aBounds = Rect(aToBoundsSpace.TransformPoint(Point(x1, y1)), Size());
|
||||
aBounds->ExpandToEnclose(aToBoundsSpace.TransformPoint(Point(x2, y2)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -198,8 +198,8 @@ SVGLineElement::GetGeometryBounds(Rect* aBounds,
|
||||
|
||||
if (aToNonScalingStrokeSpace) {
|
||||
Point nonScalingSpaceP1, nonScalingSpaceP2;
|
||||
nonScalingSpaceP1 = *aToNonScalingStrokeSpace * Point(x1, y1);
|
||||
nonScalingSpaceP2 = *aToNonScalingStrokeSpace * Point(x2, y2);
|
||||
nonScalingSpaceP1 = aToNonScalingStrokeSpace->TransformPoint(Point(x1, y1));
|
||||
nonScalingSpaceP2 = aToNonScalingStrokeSpace->TransformPoint(Point(x2, y2));
|
||||
x1 = nonScalingSpaceP1.x;
|
||||
y1 = nonScalingSpaceP1.y;
|
||||
x2 = nonScalingSpaceP2.x;
|
||||
@ -245,9 +245,9 @@ SVGLineElement::GetGeometryBounds(Rect* aBounds,
|
||||
const Matrix& toBoundsSpace = aToNonScalingStrokeSpace ?
|
||||
nonScalingToBounds : aToBoundsSpace;
|
||||
|
||||
*aBounds = Rect(toBoundsSpace * points[0], Size());
|
||||
*aBounds = Rect(toBoundsSpace.TransformPoint(points[0]), Size());
|
||||
for (uint32_t i = 1; i < 4; ++i) {
|
||||
aBounds->ExpandToEnclose(toBoundsSpace * points[i]);
|
||||
aBounds->ExpandToEnclose(toBoundsSpace.TransformPoint(points[i]));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -362,7 +362,7 @@ SVGMarkerElement::GetViewBoxTransform()
|
||||
float refX = mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
|
||||
float refY = mLengthAttributes[REFY].GetAnimValue(mCoordCtx);
|
||||
|
||||
gfx::Point ref = viewBoxTM * gfx::Point(refX, refY);
|
||||
gfx::Point ref = viewBoxTM.TransformPoint(gfx::Point(refX, refY));
|
||||
|
||||
Matrix TM = viewBoxTM;
|
||||
TM.PostTranslate(-ref.x, -ref.y);
|
||||
|
@ -149,9 +149,9 @@ nsSVGPolyElement::GetGeometryBounds(Rect* aBounds,
|
||||
}
|
||||
*aBounds = aToBoundsSpace.TransformBounds(bounds);
|
||||
} else {
|
||||
*aBounds = Rect(aToBoundsSpace * points[0], Size());
|
||||
*aBounds = Rect(aToBoundsSpace.TransformPoint(points[0]), Size());
|
||||
for (uint32_t i = 1; i < points.Length(); ++i) {
|
||||
aBounds->ExpandToEnclose(aToBoundsSpace * points[i]);
|
||||
aBounds->ExpandToEnclose(aToBoundsSpace.TransformPoint(points[i]));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
MOZ_ASSERT(!aTransform || !aTransform->HasNonIntegerTranslation());
|
||||
Point dest(Float(mDestination.x), Float(mDestination.y));
|
||||
if (aTransform) {
|
||||
dest = (*aTransform) * dest;
|
||||
dest = aTransform->TransformPoint(dest);
|
||||
}
|
||||
aDT->CopySurface(mSurface, mSourceRect, IntPoint(uint32_t(dest.x), uint32_t(dest.y)));
|
||||
}
|
||||
|
@ -653,10 +653,10 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin
|
||||
ImageHalfScaler scaler(mapping.GetData(), mapping.GetStride(), size);
|
||||
|
||||
// Calculate the maximum width/height of the image post transform.
|
||||
Point topRight = transform * Point(Float(size.width), 0);
|
||||
Point topLeft = transform * Point(0, 0);
|
||||
Point bottomRight = transform * Point(Float(size.width), Float(size.height));
|
||||
Point bottomLeft = transform * Point(0, Float(size.height));
|
||||
Point topRight = transform.TransformPoint(Point(Float(size.width), 0));
|
||||
Point topLeft = transform.TransformPoint(Point(0, 0));
|
||||
Point bottomRight = transform.TransformPoint(Point(Float(size.width), Float(size.height)));
|
||||
Point bottomLeft = transform.TransformPoint(Point(0, Float(size.height)));
|
||||
|
||||
IntSize scaleSize;
|
||||
|
||||
|
@ -95,10 +95,10 @@ Matrix::TransformBounds(const Rect &aRect) const
|
||||
Float min_x, max_x;
|
||||
Float min_y, max_y;
|
||||
|
||||
quad[0] = *this * aRect.TopLeft();
|
||||
quad[1] = *this * aRect.TopRight();
|
||||
quad[2] = *this * aRect.BottomLeft();
|
||||
quad[3] = *this * aRect.BottomRight();
|
||||
quad[0] = TransformPoint(aRect.TopLeft());
|
||||
quad[1] = TransformPoint(aRect.TopRight());
|
||||
quad[2] = TransformPoint(aRect.BottomLeft());
|
||||
quad[3] = TransformPoint(aRect.BottomRight());
|
||||
|
||||
min_x = max_x = quad[0].x;
|
||||
min_y = max_y = quad[0].y;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& aStream, const Matrix& aMatrix);
|
||||
|
||||
Point operator *(const Point &aPoint) const
|
||||
Point TransformPoint(const Point &aPoint) const
|
||||
{
|
||||
Point retPoint;
|
||||
|
||||
@ -63,7 +63,7 @@ public:
|
||||
return retPoint;
|
||||
}
|
||||
|
||||
Size operator *(const Size &aSize) const
|
||||
Size TransformSize(const Size &aSize) const
|
||||
{
|
||||
Size retSize;
|
||||
|
||||
@ -592,7 +592,7 @@ public:
|
||||
F z = -(aPoint.x * _13 + aPoint.y * _23 + _43) / _33;
|
||||
|
||||
// Compute the transformed point
|
||||
return *this * Point4DTyped<SourceUnits, F>(aPoint.x, aPoint.y, z, 1);
|
||||
return this->TransformPoint(Point4DTyped<SourceUnits, F>(aPoint.x, aPoint.y, z, 1));
|
||||
}
|
||||
|
||||
template<class F>
|
||||
@ -723,10 +723,10 @@ public:
|
||||
Point4DTyped<UnknownUnits, F> points[2][kTransformAndClipRectMaxVerts];
|
||||
Point4DTyped<UnknownUnits, F>* dstPoint = points[0];
|
||||
|
||||
*dstPoint++ = *this * Point4DTyped<UnknownUnits, F>(aRect.x, aRect.y, 0, 1);
|
||||
*dstPoint++ = *this * Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.y, 0, 1);
|
||||
*dstPoint++ = *this * Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.YMost(), 0, 1);
|
||||
*dstPoint++ = *this * Point4DTyped<UnknownUnits, F>(aRect.x, aRect.YMost(), 0, 1);
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.x, aRect.y, 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.y, 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.XMost(), aRect.YMost(), 0, 1));
|
||||
*dstPoint++ = TransformPoint(Point4DTyped<UnknownUnits, F>(aRect.x, aRect.YMost(), 0, 1));
|
||||
|
||||
// View frustum clipping planes are described as normals originating from
|
||||
// the 0,0,0,0 origin.
|
||||
@ -824,7 +824,7 @@ public:
|
||||
}
|
||||
|
||||
template<class F>
|
||||
Point4DTyped<TargetUnits, F> operator *(const Point4DTyped<SourceUnits, F>& aPoint) const
|
||||
Point4DTyped<TargetUnits, F> TransformPoint(const Point4DTyped<SourceUnits, F>& aPoint) const
|
||||
{
|
||||
Point4DTyped<TargetUnits, F> retPoint;
|
||||
|
||||
@ -837,7 +837,7 @@ public:
|
||||
}
|
||||
|
||||
template<class F>
|
||||
Point3DTyped<TargetUnits, F> operator *(const Point3DTyped<SourceUnits, F>& aPoint) const
|
||||
Point3DTyped<TargetUnits, F> TransformPoint(const Point3DTyped<SourceUnits, F>& aPoint) const
|
||||
{
|
||||
Point3DTyped<TargetUnits, F> result;
|
||||
result.x = aPoint.x * _11 + aPoint.y * _21 + aPoint.z * _31 + _41;
|
||||
@ -850,30 +850,29 @@ public:
|
||||
}
|
||||
|
||||
template<class F>
|
||||
PointTyped<TargetUnits, F> operator *(const PointTyped<SourceUnits, F> &aPoint) const
|
||||
PointTyped<TargetUnits, F> TransformPoint(const PointTyped<SourceUnits, F> &aPoint) const
|
||||
{
|
||||
Point4DTyped<SourceUnits, F> temp(aPoint.x, aPoint.y, 0, 1);
|
||||
Point4DTyped<TargetUnits, F> result = *this * temp;
|
||||
return result.As2DPoint();
|
||||
return TransformPoint(temp).As2DPoint();
|
||||
}
|
||||
|
||||
template<class F>
|
||||
GFX2D_API RectTyped<TargetUnits, F> TransformBounds(const RectTyped<SourceUnits, F>& aRect) const
|
||||
{
|
||||
Point4DTyped<TargetUnits, F> verts[4];
|
||||
verts[0] = *this * Point4DTyped<SourceUnits, F>(aRect.x, aRect.y, 0.0, 1.0);
|
||||
verts[1] = *this * Point4DTyped<SourceUnits, F>(aRect.XMost(), aRect.y, 0.0, 1.0);
|
||||
verts[2] = *this * Point4DTyped<SourceUnits, F>(aRect.XMost(), aRect.YMost(), 0.0, 1.0);
|
||||
verts[3] = *this * Point4DTyped<SourceUnits, F>(aRect.x, aRect.YMost(), 0.0, 1.0);
|
||||
verts[0] = TransformPoint(Point4DTyped<SourceUnits, F>(aRect.x, aRect.y, 0.0, 1.0));
|
||||
verts[1] = TransformPoint(Point4DTyped<SourceUnits, F>(aRect.XMost(), aRect.y, 0.0, 1.0));
|
||||
verts[2] = TransformPoint(Point4DTyped<SourceUnits, F>(aRect.XMost(), aRect.YMost(), 0.0, 1.0));
|
||||
verts[3] = TransformPoint(Point4DTyped<SourceUnits, F>(aRect.x, aRect.YMost(), 0.0, 1.0));
|
||||
|
||||
PointTyped<TargetUnits, F> quad[4];
|
||||
F min_x, max_x;
|
||||
F min_y, max_y;
|
||||
|
||||
quad[0] = *this * aRect.TopLeft();
|
||||
quad[1] = *this * aRect.TopRight();
|
||||
quad[2] = *this * aRect.BottomLeft();
|
||||
quad[3] = *this * aRect.BottomRight();
|
||||
quad[0] = TransformPoint(aRect.TopLeft());
|
||||
quad[1] = TransformPoint(aRect.TopRight());
|
||||
quad[2] = TransformPoint(aRect.BottomLeft());
|
||||
quad[3] = TransformPoint(aRect.BottomRight());
|
||||
|
||||
min_x = max_x = quad[0].x;
|
||||
min_y = max_y = quad[0].y;
|
||||
@ -1507,9 +1506,9 @@ public:
|
||||
{
|
||||
// Define a plane in transformed space as the transformations
|
||||
// of 3 points on the z=0 screen plane.
|
||||
Point3D a = *this * Point3D(0, 0, 0);
|
||||
Point3D b = *this * Point3D(0, 1, 0);
|
||||
Point3D c = *this * Point3D(1, 0, 0);
|
||||
Point3D a = TransformPoint(Point3D(0, 0, 0));
|
||||
Point3D b = TransformPoint(Point3D(0, 1, 0));
|
||||
Point3D c = TransformPoint(Point3D(1, 0, 0));
|
||||
|
||||
// Convert to two vectors on the surface of the plane.
|
||||
Point3D ab = b - a;
|
||||
|
@ -254,7 +254,7 @@ PathCG::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const
|
||||
{
|
||||
Matrix inverse = aTransform;
|
||||
inverse.Invert();
|
||||
Point transformedPoint = inverse*aPoint;
|
||||
Point transformedPoint = inverse.TransformPoint(aPoint);
|
||||
// We could probably drop the input transform and just transform the point at the caller?
|
||||
CGPoint point = {transformedPoint.x, transformedPoint.y};
|
||||
|
||||
@ -294,7 +294,7 @@ PathCG::StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
|
||||
{
|
||||
Matrix inverse = aTransform;
|
||||
inverse.Invert();
|
||||
Point transformedPoint = inverse*aPoint;
|
||||
Point transformedPoint = inverse.TransformPoint(aPoint);
|
||||
// We could probably drop the input transform and just transform the point at the caller?
|
||||
CGPoint point = {transformedPoint.x, transformedPoint.y};
|
||||
|
||||
|
@ -176,7 +176,7 @@ PathCairo::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule
|
||||
RefPtr<PathBuilderCairo> builder = new PathBuilderCairo(aFillRule);
|
||||
|
||||
AppendPathToBuilder(builder, &aTransform);
|
||||
builder->mCurrentPoint = aTransform * mCurrentPoint;
|
||||
builder->mCurrentPoint = aTransform.TransformPoint(mCurrentPoint);
|
||||
|
||||
return builder.forget();
|
||||
}
|
||||
@ -186,7 +186,7 @@ PathCairo::ContainsPoint(const Point &aPoint, const Matrix &aTransform) const
|
||||
{
|
||||
Matrix inverse = aTransform;
|
||||
inverse.Invert();
|
||||
Point transformed = inverse * aPoint;
|
||||
Point transformed = inverse.TransformPoint(aPoint);
|
||||
|
||||
EnsureContainingContext(aTransform);
|
||||
|
||||
@ -200,7 +200,7 @@ PathCairo::StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
|
||||
{
|
||||
Matrix inverse = aTransform;
|
||||
inverse.Invert();
|
||||
Point transformed = inverse * aPoint;
|
||||
Point transformed = inverse.TransformPoint(aPoint);
|
||||
|
||||
EnsureContainingContext(aTransform);
|
||||
|
||||
@ -313,7 +313,7 @@ PathCairo::AppendPathToBuilder(PathBuilderCairo *aBuilder, const Matrix *aTransf
|
||||
i++;
|
||||
for (uint32_t c = 0; c < pointCount; c++) {
|
||||
cairo_path_data_t data;
|
||||
Point newPoint = *aTransform * Point(mPathData[i].point.x, mPathData[i].point.y);
|
||||
Point newPoint = aTransform->TransformPoint(Point(mPathData[i].point.x, mPathData[i].point.y));
|
||||
data.point.x = newPoint.x;
|
||||
data.point.y = newPoint.y;
|
||||
aBuilder->mPathData.push_back(data);
|
||||
|
@ -419,7 +419,7 @@ PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule)
|
||||
|
||||
RefPtr<PathBuilderD2D> pathBuilder = new PathBuilderD2D(sink, path, aFillRule, mBackendType);
|
||||
|
||||
pathBuilder->mCurrentPoint = aTransform * mEndPoint;
|
||||
pathBuilder->mCurrentPoint = aTransform.TransformPoint(mEndPoint);
|
||||
|
||||
if (mEndedActive) {
|
||||
pathBuilder->mFigureActive = true;
|
||||
|
@ -41,7 +41,9 @@ inline void PartialArcToBezier(T* aSink,
|
||||
Point cp2 =
|
||||
aEndOffset + Point(aEndOffset.y, -aEndOffset.x) * aKappaFactor;
|
||||
|
||||
aSink->BezierTo(aTransform * cp1, aTransform * cp2, aTransform * aEndOffset);
|
||||
aSink->BezierTo(aTransform.TransformPoint(cp1),
|
||||
aTransform.TransformPoint(cp2),
|
||||
aTransform.TransformPoint(aEndOffset));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +112,7 @@ void ArcToBezier(T* aSink, const Point &aOrigin, const Size &aRadius,
|
||||
transform *= Matrix::Rotation(aRotation);
|
||||
}
|
||||
transform.PostTranslate(aOrigin);
|
||||
aSink->LineTo(transform * currentStartOffset);
|
||||
aSink->LineTo(transform.TransformPoint(currentStartOffset));
|
||||
|
||||
while (arcSweepLeft > 0) {
|
||||
Float currentEndAngle =
|
||||
@ -137,7 +139,7 @@ void EllipseToBezier(T* aSink, const Point &aOrigin, const Size &aRadius)
|
||||
Matrix transform(aRadius.width, 0, 0, aRadius.height, aOrigin.x, aOrigin.y);
|
||||
Point currentStartOffset(1, 0);
|
||||
|
||||
aSink->LineTo(transform * currentStartOffset);
|
||||
aSink->LineTo(transform.TransformPoint(currentStartOffset));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// cos(x+pi/2) == -sin(x)
|
||||
@ -363,9 +365,9 @@ inline bool UserToDevicePixelSnapped(Rect& aRect, const DrawTarget& aDrawTarget,
|
||||
}
|
||||
#undef WITHIN_E
|
||||
|
||||
Point p1 = mat * aRect.TopLeft();
|
||||
Point p2 = mat * aRect.TopRight();
|
||||
Point p3 = mat * aRect.BottomRight();
|
||||
Point p1 = mat.TransformPoint(aRect.TopLeft());
|
||||
Point p2 = mat.TransformPoint(aRect.TopRight());
|
||||
Point p3 = mat.TransformPoint(aRect.BottomRight());
|
||||
|
||||
// Check that the rectangle is axis-aligned. For an axis-aligned rectangle,
|
||||
// two opposite corners define the entire rectangle. So check if
|
||||
|
@ -103,13 +103,13 @@ PathRecording::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFill
|
||||
PathOp newPathOp;
|
||||
newPathOp.mType = iter->mType;
|
||||
if (sPointCount[newPathOp.mType] >= 1) {
|
||||
newPathOp.mP1 = aTransform * iter->mP1;
|
||||
newPathOp.mP1 = aTransform.TransformPoint(iter->mP1);
|
||||
}
|
||||
if (sPointCount[newPathOp.mType] >= 2) {
|
||||
newPathOp.mP2 = aTransform * iter->mP2;
|
||||
newPathOp.mP2 = aTransform.TransformPoint(iter->mP2);
|
||||
}
|
||||
if (sPointCount[newPathOp.mType] >= 3) {
|
||||
newPathOp.mP3 = aTransform * iter->mP3;
|
||||
newPathOp.mP3 = aTransform.TransformPoint(iter->mP3);
|
||||
}
|
||||
recording->mPathOps.push_back(newPathOp);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ SkPathContainsPoint(const SkPath& aPath, const Point& aPoint, const Matrix& aTra
|
||||
return false;
|
||||
}
|
||||
|
||||
SkPoint point = PointToSkPoint(inverse * aPoint);
|
||||
SkPoint point = PointToSkPoint(inverse.TransformPoint(aPoint));
|
||||
return aPath.contains(point.fX, point.fY);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ static gfxFloat RecoverZDepth(const Matrix4x4& aTransform, const gfxPoint& aPoin
|
||||
{
|
||||
const Point3D l(0, 0, 1);
|
||||
Point3D l0 = Point3D(aPoint.x, aPoint.y, 0);
|
||||
Point3D p0 = aTransform * Point3D(0, 0, 0);
|
||||
Point3D p0 = aTransform.TransformPoint(Point3D(0, 0, 0));
|
||||
Point3D normal = aTransform.GetNormalVector();
|
||||
|
||||
gfxFloat n = normal.DotProduct(p0 - l0);
|
||||
|
@ -687,7 +687,7 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
|
||||
|
||||
// Snap for 3D Transforms
|
||||
|
||||
Point3D transformedOrigin = aTransform * Point3D();
|
||||
Point3D transformedOrigin = aTransform.TransformPoint(Point3D());
|
||||
|
||||
// Compute the transformed snap by rounding the values of
|
||||
// transformed origin.
|
||||
@ -706,7 +706,7 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
|
||||
}
|
||||
|
||||
// Compute the snap from the transformed snap.
|
||||
Point3D snap = inverse * transformedSnap;
|
||||
Point3D snap = inverse.TransformPoint(transformedSnap);
|
||||
if (snap.z > 0.001 || snap.z < -0.001) {
|
||||
// Allow some level of accumulated computation error.
|
||||
MOZ_ASSERT(inverse._33 == 0.0);
|
||||
@ -749,9 +749,9 @@ Layer::SnapTransform(const Matrix4x4& aTransform,
|
||||
aTransform.Is2D(&matrix2D) &&
|
||||
gfxSize(1.0, 1.0) <= aSnapRect.Size() &&
|
||||
matrix2D.PreservesAxisAlignedRectangles()) {
|
||||
auto transformedTopLeft = IntPoint::Round(matrix2D * ToPoint(aSnapRect.TopLeft()));
|
||||
auto transformedTopRight = IntPoint::Round(matrix2D * ToPoint(aSnapRect.TopRight()));
|
||||
auto transformedBottomRight = IntPoint::Round(matrix2D * ToPoint(aSnapRect.BottomRight()));
|
||||
auto transformedTopLeft = IntPoint::Round(matrix2D.TransformPoint(ToPoint(aSnapRect.TopLeft())));
|
||||
auto transformedTopRight = IntPoint::Round(matrix2D.TransformPoint(ToPoint(aSnapRect.TopRight())));
|
||||
auto transformedBottomRight = IntPoint::Round(matrix2D.TransformPoint(ToPoint(aSnapRect.BottomRight())));
|
||||
|
||||
Matrix snappedMatrix = gfxUtils::TransformRectToRect(aSnapRect,
|
||||
transformedTopLeft, transformedTopRight, transformedBottomRight);
|
||||
|
@ -1978,12 +1978,11 @@ public:
|
||||
if (!gfx::ThebesPoint(residual.GetTranslation()).WithinEpsilonOf(mResidualTranslation, 1e-3f)) {
|
||||
mResidualTranslation = gfx::ThebesPoint(residual.GetTranslation());
|
||||
DebugOnly<mozilla::gfx::Point> transformedOrig =
|
||||
idealTransform * mozilla::gfx::Point();
|
||||
idealTransform.TransformPoint(mozilla::gfx::Point());
|
||||
#ifdef DEBUG
|
||||
DebugOnly<mozilla::gfx::Point> transformed =
|
||||
idealTransform * mozilla::gfx::Point(mResidualTranslation.x,
|
||||
mResidualTranslation.y) -
|
||||
*&transformedOrig;
|
||||
DebugOnly<mozilla::gfx::Point> transformed = idealTransform.TransformPoint(
|
||||
mozilla::gfx::Point(mResidualTranslation.x, mResidualTranslation.y)
|
||||
) - *&transformedOrig;
|
||||
#endif
|
||||
NS_ASSERTION(-0.5 <= (&transformed)->x && (&transformed)->x < 0.5 &&
|
||||
-0.5 <= (&transformed)->y && (&transformed)->y < 0.5,
|
||||
|
@ -121,8 +121,8 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ApzcOf(root), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
EXPECT_EQ(ParentLayerPoint(15, 15), transformToApzc * ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ScreenPoint(15, 15), transformToGecko * ParentLayerPoint(15, 15));
|
||||
EXPECT_EQ(ParentLayerPoint(15, 15), transformToApzc.TransformPoint(ScreenPoint(15, 15)));
|
||||
EXPECT_EQ(ScreenPoint(15, 15), transformToGecko.TransformPoint(ParentLayerPoint(15, 15)));
|
||||
|
||||
// Now we have a sub APZC with a better fit
|
||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 1);
|
||||
@ -131,8 +131,8 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ApzcOf(layers[3]), hit.get());
|
||||
// expect hit point at LayerIntPoint(25, 25)
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc * ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko * ParentLayerPoint(25, 25));
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc.TransformPoint(ScreenPoint(25, 25)));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko.TransformPoint(ParentLayerPoint(25, 25)));
|
||||
|
||||
// At this point, layers[4] obscures layers[3] at the point (15, 15) so
|
||||
// hitting there should hit the root APZC
|
||||
@ -145,15 +145,15 @@ TEST_F(APZHitTestingTester, HitTesting1) {
|
||||
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ApzcOf(layers[4]), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
EXPECT_EQ(ParentLayerPoint(15, 15), transformToApzc * ScreenPoint(15, 15));
|
||||
EXPECT_EQ(ScreenPoint(15, 15), transformToGecko * ParentLayerPoint(15, 15));
|
||||
EXPECT_EQ(ParentLayerPoint(15, 15), transformToApzc.TransformPoint(ScreenPoint(15, 15)));
|
||||
EXPECT_EQ(ScreenPoint(15, 15), transformToGecko.TransformPoint(ParentLayerPoint(15, 15)));
|
||||
|
||||
// Hit test ouside the reach of layer[3,4] but inside root
|
||||
hit = GetTargetAPZC(ScreenPoint(90, 90));
|
||||
EXPECT_EQ(ApzcOf(root), hit.get());
|
||||
// expect hit point at LayerIntPoint(90, 90)
|
||||
EXPECT_EQ(ParentLayerPoint(90, 90), transformToApzc * ScreenPoint(90, 90));
|
||||
EXPECT_EQ(ScreenPoint(90, 90), transformToGecko * ParentLayerPoint(90, 90));
|
||||
EXPECT_EQ(ParentLayerPoint(90, 90), transformToApzc.TransformPoint(ScreenPoint(90, 90)));
|
||||
EXPECT_EQ(ScreenPoint(90, 90), transformToGecko.TransformPoint(ParentLayerPoint(90, 90)));
|
||||
|
||||
// Hit test ouside the reach of any layer
|
||||
hit = GetTargetAPZC(ScreenPoint(1000, 10));
|
||||
@ -188,8 +188,8 @@ TEST_F(APZHitTestingTester, HitTesting2) {
|
||||
// Hit an area that's clearly on the root layer but not any of the child layers.
|
||||
RefPtr<AsyncPanZoomController> hit = GetTargetAPZC(ScreenPoint(75, 25));
|
||||
EXPECT_EQ(apzcroot, hit.get());
|
||||
EXPECT_EQ(ParentLayerPoint(75, 25), transformToApzc * ScreenPoint(75, 25));
|
||||
EXPECT_EQ(ScreenPoint(75, 25), transformToGecko * ParentLayerPoint(75, 25));
|
||||
EXPECT_EQ(ParentLayerPoint(75, 25), transformToApzc.TransformPoint(ScreenPoint(75, 25)));
|
||||
EXPECT_EQ(ScreenPoint(75, 25), transformToGecko.TransformPoint(ParentLayerPoint(75, 25)));
|
||||
|
||||
// Hit an area on the root that would be on layers[3] if layers[2]
|
||||
// weren't transformed.
|
||||
@ -200,31 +200,31 @@ TEST_F(APZHitTestingTester, HitTesting2) {
|
||||
// start at x=10 but its content at x=20).
|
||||
hit = GetTargetAPZC(ScreenPoint(15, 75));
|
||||
EXPECT_EQ(apzcroot, hit.get());
|
||||
EXPECT_EQ(ParentLayerPoint(15, 75), transformToApzc * ScreenPoint(15, 75));
|
||||
EXPECT_EQ(ScreenPoint(15, 75), transformToGecko * ParentLayerPoint(15, 75));
|
||||
EXPECT_EQ(ParentLayerPoint(15, 75), transformToApzc.TransformPoint(ScreenPoint(15, 75)));
|
||||
EXPECT_EQ(ScreenPoint(15, 75), transformToGecko.TransformPoint(ParentLayerPoint(15, 75)));
|
||||
|
||||
// Hit an area on layers[1].
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||
EXPECT_EQ(apzc1, hit.get());
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc * ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko * ParentLayerPoint(25, 25));
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc.TransformPoint(ScreenPoint(25, 25)));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko.TransformPoint(ParentLayerPoint(25, 25)));
|
||||
|
||||
// Hit an area on layers[3].
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 75));
|
||||
EXPECT_EQ(apzc3, hit.get());
|
||||
// transformToApzc should unapply layers[2]'s transform
|
||||
EXPECT_EQ(ParentLayerPoint(12.5, 75), transformToApzc * ScreenPoint(25, 75));
|
||||
EXPECT_EQ(ParentLayerPoint(12.5, 75), transformToApzc.TransformPoint(ScreenPoint(25, 75)));
|
||||
// and transformToGecko should reapply it
|
||||
EXPECT_EQ(ScreenPoint(25, 75), transformToGecko * ParentLayerPoint(12.5, 75));
|
||||
EXPECT_EQ(ScreenPoint(25, 75), transformToGecko.TransformPoint(ParentLayerPoint(12.5, 75)));
|
||||
|
||||
// Hit an area on layers[3] that would be on the root if layers[2]
|
||||
// weren't transformed.
|
||||
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||
EXPECT_EQ(apzc3, hit.get());
|
||||
// transformToApzc should unapply layers[2]'s transform
|
||||
EXPECT_EQ(ParentLayerPoint(37.5, 75), transformToApzc * ScreenPoint(75, 75));
|
||||
EXPECT_EQ(ParentLayerPoint(37.5, 75), transformToApzc.TransformPoint(ScreenPoint(75, 75)));
|
||||
// and transformToGecko should reapply it
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko * ParentLayerPoint(37.5, 75));
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko.TransformPoint(ParentLayerPoint(37.5, 75)));
|
||||
|
||||
// Pan the root layer upward by 50 pixels.
|
||||
// This causes layers[1] to scroll out of view, and an async transform
|
||||
@ -240,21 +240,21 @@ TEST_F(APZHitTestingTester, HitTesting2) {
|
||||
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||
EXPECT_EQ(apzcroot, hit.get());
|
||||
// transformToApzc doesn't unapply the root's own async transform
|
||||
EXPECT_EQ(ParentLayerPoint(75, 75), transformToApzc * ScreenPoint(75, 75));
|
||||
EXPECT_EQ(ParentLayerPoint(75, 75), transformToApzc.TransformPoint(ScreenPoint(75, 75)));
|
||||
// and transformToGecko unapplies it and then reapplies it, because by the
|
||||
// time the event being transformed reaches Gecko the new paint request will
|
||||
// have been handled.
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko * ParentLayerPoint(75, 75));
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko.TransformPoint(ParentLayerPoint(75, 75)));
|
||||
|
||||
// Hit where layers[1] used to be and where layers[3] should now be.
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||
EXPECT_EQ(apzc3, hit.get());
|
||||
// transformToApzc unapplies both layers[2]'s css transform and the root's
|
||||
// async transform
|
||||
EXPECT_EQ(ParentLayerPoint(12.5, 75), transformToApzc * ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ParentLayerPoint(12.5, 75), transformToApzc.TransformPoint(ScreenPoint(25, 25)));
|
||||
// transformToGecko reapplies both the css transform and the async transform
|
||||
// because we have already issued a paint request with it.
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko * ParentLayerPoint(12.5, 75));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko.TransformPoint(ParentLayerPoint(12.5, 75)));
|
||||
|
||||
// This second pan will move the APZC by another 50 pixels.
|
||||
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
|
||||
@ -264,17 +264,17 @@ TEST_F(APZHitTestingTester, HitTesting2) {
|
||||
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||
EXPECT_EQ(apzcroot, hit.get());
|
||||
// transformToApzc doesn't unapply the root's own async transform
|
||||
EXPECT_EQ(ParentLayerPoint(75, 75), transformToApzc * ScreenPoint(75, 75));
|
||||
EXPECT_EQ(ParentLayerPoint(75, 75), transformToApzc.TransformPoint(ScreenPoint(75, 75)));
|
||||
// transformToGecko unapplies the full async transform of -100 pixels
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko * ParentLayerPoint(75, 75));
|
||||
EXPECT_EQ(ScreenPoint(75, 75), transformToGecko.TransformPoint(ParentLayerPoint(75, 75)));
|
||||
|
||||
// Hit where layers[1] used to be. It should now hit the root.
|
||||
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||
EXPECT_EQ(apzcroot, hit.get());
|
||||
// transformToApzc doesn't unapply the root's own async transform
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc * ScreenPoint(25, 25));
|
||||
EXPECT_EQ(ParentLayerPoint(25, 25), transformToApzc.TransformPoint(ScreenPoint(25, 25)));
|
||||
// transformToGecko unapplies the full async transform of -100 pixels
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko * ParentLayerPoint(25, 25));
|
||||
EXPECT_EQ(ScreenPoint(25, 25), transformToGecko.TransformPoint(ParentLayerPoint(25, 25)));
|
||||
}
|
||||
|
||||
TEST_F(APZHitTestingTester, ComplexMultiLayerTree) {
|
||||
|
@ -495,8 +495,8 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
|
||||
// subtree root space, and then the inverse of the new cumulative transform
|
||||
// to bring it back to layer space.
|
||||
LayerPoint transformedAnchor = ViewAs<LayerPixel>(
|
||||
newCumulativeTransform.Inverse() *
|
||||
(oldCumulativeTransform * offsetAnchor.ToUnknownPoint()));
|
||||
newCumulativeTransform.Inverse().TransformPoint(
|
||||
(oldCumulativeTransform.TransformPoint(offsetAnchor.ToUnknownPoint()))));
|
||||
|
||||
// We want to translate the layer by the difference between |transformedAnchor|
|
||||
// and |anchor|. To achieve this, we will add a translation to the layer's
|
||||
|
@ -281,31 +281,25 @@ gfxContext::CurrentMatrix() const
|
||||
gfxPoint
|
||||
gfxContext::DeviceToUser(const gfxPoint& point) const
|
||||
{
|
||||
Matrix matrix = mTransform;
|
||||
matrix.Invert();
|
||||
return ThebesPoint(matrix * ToPoint(point));
|
||||
return ThebesPoint(mTransform.Inverse().TransformPoint(ToPoint(point)));
|
||||
}
|
||||
|
||||
Size
|
||||
gfxContext::DeviceToUser(const Size& size) const
|
||||
{
|
||||
Matrix matrix = mTransform;
|
||||
matrix.Invert();
|
||||
return matrix * size;
|
||||
return mTransform.Inverse().TransformSize(size);
|
||||
}
|
||||
|
||||
gfxRect
|
||||
gfxContext::DeviceToUser(const gfxRect& rect) const
|
||||
{
|
||||
Matrix matrix = mTransform;
|
||||
matrix.Invert();
|
||||
return ThebesRect(matrix.TransformBounds(ToRect(rect)));
|
||||
return ThebesRect(mTransform.Inverse().TransformBounds(ToRect(rect)));
|
||||
}
|
||||
|
||||
gfxPoint
|
||||
gfxContext::UserToDevice(const gfxPoint& point) const
|
||||
{
|
||||
return ThebesPoint(mTransform * ToPoint(point));
|
||||
return ThebesPoint(mTransform.TransformPoint(ToPoint(point)));
|
||||
}
|
||||
|
||||
Size
|
||||
@ -1158,10 +1152,10 @@ gfxContext::ChangeTransform(const Matrix &aNewMatrix, bool aUpdatePatternTransfo
|
||||
} else {
|
||||
mPathBuilder = mDT->CreatePathBuilder(FillRule::FILL_WINDING);
|
||||
|
||||
mPathBuilder->MoveTo(toNewUS * mRect.TopLeft());
|
||||
mPathBuilder->LineTo(toNewUS * mRect.TopRight());
|
||||
mPathBuilder->LineTo(toNewUS * mRect.BottomRight());
|
||||
mPathBuilder->LineTo(toNewUS * mRect.BottomLeft());
|
||||
mPathBuilder->MoveTo(toNewUS.TransformPoint(mRect.TopLeft()));
|
||||
mPathBuilder->LineTo(toNewUS.TransformPoint(mRect.TopRight()));
|
||||
mPathBuilder->LineTo(toNewUS.TransformPoint(mRect.BottomRight()));
|
||||
mPathBuilder->LineTo(toNewUS.TransformPoint(mRect.BottomLeft()));
|
||||
mPathBuilder->Close();
|
||||
|
||||
mPathIsRect = false;
|
||||
|
@ -1575,7 +1575,7 @@ public:
|
||||
glyph->mIndex = aGlyphID;
|
||||
glyph->mPosition.x = aPt.x;
|
||||
glyph->mPosition.y = aPt.y;
|
||||
glyph->mPosition = mFontParams.matInv * glyph->mPosition;
|
||||
glyph->mPosition = mFontParams.matInv.TransformPoint(glyph->mPosition);
|
||||
Flush(false); // this will flush only if the buffer is full
|
||||
}
|
||||
|
||||
@ -1766,7 +1766,7 @@ double
|
||||
gfxFont::CalcXScale(DrawTarget* aDrawTarget)
|
||||
{
|
||||
// determine magnitude of a 1px x offset in device space
|
||||
Size t = aDrawTarget->GetTransform() * Size(1.0, 0.0);
|
||||
Size t = aDrawTarget->GetTransform().TransformSize(Size(1.0, 0.0));
|
||||
if (t.width == 1.0 && t.height == 0.0) {
|
||||
// short-circuit the most common case to avoid sqrt() and division
|
||||
return 1.0;
|
||||
@ -1834,7 +1834,7 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
|
||||
RenderColorGlyph(runParams.dt, runParams.context,
|
||||
fontParams.scaledFont, fontParams.renderingOptions,
|
||||
fontParams.drawOptions,
|
||||
fontParams.matInv * gfx::Point(devPt.x, devPt.y),
|
||||
fontParams.matInv.TransformPoint(gfx::Point(devPt.x, devPt.y)),
|
||||
aGlyphID)) {
|
||||
return;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static gfx::PointTyped<TargetUnits>
|
||||
TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
|
||||
const gfx::PointTyped<SourceUnits>& aPoint)
|
||||
{
|
||||
return aTransform * aPoint;
|
||||
return aTransform.TransformPoint(aPoint);
|
||||
}
|
||||
template <typename TargetUnits, typename SourceUnits>
|
||||
static gfx::IntPointTyped<TargetUnits>
|
||||
|
@ -6262,7 +6262,7 @@ nsDisplayTransform::GetHitDepthAtPoint(nsDisplayListBuilder* aBuilder, const nsP
|
||||
|
||||
Point point2d = point.As2DPoint();
|
||||
|
||||
Point3D transformed = matrix * Point3D(point2d.x, point2d.y, 0);
|
||||
Point3D transformed = matrix.TransformPoint(Point3D(point2d.x, point2d.y, 0));
|
||||
return transformed.z;
|
||||
}
|
||||
|
||||
|
@ -2688,7 +2688,7 @@ nsLayoutUtils::TransformPoints(nsIFrame* aFromFrame, nsIFrame* aToFrame,
|
||||
// What should the behaviour be if some of the points aren't invertible
|
||||
// and others are? Just assume all points are for now.
|
||||
Point toDevPixels = downToDest.ProjectPoint(
|
||||
(upToAncestor * Point(devPixels.x, devPixels.y))).As2DPoint();
|
||||
(upToAncestor.TransformPoint(Point(devPixels.x, devPixels.y)))).As2DPoint();
|
||||
// Divide here so that when the devPixelsPerCSSPixels are the same, we get the correct
|
||||
// answer instead of some inaccuracy multiplying a number by its reciprocal.
|
||||
aPoints[i] = LayoutDevicePoint(toDevPixels.x, toDevPixels.y) /
|
||||
@ -2717,8 +2717,8 @@ nsLayoutUtils::TransformPoint(nsIFrame* aFromFrame, nsIFrame* aToFrame,
|
||||
float devPixelsPerAppUnitToFrame =
|
||||
1.0f / aToFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
Point4D toDevPixels = downToDest.ProjectPoint(
|
||||
upToAncestor * Point(aPoint.x * devPixelsPerAppUnitFromFrame,
|
||||
aPoint.y * devPixelsPerAppUnitFromFrame));
|
||||
upToAncestor.TransformPoint(Point(aPoint.x * devPixelsPerAppUnitFromFrame,
|
||||
aPoint.y * devPixelsPerAppUnitFromFrame)));
|
||||
if (!toDevPixels.HasPositiveWCoord()) {
|
||||
// Not strictly true, but we failed to get a valid point in this
|
||||
// coordinate space.
|
||||
|
@ -4227,7 +4227,7 @@ SVGTextFrame::GetEndPositionOfChar(nsIContent* aContent,
|
||||
Matrix m =
|
||||
Matrix::Rotation(mPositions[startIndex].mAngle) *
|
||||
Matrix::Translation(ToPoint(mPositions[startIndex].mPosition));
|
||||
Point p = m * Point(advance / mFontSizeScaleFactor, 0);
|
||||
Point p = m.TransformPoint(Point(advance / mFontSizeScaleFactor, 0));
|
||||
|
||||
NS_ADDREF(*aResult = new DOMSVGPoint(p));
|
||||
return NS_OK;
|
||||
|
@ -366,7 +366,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint)
|
||||
// coordinate system in order for non-scaled stroke to be correct.
|
||||
// Naturally we also need to transform the point into the same
|
||||
// coordinate system in order to hit-test against the path.
|
||||
point = ToMatrix(userToOuterSVG) * point;
|
||||
point = ToMatrix(userToOuterSVG).TransformPoint(point);
|
||||
RefPtr<PathBuilder> builder =
|
||||
path->TransformedCopyToBuilder(ToMatrix(userToOuterSVG), fillRule);
|
||||
path = builder->Finish();
|
||||
|
@ -877,7 +877,7 @@ nsSVGUtils::HitTestRect(const gfx::Matrix &aMatrix,
|
||||
}
|
||||
gfx::Matrix toRectSpace = aMatrix;
|
||||
toRectSpace.Invert();
|
||||
gfx::Point p = toRectSpace * gfx::Point(aX, aY);
|
||||
gfx::Point p = toRectSpace.TransformPoint(gfx::Point(aX, aY));
|
||||
return rect.x <= p.x && p.x <= rect.XMost() &&
|
||||
rect.y <= p.y && p.y <= rect.YMost();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user