зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1234485 - Part 10. Paint mask onto mask layer when possible. r=mattwoodrow,mstange
MozReview-Commit-ID: GEMprzpfYw3 --HG-- extra : rebase_source : aa72a7b84ed21fae5638b5a83b2e739716537864 extra : intermediate-source : 6b90195d53da590b153c0ee7317767ae15ef6b16 extra : source : fcd9d758f37adb4d28f2fd72b458f1576e5cd2f8
This commit is contained in:
Родитель
bbd37411c6
Коммит
b146d87275
|
@ -3940,6 +3940,23 @@ ContainerState::SetupMaskLayerForCSSMask(Layer* aLayer,
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<gfxContext> maskCtx = gfxContext::CreateOrNull(dt);
|
||||
gfxPoint offset = nsLayoutUtils::PointToGfxPoint(bounds.TopLeft(), A2D);
|
||||
maskCtx->SetMatrix(gfxMatrix::Translation(-offset));
|
||||
|
||||
if (!aMaskItem->PaintMask(mBuilder, maskCtx)) {
|
||||
// Mostly because of mask resource is not ready.
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup mask layer offset.
|
||||
Matrix4x4 matrix;
|
||||
matrix.PreTranslate(offset.x, offset.y, 0);
|
||||
matrix.PreTranslate(mParameters.mOffset.x, mParameters.mOffset.y, 0);
|
||||
matrix.PreScale(mParameters.mXScale, mParameters.mYScale, 1.0);
|
||||
|
||||
maskLayer->SetBaseTransform(matrix);
|
||||
|
||||
RefPtr<ImageContainer> imgContainer =
|
||||
imageData.CreateImageAndImageContainer();
|
||||
if (!imgContainer) {
|
||||
|
@ -4354,6 +4371,9 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
|||
SetupMaskLayer(ownLayer, layerClip);
|
||||
}
|
||||
}
|
||||
} else if (item->GetType() == nsDisplayItem::TYPE_MASK) {
|
||||
nsDisplayMask* maskItem = static_cast<nsDisplayMask*>(item);
|
||||
SetupMaskLayerForCSSMask(ownLayer, maskItem);
|
||||
}
|
||||
|
||||
ContainerLayer* oldContainer = ownLayer->GetParent();
|
||||
|
|
|
@ -7052,6 +7052,25 @@ nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
return container.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aMaskContext)
|
||||
{
|
||||
MOZ_ASSERT(aMaskContext->GetDrawTarget()->GetFormat() == SurfaceFormat::A8);
|
||||
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
nsSVGIntegrationUtils::PaintFramesParams params(*aMaskContext,
|
||||
mFrame, mVisibleRect,
|
||||
borderArea, aBuilder,
|
||||
nullptr,
|
||||
mHandleOpacity);
|
||||
ComputeMaskGeometry(params);
|
||||
image::DrawResult result = nsSVGIntegrationUtils::PaintMask(params);
|
||||
|
||||
nsDisplayMaskGeometry::UpdateDrawResult(this, result);
|
||||
return (result == image::DrawResult::SUCCESS) ? true : false;
|
||||
}
|
||||
|
||||
LayerState
|
||||
nsDisplayMask::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
|
@ -7141,6 +7160,8 @@ nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
|||
nsRenderingContext* aCtx,
|
||||
LayerManager* aManager)
|
||||
{
|
||||
MOZ_ASSERT(!ShouldPaintOnMaskLayer(aManager));
|
||||
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
nsSVGIntegrationUtils::PaintFramesParams params(*aCtx->ThebesContext(),
|
||||
mFrame, mVisibleRect,
|
||||
|
|
|
@ -3878,6 +3878,9 @@ protected:
|
|||
*/
|
||||
class nsDisplayMask : public nsDisplaySVGEffects {
|
||||
public:
|
||||
typedef mozilla::layers::ImageLayer ImageLayer;
|
||||
typedef class mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
nsDisplayMask(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList, bool aHandleOpacity,
|
||||
const DisplayItemScrollClip* aScrollClip);
|
||||
|
@ -3913,6 +3916,11 @@ public:
|
|||
nsRenderingContext* aCtx,
|
||||
LayerManager* aManager);
|
||||
|
||||
/*
|
||||
* Paint mask onto aMaskContext in mFrame's coordinate space.
|
||||
*/
|
||||
bool PaintMask(nsDisplayListBuilder* aBuilder, gfxContext* aMaskContext);
|
||||
|
||||
const nsTArray<nsRect>& GetDestRects()
|
||||
{
|
||||
return mDestRects;
|
||||
|
|
Загрузка…
Ссылка в новой задаче