зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1323912 - Part 5. Apply opacity in mask layer painting path. r=mstange
MozReview-Commit-ID: HX2Tcum2smO --HG-- extra : rebase_source : 8a28c67b898efbea304d71709c0fd13e25632032
This commit is contained in:
Родитель
1aaf3f65d2
Коммит
8c03e0e5d4
|
@ -7351,11 +7351,9 @@ bool nsDisplayMask::ShouldPaintOnMaskLayer(LayerManager* aManager)
|
|||
nsSVGUtils::MaskUsage maskUsage;
|
||||
nsSVGUtils::DetermineMaskUsage(mFrame, mHandleOpacity, maskUsage);
|
||||
|
||||
// XXX Bug 1323912. nsSVGIntegrationUtils::PaintMask can not handle opacity
|
||||
// correctly. Turn it off before bug fixed.
|
||||
// XXX Temporary disable paint clip-path onto mask before figure out
|
||||
// performance regression(bug 1325550).
|
||||
if (maskUsage.opacity != 1.0 || maskUsage.shouldApplyClipPath) {
|
||||
if (maskUsage.shouldApplyClipPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -725,6 +725,25 @@ nsSVGIntegrationUtils::IsMaskResourceReady(nsIFrame* aFrame)
|
|||
return true;
|
||||
}
|
||||
|
||||
class AutoPopGroup
|
||||
{
|
||||
public:
|
||||
AutoPopGroup() : mContext(nullptr) { }
|
||||
|
||||
~AutoPopGroup() {
|
||||
if (mContext) {
|
||||
mContext->PopGroupAndBlend();
|
||||
}
|
||||
}
|
||||
|
||||
void SetContext(gfxContext* aContext) {
|
||||
mContext = aContext;
|
||||
}
|
||||
|
||||
private:
|
||||
gfxContext* mContext;
|
||||
};
|
||||
|
||||
DrawResult
|
||||
nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
||||
{
|
||||
|
@ -737,10 +756,6 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
|||
return DrawResult::SUCCESS;
|
||||
}
|
||||
|
||||
// XXX Bug 1323912.
|
||||
MOZ_ASSERT(maskUsage.opacity == 1.0,
|
||||
"nsSVGIntegrationUtils::PaintMask can not handle opacity now.");
|
||||
|
||||
gfxContext& ctx = aParams.ctx;
|
||||
nsIFrame* firstFrame =
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame);
|
||||
|
@ -762,6 +777,15 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
|||
SurfaceFormat::A8);
|
||||
}
|
||||
|
||||
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
|
||||
AutoPopGroup autoPop;
|
||||
bool shouldPushOpacity = (maskUsage.opacity != 1.0) &&
|
||||
(maskFrames.Length() != 1);
|
||||
if (shouldPushOpacity) {
|
||||
ctx.PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, maskUsage.opacity);
|
||||
autoPop.SetContext(&ctx);
|
||||
}
|
||||
|
||||
gfxContextMatrixAutoSaveRestore matSR;
|
||||
nsPoint offsetToBoundingBox;
|
||||
nsPoint offsetToUserSpace;
|
||||
|
@ -793,9 +817,8 @@ nsSVGIntegrationUtils::PaintMask(const PaintFramesParams& aParams)
|
|||
|
||||
SetupContextMatrix(frame, aParams, offsetToBoundingBox,
|
||||
offsetToUserSpace);
|
||||
nsTArray<nsSVGMaskFrame *> maskFrames = effectProperties.GetMaskFrames();
|
||||
|
||||
result = PaintMaskSurface(aParams, maskTarget, 1.0,
|
||||
result = PaintMaskSurface(aParams, maskTarget,
|
||||
shouldPushOpacity ? 1.0 : maskUsage.opacity,
|
||||
firstFrame->StyleContext(), maskFrames,
|
||||
ctx.CurrentMatrix(), offsetToUserSpace);
|
||||
if (result != DrawResult::SUCCESS) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче