Backed out changeset e6b766d8a815 (bug 1065127) for bustage

This commit is contained in:
Carsten "Tomcat" Book 2014-09-10 14:30:36 +02:00
parent 59fe4663ba
commit 0495ac7e6b
26 changed files with 66 additions and 56 deletions

View File

@ -425,7 +425,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
}
}
}
return ToMatrix(matrix).PostTranslate(x, y);
return gfx::ToMatrix(matrix) * gfx::Matrix().Translate(x, y);
}
gfx::Matrix

View File

@ -231,8 +231,8 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
SVGContentUtils::GetViewBoxTransform(aFilterSubregion.width, aFilterSubregion.height,
0, 0, nativeSize.width, nativeSize.height,
mPreserveAspectRatio);
Matrix TM = viewBoxTM;
TM.PostTranslate(aFilterSubregion.x, aFilterSubregion.y);
Matrix xyTM = Matrix().Translate(aFilterSubregion.x, aFilterSubregion.y);
Matrix TM = viewBoxTM * xyTM;
Filter filter = ToFilter(nsLayoutUtils::GetGraphicsFilterForFrame(frame));

View File

@ -85,7 +85,7 @@ SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
float x, y;
const_cast<SVGForeignObjectElement*>(this)->
GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace * aMatrix;
}

View File

@ -74,7 +74,7 @@ SVGIFrameElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
float x, y;
const_cast<SVGIFrameElement*>(this)->
GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace;
}

View File

@ -16,8 +16,6 @@
#include "mozilla/gfx/Matrix.h"
#include "SVGContentUtils.h"
using namespace mozilla::gfx;
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Marker)
namespace mozilla {
@ -361,8 +359,7 @@ SVGMarkerElement::GetViewBoxTransform()
gfx::Point ref = viewBoxTM * gfx::Point(refX, refY);
Matrix TM = viewBoxTM;
TM.PostTranslate(-ref.x, -ref.y);
gfx::Matrix TM = viewBoxTM * gfx::Matrix().Translate(-ref.x, -ref.y);
mViewBoxToViewportTransform = new gfx::Matrix(TM);
}

View File

