Bug 1091321, part 7 - Convert nsSVGFilterPaintCallback 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 bd8ce02037
commit 30a38358f7
5 changed files with 10 additions and 15 deletions

View File

@ -11,12 +11,12 @@
// Keep others in (case-insensitive) order:
#include "gfx2DGlue.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "mozilla/gfx/Helpers.h"
#include "mozilla/gfx/PatternHelpers.h"
#include "nsISVGChildFrame.h"
#include "nsRenderingContext.h"
#include "nsCSSFilterInstance.h"
#include "nsSVGFilterInstance.h"
#include "nsSVGFilterPaintCallback.h"
@ -448,8 +448,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT)
ctx->CurrentMatrix().Translate(-neededRect.TopLeft()).
PreMultiply(deviceToFilterSpace));
nsRenderingContext tmpCtx(ctx);
mPaintCallback->Paint(&tmpCtx, mTargetFrame, mPaintTransform, &dirty);
mPaintCallback->Paint(*ctx, mTargetFrame, mPaintTransform, &dirty);
mSourceGraphic.mSourceSurface = offscreenDT->Snapshot();
mSourceGraphic.mSurfaceRect = ToIntRect(neededRect);

View File

@ -7,7 +7,7 @@
#define __NS_SVGFILTERPAINTCALLBACK_H__
class nsIFrame;
class nsRenderingContext;
class gfxContext;
struct nsIntRect;
@ -25,7 +25,7 @@ public:
* @param aTransformRoot the outermost frame whose transform should be taken
* into account when painting an SVG glyph
*/
virtual void Paint(nsRenderingContext *aContext, nsIFrame *aTarget,
virtual void Paint(gfxContext& aContext, nsIFrame *aTarget,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect) = 0;
};

View File

@ -382,21 +382,19 @@ public:
: mBuilder(aBuilder), mLayerManager(aManager),
mOffset(aOffset) {}
virtual void Paint(nsRenderingContext *aContext, nsIFrame *aTarget,
virtual void Paint(gfxContext& aContext, nsIFrame *aTarget,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) MOZ_OVERRIDE
{
BasicLayerManager* basic = static_cast<BasicLayerManager*>(mLayerManager);
basic->SetTarget(aContext->ThebesContext());
gfxContext* ctx = aContext->ThebesContext();
basic->SetTarget(&aContext);
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(-mOffset,
aTarget->PresContext()->AppUnitsPerDevPixel());
gfxContextMatrixAutoSaveRestore autoSR(ctx);
ctx->SetMatrix(ctx->CurrentMatrix().Translate(devPixelOffset));
gfxContextMatrixAutoSaveRestore autoSR(&aContext);
aContext.SetMatrix(aContext.CurrentMatrix().Translate(devPixelOffset));
mLayerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, mBuilder);
}

View File

@ -30,7 +30,6 @@
#include "nsISVGChildFrame.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsStyleCoord.h"
#include "nsStyleStruct.h"
#include "nsSVGClipPathFrame.h"
@ -441,7 +440,7 @@ nsSVGUtils::NotifyChildrenOfSVGChange(nsIFrame *aFrame, uint32_t aFlags)
class SVGPaintCallback : public nsSVGFilterPaintCallback
{
public:
virtual void Paint(nsRenderingContext *aContext, nsIFrame *aTarget,
virtual void Paint(gfxContext& aContext, nsIFrame *aTarget,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) MOZ_OVERRIDE
{
@ -466,7 +465,7 @@ public:
}
}
svgChildFrame->PaintSVG(*aContext->ThebesContext(), aTransform, dirtyRect);
svgChildFrame->PaintSVG(aContext, aTransform, dirtyRect);
}
};

View File

@ -34,7 +34,6 @@ class nsIContent;
class nsIDocument;
class nsIFrame;
class nsPresContext;
class nsRenderingContext;
class nsStyleContext;
class nsStyleCoord;
class nsSVGClipPathFrame;