Bug 1073854, part 2 - Get rid of nsSVGUtils::SetupCairoStroke. r=longsonr

This commit is contained in:
Jonathan Watt 2014-09-29 14:12:07 +01:00
parent c51d260131
commit 382a6eff7b
4 changed files with 17 additions and 30 deletions

View File

@ -2974,11 +2974,17 @@ SVGTextDrawPathCallbacks::FillGeometry()
void
SVGTextDrawPathCallbacks::StrokeGeometry()
{
// We don't paint the stroke when we are filling with a selection color.
if (mColor == NS_SAME_AS_FOREGROUND_COLOR ||
mColor == NS_40PERCENT_FOREGROUND_COLOR) {
// Don't paint the stroke when we are filling with a selection color.
if (nsSVGUtils::SetupCairoStroke(mFrame, gfx)) {
gfx->Stroke();
if (nsSVGUtils::HasStroke(mFrame, /*aContextPaint*/ nullptr)) {
nsRefPtr<gfxPattern> strokePattern =
nsSVGUtils::MakeStrokePatternFor(mFrame, gfx, /*aContextPaint*/ nullptr);
if (strokePattern) {
nsSVGUtils::SetupCairoStrokeGeometry(mFrame, gfx, /*aContextPaint*/ nullptr);
gfx->SetPattern(strokePattern);
gfx->Stroke();
}
}
}
}

View File

@ -695,8 +695,14 @@ nsSVGPathGeometryFrame::Render(nsRenderingContext *aContext,
}
if ((aRenderComponents & eRenderStroke) &&
nsSVGUtils::SetupCairoStroke(this, gfx, contextPaint)) {
gfx->Stroke();
nsSVGUtils::HasStroke(this, contextPaint)) {
nsRefPtr<gfxPattern> strokePattern =
nsSVGUtils::MakeStrokePatternFor(this, gfx, contextPaint);
if (strokePattern) {
nsSVGUtils::SetupCairoStrokeGeometry(this, gfx, contextPaint);
gfx->SetPattern(strokePattern);
gfx->Stroke();
}
}
gfx->NewPath();

View File

@ -1581,24 +1581,6 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame)
return flags;
}
bool
nsSVGUtils::SetupCairoStroke(nsIFrame* aFrame, gfxContext* aContext,
gfxTextContextPaint *aContextPaint)
{
if (!HasStroke(aFrame, aContextPaint)) {
return false;
}
SetupCairoStrokeGeometry(aFrame, aContext, aContextPaint);
nsRefPtr<gfxPattern> pattern =
MakeStrokePatternFor(aFrame, aContext, aContextPaint);
if (pattern) {
aContext->SetPattern(pattern);
return true;
}
return false;
}
bool
nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
DrawMode aDrawMode,

View File

@ -536,13 +536,6 @@ public:
static void SetupCairoStrokeGeometry(nsIFrame* aFrame, gfxContext *aContext,
gfxTextContextPaint *aContextPaint = nullptr);
/*
* Set up a cairo context for stroking, including setting up any stroke-related
* properties such as dashing and setting the current paint on the gfxContext.
*/
static bool SetupCairoStroke(nsIFrame* aFrame, gfxContext *aContext,
gfxTextContextPaint *aContextPaint = nullptr);
/**
* This function returns a set of bit flags indicating which parts of the
* element (fill, stroke, bounds) should intercept pointer events. It takes