@ -968,10 +968,10 @@ SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
const_cast<SVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
if (aWhich == eAllTransforms) {
// the common case
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix::Translation(x, y) * fromUserSpace;
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix().Translate(gfxPoint(x, y)) * fromUserSpace;
}
NS_ABORT_IF_FALSE(aWhich == eChildToUserSpace, "Unknown TransformTypes");
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix::Translation(x, y) * aMatrix;
return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix().Translate(gfxPoint(x, y)) * aMatrix;
}
if (IsRoot()) {

View File

@ -434,7 +434,7 @@ SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
// our 'x' and 'y' attributes:
float x, y;
const_cast<SVGUseElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
gfxMatrix toUserSpace = gfxMatrix::Translation(x, y);
gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
if (aWhich == eChildToUserSpace) {
return toUserSpace * aMatrix;
}

View File

@ -95,8 +95,8 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface,
// Here we scale the source pattern up to the size and position where we want
// it to be.
Matrix transform;
transform.PreTranslate(aDest.x, aDest.y);
transform.PreScale(xScale, yScale);
transform.Translate(aDest.x, aDest.y);
transform.Scale(xScale, yScale);
mDC->CreateImageBrush(image, D2D1::ImageBrushProperties(samplingBounds),
D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(transform)),

View File

@ -122,8 +122,8 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
Matrix oldTransform = aTarget->GetTransform();
// Transform from user -> buffer space.
Matrix transform =
Matrix::Translation(quadrantTranslation.x, quadrantTranslation.y);
Matrix transform;
transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
Matrix inverseMask = *aMaskTransform;
inverseMask.Invert();
@ -661,7 +661,8 @@ RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) {
// Copy the bits
nsIntPoint offset = -destBufferRect.TopLeft();
Matrix mat = Matrix::Translation(offset.x, offset.y);
Matrix mat;
mat.Translate(offset.x, offset.y);
destDTBuffer->SetTransform(mat);
if (!EnsureBuffer()) {
return result;

View File

@ -261,7 +261,9 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
return;
}
dest->SetTransform(Matrix::Translation(-aRect.x, -aRect.y));
Matrix destTransform;
destTransform.Translate(-aRect.x, -aRect.y);
dest->SetTransform(destTransform);
// Get the bounds post-transform.
new3DTransform = To3DMatrix(aTransform);
@ -272,7 +274,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect,
transformBounds.RoundOut();
// Propagate the coordinate offset to our 2D draw target.
newTransform = Matrix::Translation(transformBounds.x, transformBounds.y);
newTransform.Translate(transformBounds.x, transformBounds.y);
// When we apply the 3D transformation, we do it against a temporary
// surface, so undo the coordinate offset.
@ -439,8 +441,9 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
// We only allocate a surface sized to the invalidated region, so we need to
// translate future coordinates.
mRenderTarget->mDrawTarget->SetTransform(Matrix::Translation(-invalidRect.x,
-invalidRect.y));
Matrix transform;
transform.Translate(-invalidRect.x, -invalidRect.y);
mRenderTarget->mDrawTarget->SetTransform(transform);
gfxUtils::ClipToRegion(mRenderTarget->mDrawTarget, invalidRegionSafe);

View File

@ -829,7 +829,8 @@ CompositorD3D11::PrepareViewport(const gfx::IntSize& aSize,
mContext->RSSetViewports(1, &viewport);
Matrix viewMatrix = Matrix::Translation(-1.0, 1.0);
Matrix viewMatrix;
viewMatrix.Translate(-1.0, 1.0);
viewMatrix.Scale(2.0f / float(aSize.width), 2.0f / float(aSize.height));
viewMatrix.Scale(1.0f, -1.0f);

View File

@ -1055,8 +1055,9 @@ gfxContext::Paint(gfxFloat alpha)
IntSize surfSize = state.sourceSurface->GetSize();
mDT->SetTransform(Matrix::Translation(-state.deviceOffset.x,
-state.deviceOffset.y));
Matrix mat;
mat.Translate(-state.deviceOffset.x, -state.deviceOffset.y);
mDT->SetTransform(mat);
mDT->DrawSurface(state.sourceSurface,
Rect(state.sourceSurfaceDeviceOffset, Size(surfSize.width, surfSize.height)),
@ -1618,8 +1619,9 @@ gfxContext::GetDeviceOffset() const
Matrix
gfxContext::GetDeviceTransform() const
{
return Matrix::Translation(-CurrentState().deviceOffset.x,
-CurrentState().deviceOffset.y);
Matrix mat;
mat.Translate(-CurrentState().deviceOffset.x, -CurrentState().deviceOffset.y);
return mat;
}
Matrix

View File

@ -407,10 +407,10 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable,
nsRefPtr<gfxContext> tmpCtx = new gfxContext(target);
tmpCtx->SetOperator(OptimalFillOperator());
aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true,
GraphicsFilter::FILTER_FAST, 1.0, gfxMatrix::Translation(needed.TopLeft()));
GraphicsFilter::FILTER_FAST, 1.0, gfxMatrix().Translate(needed.TopLeft()));
RefPtr<SourceSurface> surface = target->Snapshot();
nsRefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft()));
nsRefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix().Translate(-needed.TopLeft()));
return drawable.forget();
}
#endif // !MOZ_GFX_OPTIMIZE_MOBILE

View File

