Bug 877661 - Part 1. Pass decode flag down to GetMaskForMaskedFrame. r=tnikkel

MozReview-Commit-ID: 9KhIWp1rHzb

--HG--
extra : rebase_source : 8c3d3c95ba7ada05673ba637cd542f41e9ce9f90
This commit is contained in:
cku 2017-03-27 11:10:48 +08:00
parent 260dda5205
commit 8abb48b629
6 changed files with 30 additions and 13 deletions

View File

@ -8109,12 +8109,15 @@ nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
{
MOZ_ASSERT(aMaskContext->GetDrawTarget()->GetFormat() == SurfaceFormat::A8);
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aMaskContext,
mFrame, mVisibleRect,
borderArea, aBuilder,
nullptr,
mHandleOpacity);
mHandleOpacity, flags);
ComputeMaskGeometry(params);
image::DrawResult result = nsSVGIntegrationUtils::PaintMask(params);
@ -8217,12 +8220,15 @@ nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
{
MOZ_ASSERT(!ShouldPaintOnMaskLayer(aManager));
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx->ThebesContext(),
mFrame, mVisibleRect,
borderArea, aBuilder,
aManager,
mHandleOpacity);
mHandleOpacity, flags);
// Clip the drawing target by mVisibleRect, which contains the visible
// region of the target frame and its out-of-flow and inflow descendants.
@ -8407,12 +8413,15 @@ nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx,
LayerManager* aManager)
{
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
? imgIContainer::FLAG_SYNC_DECODE
: imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx->ThebesContext(),
mFrame, mVisibleRect,
borderArea, aBuilder,
aManager,
mHandleOpacity);
mHandleOpacity, flags);
image::DrawResult result = nsSVGIntegrationUtils::PaintFilter(params);
nsDisplayFilterGeometry::UpdateDrawResult(this, result);

View File

@ -437,9 +437,10 @@ PaintMaskSurface(const PaintFramesParams& aParams,
if (maskFrame) {
Matrix svgMaskMatrix;
nsSVGMaskFrame::MaskParams params(maskContext, aParams.frame,
cssPxToDevPxMatrix,
aOpacity, &svgMaskMatrix,
svgReset->mMask.mLayers[i].mMaskMode);
cssPxToDevPxMatrix,
aOpacity, &svgMaskMatrix,
svgReset->mMask.mLayers[i].mMaskMode,
aParams.flags);
RefPtr<SourceSurface> svgMask;
Tie(result, svgMask) = maskFrame->GetMaskForMaskedFrame(params);
@ -515,7 +516,8 @@ CreateAndPaintMaskSurface(const PaintFramesParams& aParams,
paintResult.opacityApplied = true;
nsSVGMaskFrame::MaskParams params(&ctx, aParams.frame, cssPxToDevPxMatrix,
aOpacity, &paintResult.maskTransform,
svgReset->mMask.mLayers[0].mMaskMode);
svgReset->mMask.mLayers[0].mMaskMode,
aParams.flags);
Tie(paintResult.result, paintResult.maskSurface) =
aMaskFrames[0]->GetMaskForMaskedFrame(params);

View File

@ -142,16 +142,18 @@ public:
bool handleOpacity; // If true, PaintMaskAndClipPath/ PaintFilter should
// apply css opacity.
IntRect maskRect;
uint32_t flags; // Image flags of the imgIContainer::FLAG_* variety.
explicit PaintFramesParams(gfxContext& aCtx, nsIFrame* aFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
nsDisplayListBuilder* aBuilder,
mozilla::layers::LayerManager* aLayerManager,
bool aHandleOpacity)
bool aHandleOpacity, uint32_t aFlags)
: ctx(aCtx), frame(aFrame), dirtyRect(aDirtyRect),
borderArea(aBorderArea), builder(aBuilder),
layerManager(aLayerManager), handleOpacity(aHandleOpacity)
layerManager(aLayerManager), handleOpacity(aHandleOpacity),
flags(aFlags)
{ }
};

View File

@ -267,7 +267,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(MaskParams& aParams)
m = static_cast<nsSVGElement*>(kid->GetContent())->
PrependLocalTransformsTo(m, eUserSpaceToParent);
}
result &= nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m);
result &= nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m, nullptr,
aParams.flags);
}
RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();

View File

@ -59,12 +59,15 @@ public:
float opacity;
Matrix* maskTransform;
uint8_t maskMode;
uint32_t flags; // Image flags of the imgIContainer::FLAG_* variety.
explicit MaskParams(gfxContext* aCtx, nsIFrame* aMaskedFrame,
const gfxMatrix& aToUserSpace, float aOpacity,
Matrix* aMaskTransform, uint8_t aMaskMode)
Matrix* aMaskTransform, uint8_t aMaskMode,
uint32_t aFlags)
: ctx(aCtx), maskedFrame(aMaskedFrame), toUserSpace(aToUserSpace),
opacity(aOpacity), maskTransform(aMaskTransform), maskMode(aMaskMode)
opacity(aOpacity), maskTransform(aMaskTransform), maskMode(aMaskMode),
flags(aFlags)
{ }
};

View File

@ -804,7 +804,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
aFrame->StyleSVGReset()->mMask.mLayers[0].mMaskMode;
nsSVGMaskFrame::MaskParams params(&aContext, aFrame, aTransform,
maskUsage.opacity, &maskTransform,
maskMode);
maskMode, aFlags);
Tie(result, maskSurface) = maskFrame->GetMaskForMaskedFrame(params);
if (!maskSurface) {