Bug 1091321, part 4 - Convert nsISVGChildFrame::PaintSVG 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 79fb6f75d1
commit f50ba2b4ec
18 changed files with 90 additions and 96 deletions

View File

@ -3148,8 +3148,10 @@ void
nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
gfxContext* ctx = aCtx->ThebesContext();
gfxContextAutoDisableSubpixelAntialiasing
disable(aCtx->ThebesContext(), mDisableSubpixelAA);
disable(ctx, mDisableSubpixelAA);
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
@ -3164,9 +3166,9 @@ nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder,
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
aCtx->ThebesContext()->Save();
static_cast<SVGTextFrame*>(mFrame)->PaintSVG(aCtx, tm);
aCtx->ThebesContext()->Restore();
ctx->Save();
static_cast<SVGTextFrame*>(mFrame)->PaintSVG(*ctx, tm);
ctx->Restore();
}
// ---------------------------------------------------------------------
@ -3595,18 +3597,19 @@ ShouldPaintCaret(const TextRenderedRun& aThisRun, nsCaret* aCaret)
}
nsresult
SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
SVGTextFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
{
DrawTarget& aDrawTarget = *aContext.GetDrawTarget();
nsIFrame* kid = GetFirstPrincipalChild();
if (!kid)
return NS_OK;
nsPresContext* presContext = PresContext();
gfxContext *gfx = aContext->ThebesContext();
gfxMatrix initialMatrix = gfx->CurrentMatrix();
gfxMatrix initialMatrix = aContext.CurrentMatrix();
if (mState & NS_FRAME_IS_NONDISPLAY) {
// If we are in a canvas DrawWindow call that used the
@ -3664,10 +3667,10 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
canvasTMForChildren.Scale(cssPxPerDevPx, cssPxPerDevPx);
initialMatrix.Scale(1 / cssPxPerDevPx, 1 / cssPxPerDevPx);
gfxContextAutoSaveRestore save(gfx);
gfx->NewPath();
gfx->Multiply(canvasTMForChildren);
gfxMatrix currentMatrix = gfx->CurrentMatrix();
gfxContextAutoSaveRestore save(&aContext);
aContext.NewPath();
aContext.Multiply(canvasTMForChildren);
gfxMatrix currentMatrix = aContext.CurrentMatrix();
nsRefPtr<nsCaret> caret = presContext->PresShell()->GetCaret();
nsRect caretRect;
@ -3675,6 +3678,12 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
TextRenderedRunIterator it(this, TextRenderedRunIterator::eVisibleFrames);
TextRenderedRun run = it.Current();
gfxTextContextPaint *outerContextPaint =
(gfxTextContextPaint*)aDrawTarget.GetUserData(&gfxTextContextPaint::sUserDataKey);
nsRenderingContext rendCtx(&aContext);
while (run.mFrame) {
nsTextFrame* frame = run.mFrame;
@ -3684,19 +3693,17 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
// Set up the fill and stroke so that SVG glyphs can get painted correctly
// when they use context-fill etc.
gfx->SetMatrix(initialMatrix);
gfxTextContextPaint *outerContextPaint =
(gfxTextContextPaint*)aContext->GetDrawTarget()->GetUserData(&gfxTextContextPaint::sUserDataKey);
aContext.SetMatrix(initialMatrix);
SVGTextContextPaint contextPaint;
DrawMode drawMode =
SetupContextPaint(gfx->GetDrawTarget(), gfx->CurrentMatrix(),
SetupContextPaint(&aDrawTarget, aContext.CurrentMatrix(),
frame, outerContextPaint, &contextPaint);
if (int(drawMode) & int(DrawMode::GLYPH_STROKE)) {
// This may change the gfxContext's transform (for non-scaling stroke),
// in which case this needs to happen before we call SetMatrix() below.
nsSVGUtils::SetupCairoStrokeGeometry(frame, gfx, outerContextPaint);
nsSVGUtils::SetupCairoStrokeGeometry(frame, &aContext, outerContextPaint);
}
// Set up the transform for painting the text frame for the substring
@ -3704,19 +3711,19 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
gfxMatrix runTransform =
run.GetTransformFromUserSpaceForPainting(presContext, item) *
currentMatrix;
gfx->SetMatrix(runTransform);
aContext.SetMatrix(runTransform);
if (drawMode != DrawMode(0)) {
nsRect frameRect = frame->GetVisualOverflowRect();
bool paintSVGGlyphs;
if (ShouldRenderAsPath(aContext, frame, paintSVGGlyphs)) {
SVGTextDrawPathCallbacks callbacks(aContext, frame,
if (ShouldRenderAsPath(&rendCtx, frame, paintSVGGlyphs)) {
SVGTextDrawPathCallbacks callbacks(&rendCtx, frame,
matrixForPaintServers,
paintSVGGlyphs);
frame->PaintText(aContext, nsPoint(), frameRect, item,
frame->PaintText(&rendCtx, nsPoint(), frameRect, item,
&contextPaint, &callbacks);
} else {
frame->PaintText(aContext, nsPoint(), frameRect, item,
frame->PaintText(&rendCtx, nsPoint(), frameRect, item,
&contextPaint, nullptr);
}
}
@ -3724,8 +3731,8 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
if (frame == caretFrame && ShouldPaintCaret(run, caret)) {
// XXX Should we be looking at the fill/stroke colours to paint the
// caret with, rather than using the color property?
caret->PaintCaret(nullptr, *aContext->GetDrawTarget(), frame, nsPoint());
gfx->NewPath();
caret->PaintCaret(nullptr, aDrawTarget, frame, nsPoint());
aContext.NewPath();
}
run = it.Next();

View File

@ -16,8 +16,8 @@
#include "nsStubMutationObserver.h"
#include "nsSVGPaintServerFrame.h"
class gfxContext;
class nsDisplaySVGText;
class nsRenderingContext;
class SVGTextFrame;
class nsTextFrame;
@ -324,7 +324,7 @@ public:
// nsISVGChildFrame interface:
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
virtual nsresult PaintSVG(nsRenderingContext* aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;

View File

@ -9,9 +9,9 @@
#include "gfxRect.h"
#include "nsQueryFrame.h"
class gfxContext;
class gfxMatrix;
class nsIFrame;
class nsRenderingContext;
class SVGBBox;
struct nsPoint;
@ -75,7 +75,7 @@ public:
* @param aDirtyRect The area being redrawn, in frame offset pixel
* coordinates.
*/
virtual nsresult PaintSVG(nsRenderingContext* aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) = 0;

View File

@ -10,7 +10,6 @@
#include "gfxContext.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h"
#include "nsRenderingContext.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
@ -100,8 +99,6 @@ nsSVGClipPathFrame::ApplyClipOrPaintClipMask(gfxContext& aContext,
}
}
nsRenderingContext rendCtx(&aContext);
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsISVGChildFrame* SVGFrame = do_QueryFrame(kid);
@ -137,7 +134,7 @@ nsSVGClipPathFrame::ApplyClipOrPaintClipMask(gfxContext& aContext,
PrependLocalTransformsTo(mMatrixForChildren,
nsSVGElement::eUserSpaceToParent);
}
SVGFrame->PaintSVG(&rendCtx, toChildsUserSpace);
SVGFrame->PaintSVG(aContext, toChildsUserSpace);
if (clipPathFrame) {
if (!isTrivial) {

View File

@ -248,7 +248,7 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
// nsISVGChildFrame methods
nsresult
nsSVGDisplayContainerFrame::PaintSVG(nsRenderingContext* aContext,
nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
{
@ -290,7 +290,7 @@ nsSVGDisplayContainerFrame::PaintSVG(nsRenderingContext* aContext,
continue;
}
}
nsSVGUtils::PaintFrameWithEffects(kid, *aContext->ThebesContext(), m, aDirtyRect);
nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aDirtyRect);
}
return NS_OK;

View File

@ -15,10 +15,10 @@
#include "nsRect.h"
#include "nsSVGUtils.h"
class gfxContext;
class nsFrameList;
class nsIContent;
class nsIPresShell;
class nsRenderingContext;
class nsStyleContext;
struct nsPoint;
@ -144,7 +144,7 @@ public:
Matrix *aFromParentTransform = nullptr) const MOZ_OVERRIDE;
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext* aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;

View File

@ -192,7 +192,7 @@ nsSVGForeignObjectFrame::IsSVGTransformed(Matrix *aOwnTransform,
}
nsresult
nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext,
nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
{
@ -241,9 +241,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext,
return NS_OK;
}
gfxContext *gfx = aContext->ThebesContext();
gfx->Save();
aContext.Save();
if (StyleDisplay()->IsScrollableOverflow()) {
float x, y, width, height;
@ -252,7 +250,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext,
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, 0.0f, 0.0f, width, height);
nsSVGUtils::SetClipRect(gfx, aTransform, clipRect);
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
// SVG paints in CSS px, but normally frames paint in dev pixels. Here we
@ -263,16 +261,17 @@ nsSVGForeignObjectFrame::PaintSVG(nsRenderingContext *aContext,
gfxMatrix canvasTMForChildren = aTransform;
canvasTMForChildren.Scale(cssPxPerDevPx, cssPxPerDevPx);
gfx->Multiply(canvasTMForChildren);
aContext.Multiply(canvasTMForChildren);
uint32_t flags = nsLayoutUtils::PAINT_IN_TRANSFORM;
if (SVGAutoRenderState::IsPaintingToWindow(aContext->GetDrawTarget())) {
if (SVGAutoRenderState::IsPaintingToWindow(aContext.GetDrawTarget())) {
flags |= nsLayoutUtils::PAINT_TO_WINDOW;
}
nsresult rv = nsLayoutUtils::PaintFrame(aContext, kid, nsRegion(kidDirtyRect),
nsRenderingContext rendCtx(&aContext);
nsresult rv = nsLayoutUtils::PaintFrame(&rendCtx, kid, nsRegion(kidDirtyRect),
NS_RGBA(0,0,0,0), flags);
gfx->Restore();
aContext.Restore();
return rv;
}

View File

@ -13,7 +13,7 @@
#include "nsRegion.h"
#include "nsSVGUtils.h"
class nsRenderingContext;
class gfxContext;
class nsSVGOuterSVGFrame;
typedef nsContainerFrame nsSVGForeignObjectFrameBase;
@ -76,7 +76,7 @@ public:
#endif
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext *aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;

View File

@ -62,7 +62,7 @@ public:
NS_DECL_FRAMEARENA_HELPERS
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext *aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;
@ -291,7 +291,7 @@ nsSVGImageFrame::TransformContextForPainting(gfxContext* aGfxContext,
//----------------------------------------------------------------------
// nsISVGChildFrame methods:
nsresult
nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
nsSVGImageFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
{
@ -318,16 +318,15 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
}
if (mImageContainer) {
gfxContext* ctx = aContext->ThebesContext();
gfxContextAutoSaveRestore autoRestorer(ctx);
gfxContextAutoSaveRestore autoRestorer(&aContext);
if (StyleDisplay()->IsScrollableOverflow()) {
gfxRect clipRect = nsSVGUtils::GetClipRectForFrame(this, x, y,
width, height);
nsSVGUtils::SetClipRect(ctx, aTransform, clipRect);
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
if (!TransformContextForPainting(ctx, aTransform)) {
if (!TransformContextForPainting(&aContext, aTransform)) {
return NS_ERROR_FAILURE;
}
@ -340,7 +339,7 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
}
if (opacity != 1.0f || StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {
ctx->PushGroup(gfxContentType::COLOR_ALPHA);
aContext.PushGroup(gfxContentType::COLOR_ALPHA);
}
nscoord appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel();
@ -363,6 +362,8 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
// force sync probably just isn't worth it, so always pass FLAG_SYNC_DECODE
uint32_t drawFlags = imgIContainer::FLAG_SYNC_DECODE;
nsRenderingContext rendCtx(&aContext);
if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
// Package up the attributes of this image element which can override the
// attributes of mImageContainer's internal SVG document.
@ -377,7 +378,7 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
// That method needs our image to have a fixed native width & height,
// and that's not always true for TYPE_VECTOR images.
nsLayoutUtils::DrawSingleImage(
aContext,
&rendCtx,
PresContext(),
mImageContainer,
nsLayoutUtils::GetGraphicsFilterForFrame(this),
@ -387,7 +388,7 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
drawFlags);
} else { // mImageContainer->GetType() == TYPE_RASTER
nsLayoutUtils::DrawSingleUnscaledImage(
aContext,
&rendCtx,
PresContext(),
mImageContainer,
nsLayoutUtils::GetGraphicsFilterForFrame(this),
@ -397,9 +398,9 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
}
if (opacity != 1.0f || StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {
ctx->PopGroupToSource();
ctx->SetOperator(gfxContext::OPERATOR_OVER);
ctx->Paint(opacity);
aContext.PopGroupToSource();
aContext.SetOperator(gfxContext::OPERATOR_OVER);
aContext.Paint(opacity);
}
// gfxContextAutoSaveRestore goes out of scope & cleans up our gfxContext
}

View File

@ -11,7 +11,6 @@
#include "gfxContext.h"
#include "nsIFrame.h"
#include "nsISVGChildFrame.h"
#include "nsRenderingContext.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGEffects.h"
#include "nsSVGIntegrationUtils.h"
@ -60,7 +59,7 @@ nsSVGInnerSVGFrame::GetType() const
// nsISVGChildFrame methods
nsresult
nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext,
nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect)
{
@ -80,11 +79,10 @@ nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext,
return NS_OK;
}
gfxContext *gfx = aContext->ThebesContext();
autoSR.SetContext(gfx);
autoSR.SetContext(&aContext);
gfxRect clipRect =
nsSVGUtils::GetClipRectForFrame(this, x, y, width, height);
nsSVGUtils::SetClipRect(gfx, aTransform, clipRect);
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
return nsSVGInnerSVGFrameBase::PaintSVG(aContext, aTransform, aDirtyRect);

View File

@ -10,7 +10,7 @@
#include "nsSVGContainerFrame.h"
#include "nsISVGSVGFrame.h"
class nsRenderingContext;
class gfxContext;
typedef nsSVGDisplayContainerFrame nsSVGInnerSVGFrameBase;
@ -53,7 +53,7 @@ public:
int32_t aModType) MOZ_OVERRIDE;
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext *aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsRect GetCoveredRegion() MOZ_OVERRIDE;

View File

@ -819,7 +819,7 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
// nsISVGChildFrame methods:
nsresult
nsSVGOuterSVGFrame::PaintSVG(nsRenderingContext* aContext,
nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
{

View File

@ -11,6 +11,7 @@
#include "nsSVGContainerFrame.h"
#include "nsRegion.h"
class gfxContext;
class nsSVGForeignObjectFrame;
////////////////////////////////////////////////////////////////////////
@ -114,7 +115,7 @@ public:
virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) MOZ_OVERRIDE;
// nsISVGChildFrame methods:
virtual nsresult PaintSVG(nsRenderingContext* aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,

View File

@ -111,7 +111,7 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset);
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(aCtx, tm);
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
}
//----------------------------------------------------------------------
@ -240,25 +240,23 @@ nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// nsISVGChildFrame methods
nsresult
nsSVGPathGeometryFrame::PaintSVG(nsRenderingContext *aContext,
nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
{
if (!StyleVisibility()->IsVisible())
return NS_OK;
gfxContext* gfx = aContext->ThebesContext();
// Matrix to the geometry's user space:
gfxMatrix newMatrix =
gfx->CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
if (newMatrix.IsSingular()) {
return NS_OK;
}
uint32_t paintOrder = StyleSVG()->mPaintOrder;
if (paintOrder == NS_STYLE_PAINT_ORDER_NORMAL) {
Render(gfx, eRenderFill | eRenderStroke, newMatrix);
Render(&aContext, eRenderFill | eRenderStroke, newMatrix);
PaintMarkers(aContext, aTransform);
} else {
while (paintOrder) {
@ -266,10 +264,10 @@ nsSVGPathGeometryFrame::PaintSVG(nsRenderingContext *aContext,
paintOrder & ((1 << NS_STYLE_PAINT_ORDER_BITWIDTH) - 1);
switch (component) {
case NS_STYLE_PAINT_ORDER_FILL:
Render(gfx, eRenderFill, newMatrix);
Render(&aContext, eRenderFill, newMatrix);
break;
case NS_STYLE_PAINT_ORDER_STROKE:
Render(gfx, eRenderStroke, newMatrix);
Render(&aContext, eRenderStroke, newMatrix);
break;
case NS_STYLE_PAINT_ORDER_MARKERS:
PaintMarkers(aContext, aTransform);
@ -805,11 +803,11 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext,
}
void
nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext,
nsSVGPathGeometryFrame::PaintMarkers(gfxContext& aContext,
const gfxMatrix& aTransform)
{
gfxTextContextPaint *contextPaint =
(gfxTextContextPaint*)aContext->GetDrawTarget()->GetUserData(&gfxTextContextPaint::sUserDataKey);
(gfxTextContextPaint*)aContext.GetDrawTarget()->GetUserData(&gfxTextContextPaint::sUserDataKey);
if (static_cast<nsSVGPathGeometryElement*>(mContent)->IsMarkable()) {
MarkerProperties properties = GetMarkerProperties(this);
@ -823,6 +821,8 @@ nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* 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 +835,7 @@ nsSVGPathGeometryFrame::PaintMarkers(nsRenderingContext* aContext,
nsSVGMark& mark = marks[i];
nsSVGMarkerFrame* frame = markerFrames[mark.type];
if (frame) {
frame->PaintMark(aContext, aTransform, this, &mark, strokeWidth);
frame->PaintMark(&rendCtx, aTransform, this, &mark, strokeWidth);
}
}
}

View File

@ -26,7 +26,6 @@ class nsDisplaySVGPathGeometry;
class nsIAtom;
class nsIFrame;
class nsIPresShell;
class nsRenderingContext;
class nsStyleContext;
class nsSVGMarkerFrame;
class nsSVGMarkerProperty;
@ -100,7 +99,7 @@ public:
gfxMatrix GetCanvasTM();
protected:
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext *aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;
@ -127,7 +126,7 @@ private:
* @param aMatrix The transform that must be multiplied onto aContext to
* establish this frame's SVG user space.
*/
void PaintMarkers(nsRenderingContext *aContext, const gfxMatrix& aMatrix);
void PaintMarkers(gfxContext& aContext, const gfxMatrix& aMatrix);
struct MarkerProperties {
nsSVGMarkerProperty* mMarkerStart;

View File

@ -16,7 +16,6 @@
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "nsISVGChildFrame.h"
#include "nsRenderingContext.h"
#include "nsStyleContext.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryFrame.h"
@ -378,8 +377,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
return nullptr;
}
nsRenderingContext context(dt);
gfxContext* gfx = context.ThebesContext();
nsRefPtr<gfxContext> gfx = new gfxContext(dt);
// Fill with transparent black
gfx->SetOperator(gfxContext::OPERATOR_CLEAR);

View File

@ -10,8 +10,6 @@
#include "mozilla/dom/SVGSwitchElement.h"
#include "nsSVGUtils.h"
class nsRenderingContext;
using namespace mozilla::gfx;
typedef nsSVGGFrame nsSVGSwitchFrameBase;
@ -52,7 +50,7 @@ public:
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
// nsISVGChildFrame interface:
virtual nsresult PaintSVG(nsRenderingContext* aContext,
virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) MOZ_OVERRIDE;
nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) MOZ_OVERRIDE;
@ -107,7 +105,7 @@ nsSVGSwitchFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
nsresult
nsSVGSwitchFrame::PaintSVG(nsRenderingContext* aContext,
nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect)
{
@ -126,7 +124,7 @@ nsSVGSwitchFrame::PaintSVG(nsRenderingContext* aContext,
tm = static_cast<nsSVGElement*>(kid->GetContent())->
PrependLocalTransformsTo(tm, nsSVGElement::eUserSpaceToParent);
}
nsSVGUtils::PaintFrameWithEffects(kid, *aContext->ThebesContext(), tm, aDirtyRect);
nsSVGUtils::PaintFrameWithEffects(kid, aContext, tm, aDirtyRect);
}
return NS_OK;
}

View File

@ -466,7 +466,7 @@ public:
}
}
svgChildFrame->PaintSVG(aContext, aTransform, dirtyRect);
svgChildFrame->PaintSVG(*aContext->ThebesContext(), aTransform, dirtyRect);
}
};
@ -603,8 +603,6 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
clipPathFrame->ApplyClipOrPaintClipMask(aContext, aFrame, aTransform);
}
nsRenderingContext rendCtx(&aContext);
/* Paint the child */
if (effectProperties.HasValidFilter()) {
nsRegion* dirtyRegion = nullptr;
@ -631,7 +629,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
nsFilterInstance::PaintFilteredFrame(aFrame, aContext, aTransform,
&paintCallback, dirtyRegion);
} else {
svgChildFrame->PaintSVG(&rendCtx, aTransform, aDirtyRect);
svgChildFrame->PaintSVG(aContext, aTransform, aDirtyRect);
}
if (clipPathFrame && isTrivialClip) {
@ -1590,8 +1588,6 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
}
aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey,
aContextPaint, nullptr);
nsRenderingContext context(aContext);
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
gfxMatrix m;
if (frame->GetContent()->IsSVG()) {
// PaintSVG() expects the passed transform to be the transform to its own
@ -1599,7 +1595,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
m = static_cast<nsSVGElement*>(frame->GetContent())->
PrependLocalTransformsTo(gfxMatrix(), nsSVGElement::eUserSpaceToParent);
}
nsresult rv = svgFrame->PaintSVG(&context, m);
nsresult rv = svgFrame->PaintSVG(*aContext, m);
return NS_SUCCEEDED(rv);
}