@ -1725,7 +1725,8 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot
RoundToMatchResidual(scaledOffset.y, data->mAnimatedGeometryRootPosition.y));
data->mTranslation = pixOffset;
pixOffset += mParameters.mOffset;
Matrix matrix = Matrix::Translation(pixOffset.x, pixOffset.y);
Matrix matrix;
matrix.Translate(pixOffset.x, pixOffset.y);
layer->SetBaseTransform(Matrix4x4::From2D(matrix));
// FIXME: Temporary workaround for bug 681192 and bug 724786.
@ -2566,8 +2567,8 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
itemVisibleRect.Size().ToIntSize(),
SurfaceFormat::B8G8R8A8);
context = new gfxContext(tempDT);
context->SetMatrix(gfxMatrix::Translation(-itemVisibleRect.x,
-itemVisibleRect.y));
context->SetMatrix(gfxMatrix().Translate(-gfxPoint(itemVisibleRect.x,
itemVisibleRect.y)));
}
#endif
basic->BeginTransaction();
@ -4183,7 +4184,7 @@ static void DebugPaintItem(nsRenderingContext* aDest,
IntSize(bounds.width, bounds.height),
SurfaceFormat::B8G8R8A8);
nsRefPtr<gfxContext> context = new gfxContext(tempDT);
context->SetMatrix(gfxMatrix::Translation(-gfxPoint(bounds.x, bounds.y)));
context->SetMatrix(gfxMatrix().Translate(-gfxPoint(bounds.x, bounds.y)));
nsRefPtr<nsRenderingContext> ctx = new nsRenderingContext();
ctx->Init(aDest->DeviceContext(), context);
@ -4616,9 +4617,9 @@ ContainerState::SetupMaskLayer(Layer *aLayer,
// component of imageTransform), and its inverse used when the mask is used for
// masking.
// It is the transform from the masked layer's space to mask space
gfx::Matrix maskTransform =
Matrix::Scaling(surfaceSize.width / boundingRect.Width(),
surfaceSize.height / boundingRect.Height());
gfx::Matrix maskTransform;
maskTransform.Scale(surfaceSize.width/boundingRect.Width(),
surfaceSize.height/boundingRect.Height());
gfx::Point p = boundingRect.TopLeft();
maskTransform.Translate(-p.x, -p.y);
// imageTransform is only used when the clip is painted to the mask

View File

@ -2179,7 +2179,8 @@ nsDisplayBackgroundImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& a
NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!");
gfxPoint p = mDestRect.TopLeft() + aOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
gfx::Matrix transform;
transform.Translate(p.x, p.y);
transform.Scale(mDestRect.width/imageSize.width,
mDestRect.height/imageSize.height);
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));

View File

@ -19,7 +19,6 @@
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::gfx;
class nsDisplayCanvas : public nsDisplayItem {
public:
@ -281,8 +280,9 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
presContext->AppUnitsToGfxUnits(area.height));
// Transform the canvas into the right place
gfx::Matrix transform;
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
transform.Translate(p.x, p.y);
transform.Scale(r.Width()/canvasSize.width, r.Height()/canvasSize.height);
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));

View File

@ -85,7 +85,6 @@ using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::dom;
using namespace mozilla::gfx;
// static icon information
nsImageFrame::IconLoad* nsImageFrame::gIconLoad = nullptr;
@ -1443,8 +1442,9 @@ nsDisplayImage::ConfigureLayer(ImageLayer *aLayer, const nsIntPoint& aOffset)
const gfxRect destRect = GetDestRect();
gfx::Matrix transform;
gfxPoint p = destRect.TopLeft() + aOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
transform.Translate(p.x, p.y);
transform.Scale(destRect.Width()/imageWidth,
destRect.Height()/imageHeight);
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));

View File

@ -1576,8 +1576,9 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
}
// Set a transform on the layer to draw the plugin in the right place
Matrix transform;
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
transform.Translate(p.x, p.y);
layer->SetBaseTransform(Matrix4x4::From2D(transform));
return layer.forget();

View File

@ -222,8 +222,9 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
layer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
layer->SetContentFlags(Layer::CONTENT_OPAQUE);
// Set a transform on the layer to draw the video in the right place
gfx::Matrix transform;
gfxPoint p = r.TopLeft() + aContainerParameters.mOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
transform.Translate(p.x, p.y);
transform.Scale(r.Width()/frameSize.width, r.Height()/frameSize.height);
layer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));
nsRefPtr<Layer> result = layer.forget();

View File

@ -548,5 +548,5 @@ nsFilterInstance::FilterSpaceToFrameSpace(const nsIntRegion& aRegion) const
gfxMatrix
nsFilterInstance::GetUserSpaceToFrameSpaceInCSSPxTransform() const
{
return gfxMatrix::Translation(-nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mTargetFrame));
return gfxMatrix().Translate(-nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mTargetFrame));
}

View File

