Bug 1384839 - Part3. Implement nsDisplayMask::CreateWebRenderCommands. r=kats

MozReview-Commit-ID: D6eOYP29XlN

--HG--
extra : rebase_source : 052360f9c7583b2e74880fbb0687b88e3765568f
This commit is contained in:
Ethan Lin 2017-07-31 13:57:10 +08:00
Родитель a79f89c36a
Коммит fa25e69f8d
2 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -8867,6 +8867,33 @@ nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParams.result);
}
bool
nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
bool snap;
float appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
nsRect displayBound = GetBounds(aDisplayListBuilder, &snap);
LayerRect bounds = ViewAs<LayerPixel>(LayoutDeviceRect::FromAppUnits(displayBound, appUnitsPerDevPixel),
PixelCastJustification::WebRenderHasUnitResolution);
Maybe<wr::WrImageMask> mask = aManager->BuildWrMaskImage(this, aBuilder, aSc, aDisplayListBuilder, bounds);
if (mask) {
aBuilder.PushClip(aSc.ToRelativeLayoutRect(bounds), mask.ptr());
}
nsDisplaySVGEffects::CreateWebRenderCommands(aBuilder, aSc, aParentCommands, aManager, aDisplayListBuilder);
if (mask) {
aBuilder.PopClip();
}
return true;
}
#ifdef MOZ_DUMP_PAINTING
void
nsDisplayMask::PrintEffects(nsACString& aTo)

Просмотреть файл

@ -4520,6 +4520,12 @@ public:
{
return mDestRects;
}
virtual bool CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc,
nsTArray<WebRenderParentCommand>& aParentCommands,
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override;
private:
// According to mask property and the capability of aManager, determine
// whether paint mask onto a dedicate mask layer.