Bug 1224207 - Part 5. Fine tune nsFilterInstance::BuildSourcePaint.
1. Rename gfx->sourceCtx.
2. Since sourceCtx is discarded immidiately, there is no need of save/restore.
MozReview-Commit-ID: CM2MMBYWp3W
--- a/layout/svg/nsFilterInstance.cpp
+++ b/layout/svg/nsFilterInstance.cpp
@@ -378,33 +378,31 @@ nsFilterInstance::BuildSourcePaint(Sourc
DebugOnly<bool> invertible = deviceToFilterSpace.Invert();
MOZ_ASSERT(invertible,
"The returning matix of GetFilterSpaceToDeviceSpaceTransform must"
"be an invertible matrix(not a singular one), since we already"
"checked it and early return if it's not from the caller side"
"(nsFilterInstance::Render)");
if (!mPaintTransform.IsSingular()) {
- RefPtr<gfxContext> gfx = gfxContext::CreateOrNull(offscreenDT);
- MOZ_ASSERT(gfx); // already checked the draw target above
- gfx->Save();
- gfx->Multiply(mPaintTransform *
+ RefPtr<gfxContext> sourceCtx = gfxContext::CreateOrNull(offscreenDT);
+ MOZ_ASSERT(sourceCtx); // already checked the draw target above
+ sourceCtx->Multiply(mPaintTransform *
deviceToFilterSpace *
gfxMatrix::Translation(-neededRect.TopLeft()));
GeneralPattern pattern;
if (aSource == &mFillPaint) {
- nsSVGUtils::MakeFillPatternFor(mTargetFrame, gfx, &pattern);
+ nsSVGUtils::MakeFillPatternFor(mTargetFrame, sourceCtx, &pattern);
} else if (aSource == &mStrokePaint) {
- nsSVGUtils::MakeStrokePatternFor(mTargetFrame, gfx, &pattern);
+ nsSVGUtils::MakeStrokePatternFor(mTargetFrame, sourceCtx, &pattern);
}
if (pattern.GetPattern()) {
offscreenDT->FillRect(ToRect(FilterSpaceToUserSpace(ThebesRect(neededRect))),
pattern);
}
- gfx->Restore();
}
aSource->mSourceSurface = offscreenDT->Snapshot();
aSource->mSurfaceRect = neededRect;
return DrawResult::SUCCESS;
}