@ -643,7 +643,7 @@ PaintFrameCallback::operator()(gfxContext* aContext,
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
nsPoint offset = GetOffsetToBoundingBox(mFrame);
gfxPoint devPxOffset = gfxPoint(offset.x, offset.y) / appUnitsPerDevPixel;
aContext->Multiply(gfxMatrix::Translation(devPxOffset));
aContext->Multiply(gfxMatrix().Translate(devPxOffset));
gfxSize paintServerSize =
gfxSize(mPaintServerSize.width, mPaintServerSize.height) /
@ -653,7 +653,8 @@ PaintFrameCallback::operator()(gfxContext* aContext,
// want it to render with mRenderSize, so we need to set up a scale transform.
gfxFloat scaleX = mRenderSize.width / paintServerSize.width;
gfxFloat scaleY = mRenderSize.height / paintServerSize.height;
aContext->Multiply(gfxMatrix::Scaling(scaleX, scaleY));
gfxMatrix scaleMatrix = gfxMatrix().Scale(scaleX, scaleY);
aContext->Multiply(scaleMatrix);
// Draw.
nsRect dirty(-offset.x, -offset.y,

View File

@ -223,7 +223,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
}
gfxMatrix maskSurfaceMatrix =
aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
aContext->CurrentMatrix() * gfxMatrix().Translate(-maskSurfaceRect.TopLeft());
nsRefPtr<nsRenderingContext> tmpCtx = new nsRenderingContext();
tmpCtx->Init(this->PresContext()->DeviceContext(), maskDT);

View File

@ -864,7 +864,7 @@ nsSVGOuterSVGFrame::GetCanvasTM()
PresContext()->AppUnitsPerDevPixel());
gfxMatrix tm = content->PrependLocalTransformsTo(
gfxMatrix::Scaling(devPxPerCSSPx, devPxPerCSSPx));
gfxMatrix().Scale(devPxPerCSSPx, devPxPerCSSPx));
mCanvasTM = new gfxMatrix(tm);
}
return *mCanvasTM;

View File

@ -958,8 +958,9 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
nsRefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits();
if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
matrix.Translate(gfxPoint(x, y));
matrix.Scale(width, height);
matrix = gfxMatrix().Scale(width, height) *
gfxMatrix().Translate(gfxPoint(x, y)) *
matrix;
} else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
matrix.Reset();
}
@ -1071,10 +1072,9 @@ nsSVGUtils::AdjustMatrixForUnits(const gfxMatrix &aMatrix,
if (aFrame &&
aUnits->GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
gfxRect bbox = GetBBox(aFrame);
gfxMatrix tm = aMatrix;
tm.Translate(gfxPoint(bbox.X(), bbox.Y()));
tm.Scale(bbox.Width(), bbox.Height());
return tm;
return gfxMatrix().Scale(bbox.Width(), bbox.Height()) *
gfxMatrix().Translate(gfxPoint(bbox.X(), bbox.Y())) *
aMatrix;
}
return aMatrix;
}

View File

@ -54,7 +54,6 @@
#define ONLOAD_CALLED_TOO_EARLY 1
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layers;
class nsImageBoxFrameEvent : public nsRunnable
@ -403,7 +402,8 @@ nsDisplayXULImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& aOffset)
NS_ASSERTION(imageWidth != 0 && imageHeight != 0, "Invalid image size!");
gfxPoint p = destRect.TopLeft() + aOffset;
Matrix transform = Matrix::Translation(p.x, p.y);
gfx::Matrix transform;
transform.Translate(p.x, p.y);
transform.Scale(destRect.Width()/imageWidth,
destRect.Height()/imageHeight);
aLayer->SetBaseTransform(gfx::Matrix4x4::From2D(transform));

View File

@ -3013,7 +3013,8 @@ GLPresenter::BeginFrame(nsIntSize aRenderSize)
// Matrix to transform (0, 0, width, height) to viewport space (-1.0, 1.0,
// 2, 2) and flip the contents.
gfx::Matrix viewMatrix = gfx::Matrix::Translation(-1.0, 1.0);
gfx::Matrix viewMatrix;
viewMatrix.Translate(-1.0, 1.0);
viewMatrix.Scale(2.0f / float(aRenderSize.width), 2.0f / float(aRenderSize.height));
viewMatrix.Scale(1.0f, -1.0f);