Bug 952977: Switch GeneratePath to gfx::Matrix r=nical

This commit is contained in:
David Zbarsky 2013-12-30 16:42:32 -05:00
parent 59faaf84bd
commit 4611bb78dd
3 changed files with 9 additions and 9 deletions

View File

@ -5,7 +5,6 @@
// Keep in (case-insensitive) order:
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "gfxPlatform.h"
#include "imgIContainer.h"
#include "nsIImageLoadingContent.h"
@ -484,7 +483,7 @@ nsSVGImageFrame::ReflowSVG()
gfxSize scaleFactors = GetCanvasTM(FOR_OUTERSVG_TM).ScaleFactors(true);
bool applyScaling = fabs(scaleFactors.width) >= 1e-6 &&
fabs(scaleFactors.height) >= 1e-6;
gfxMatrix scaling;
Matrix scaling;
if (applyScaling) {
scaling.Scale(scaleFactors.width, scaleFactors.height);
}

View File

@ -22,6 +22,7 @@
#include "SVGGraphicsElement.h"
using namespace mozilla;
using namespace mozilla::gfx;
//----------------------------------------------------------------------
// Implementation
@ -248,7 +249,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const nsPoint &aPoint)
nsRefPtr<gfxContext> tmpCtx =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(tmpCtx, canvasTM);
GeneratePath(tmpCtx, ToMatrix(canvasTM));
gfxPoint userSpacePoint =
tmpCtx->DeviceToUser(gfxPoint(PresContext()->AppUnitsToGfxUnits(aPoint.x),
PresContext()->AppUnitsToGfxUnits(aPoint.y)));
@ -411,7 +412,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
nsRefPtr<gfxContext> tmpCtx =
new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceSurface());
GeneratePath(tmpCtx, ThebesMatrix(aToBBoxUserspace));
GeneratePath(tmpCtx, aToBBoxUserspace);
tmpCtx->IdentityMatrix();
// Be careful when replacing the following logic to get the fill and stroke
@ -607,7 +608,7 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
autoSaveRestore.SetContext(gfx);
}
GeneratePath(gfx, GetCanvasTM(FOR_PAINTING, aTransformRoot));
GeneratePath(gfx, ToMatrix(GetCanvasTM(FOR_PAINTING, aTransformRoot)));
// We used to call gfx->Restore() here, since for the
// SVGAutoRenderState::CLIP case it is important to leave the fill rule
@ -636,7 +637,7 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
gfxContextAutoSaveRestore autoSaveRestore(gfx);
GeneratePath(gfx, GetCanvasTM(FOR_PAINTING, aTransformRoot));
GeneratePath(gfx, ToMatrix(GetCanvasTM(FOR_PAINTING, aTransformRoot)));
gfxTextContextPaint *contextPaint =
(gfxTextContextPaint*)aContext->GetUserData(&gfxTextContextPaint::sUserDataKey);
@ -656,7 +657,7 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
void
nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext,
const gfxMatrix &aTransform)
const Matrix &aTransform)
{
if (aTransform.IsSingular()) {
aContext->IdentityMatrix();
@ -664,7 +665,7 @@ nsSVGPathGeometryFrame::GeneratePath(gfxContext* aContext,
return;
}
aContext->MultiplyAndNudgeToIntegers(aTransform);
aContext->MultiplyAndNudgeToIntegers(ThebesMatrix(aTransform));
// Hack to let SVGPathData::ConstructPath know if we have square caps:
const nsStyleSVG* style = StyleSVG();

View File

@ -98,7 +98,7 @@ protected:
NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return false; }
protected:
void GeneratePath(gfxContext *aContext, const gfxMatrix &aTransform);
void GeneratePath(gfxContext *aContext, const Matrix &aTransform);
private:
enum { eRenderFill = 1, eRenderStroke = 2 };