Bug 1091321, part 5 - Convert nsSVGMarkerFrame::PaintMark and related code from nsRenderingContext to gfxContext. r=longsonr

This commit is contained in:
Jonathan Watt 2014-10-31 20:08:54 +00:00
parent f50ba2b4ec
commit c751f5521c
7 changed files with 14 additions and 23 deletions

View File

@ -3716,7 +3716,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
if (drawMode != DrawMode(0)) {
nsRect frameRect = frame->GetVisualOverflowRect();
bool paintSVGGlyphs;
if (ShouldRenderAsPath(&rendCtx, frame, paintSVGGlyphs)) {
if (ShouldRenderAsPath(frame, paintSVGGlyphs)) {
SVGTextDrawPathCallbacks callbacks(&rendCtx, frame,
matrixForPaintServers,
paintSVGGlyphs);
@ -5128,8 +5128,7 @@ SVGTextFrame::DoGlyphPositioning()
}
bool
SVGTextFrame::ShouldRenderAsPath(nsRenderingContext* aContext,
nsTextFrame* aFrame,
SVGTextFrame::ShouldRenderAsPath(nsTextFrame* aFrame,
bool& aShouldPaintSVGGlyphs)
{
// Rendering to a clip path.

View File

@ -592,8 +592,7 @@ private:
* @param aShouldPaintSVGGlyphs (out) Whether SVG glyphs in the text
* should be painted.
*/
bool ShouldRenderAsPath(nsRenderingContext* aContext, nsTextFrame* aFrame,
bool& aShouldPaintSVGGlyphs);
bool ShouldRenderAsPath(nsTextFrame* aFrame, bool& aShouldPaintSVGGlyphs);
// Methods to get information for a <textPath> frame.
nsIFrame* GetTextPathPathFrame(nsIFrame* aTextPathFrame);

View File

@ -8,7 +8,6 @@
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
#include "nsRenderingContext.h"
#include "nsSVGEffects.h"
#include "mozilla/dom/SVGMarkerElement.h"
#include "nsSVGPathGeometryElement.h"
@ -103,7 +102,7 @@ GetAnonymousChildFrame(nsIFrame* aFrame)
}
nsresult
nsSVGMarkerFrame::PaintMark(nsRenderingContext *aContext,
nsSVGMarkerFrame::PaintMark(gfxContext& aContext,
const gfxMatrix& aToMarkedFrameUserSpace,
nsSVGPathGeometryFrame *aMarkedFrame,
nsSVGMark *aMark, float aStrokeWidth)
@ -142,14 +141,12 @@ nsSVGMarkerFrame::PaintMark(nsRenderingContext *aContext,
gfxMatrix markTM = ThebesMatrix(viewBoxTM) * ThebesMatrix(markerTM) *
aToMarkedFrameUserSpace;
gfxContext *gfx = aContext->ThebesContext();
if (StyleDisplay()->IsScrollableOverflow()) {
gfx->Save();
aContext.Save();
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, viewBox.x, viewBox.y,
viewBox.width, viewBox.height);
nsSVGUtils::SetClipRect(gfx, markTM, clipRect);
nsSVGUtils::SetClipRect(&aContext, markTM, clipRect);
}
@ -157,10 +154,10 @@ nsSVGMarkerFrame::PaintMark(nsRenderingContext *aContext,
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
// The CTM of each frame referencing us may be different.
SVGFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
nsSVGUtils::PaintFrameWithEffects(kid, *gfx, markTM);
nsSVGUtils::PaintFrameWithEffects(kid, aContext, markTM);
if (StyleDisplay()->IsScrollableOverflow())
gfx->Restore();
aContext.Restore();
return NS_OK;
}

View File

@ -15,7 +15,7 @@
#include "nsSVGContainerFrame.h"
#include "nsSVGUtils.h"
class nsRenderingContext;
class gfxContext;
class nsSVGPathGeometryFrame;
namespace mozilla {
@ -84,7 +84,7 @@ public:
}
// nsSVGMarkerFrame methods:
nsresult PaintMark(nsRenderingContext *aContext,
nsresult PaintMark(gfxContext& aContext,
const gfxMatrix& aToMarkedFrameUserSpace,
nsSVGPathGeometryFrame *aMarkedFrame,
nsSVGMark *aMark,

View File

@ -11,7 +11,6 @@
#include "gfxContext.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsRenderingContext.h"
#include "nsSVGEffects.h"
#include "mozilla/dom/SVGMaskElement.h"
@ -226,8 +225,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
gfxMatrix maskSurfaceMatrix =
aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
nsRenderingContext tmpCtx(maskDT);
tmpCtx.ThebesContext()->SetMatrix(maskSurfaceMatrix);
nsRefPtr<gfxContext> tmpCtx = new gfxContext(maskDT);
tmpCtx->SetMatrix(maskSurfaceMatrix);
mMatrixForChildren = GetMaskTransform(aMaskedFrame) * aMatrix;
@ -243,7 +242,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
m = static_cast<nsSVGElement*>(kid->GetContent())->
PrependLocalTransformsTo(m);
}
nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx.ThebesContext(), mMatrixForChildren);
nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, mMatrixForChildren);
}
RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();

View File

@ -15,7 +15,6 @@
#include "nsSVGUtils.h"
class gfxContext;
class nsRenderingContext;
typedef nsSVGContainerFrame nsSVGMaskFrameBase;

View File

@ -821,8 +821,6 @@ nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
uint32_t num = marks.Length();
if (num) {
nsRenderingContext rendCtx(&aContext);
// These are in the same order as the nsSVGMark::Type constants.
nsSVGMarkerFrame* markerFrames[] = {
properties.GetMarkerStartFrame(),
@ -835,7 +833,7 @@ nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
nsSVGMark& mark = marks[i];
nsSVGMarkerFrame* frame = markerFrames[mark.type];
if (frame) {
frame->PaintMark(&rendCtx, aTransform, this, &mark, strokeWidth);
frame->PaintMark(aContext, aTransform, this, &mark, strokeWidth);
}
}
}