Bug 1582991 - Check the validity of the DrawTarget before using it, in nsFilterInstance::Render r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D46716

--HG--
extra : moz-landing-system : lando
This commit is contained in:
longsonr 2019-09-23 18:14:12 +00:00
parent b5140cd3ca
commit e48a579229

View File

@ -768,6 +768,11 @@ void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
Rect renderRect = IntRectToRect(filterRect);
RefPtr<DrawTarget> dt = aCtx->GetDrawTarget();
MOZ_ASSERT(dt);
if (!dt->IsValid()) {
return;
}
BuildSourcePaints(aImgParams);
RefPtr<FilterNode> sourceGraphic, fillPaint, strokePaint;
if (mFillPaint.mSourceSurface) {
@ -791,7 +796,7 @@ void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
}
RefPtr<FilterNode> resultFilter = FilterNodeGraphFromDescription(
aCtx->GetDrawTarget(), mFilterDescription, renderRect, sourceGraphic,
dt, mFilterDescription, renderRect, sourceGraphic,
mSourceGraphic.mSurfaceRect, fillPaint, strokePaint, mInputImages);
if (!resultFilter) {
@ -799,8 +804,7 @@ void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
return;
}
BuildSourceImage(aCtx->GetDrawTarget(), aImgParams, resultFilter,
sourceGraphic, renderRect);
BuildSourceImage(dt, aImgParams, resultFilter, sourceGraphic, renderRect);
if (sourceGraphic) {
if (mSourceGraphic.mSourceSurface) {
sourceGraphic->SetInput(IN_TRANSFORM_IN, mSourceGraphic.mSourceSurface);
@ -810,8 +814,7 @@ void nsFilterInstance::Render(gfxContext* aCtx, imgDrawingParams& aImgParams,
}
}
aCtx->GetDrawTarget()->DrawFilter(resultFilter, renderRect, Point(0, 0),
DrawOptions(aOpacity));
dt->DrawFilter(resultFilter, renderRect, Point(0, 0), DrawOptions(aOpacity));
}
nsRegion nsFilterInstance::ComputePostFilterDirtyRegion() {