Bug 1224207 - Part 5. Fine tune nsFilterInstance::BuildSourcePaint. r=mstange

1. Rename gfx->sourceCtx.
2. Since sourceCtx is discarded immidiately, there is no need of save/restore.

MozReview-Commit-ID: CM2MMBYWp3W

--HG--
extra : rebase_source : 059f205b65632984cfaed535348ae702501d10d8
This commit is contained in:
cku 2017-01-24 23:10:31 +08:00
parent 1ac1d6737d
commit 36512021da

View File

@ -383,23 +383,21 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource)
"(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();