Bug 975931. Part 8: When we reduce a layer's shadow-visible-region due to opaque covering content, restore it after compositing to ensure it's correct if the opaque content isn't there next time. r=mattwoodrow

--HG--
extra : rebase_source : 72119bd17b0606af70b4f6dbf05cea631aa71e9a
This commit is contained in:
Robert O'Callahan 2014-02-24 21:57:27 +13:00
parent 9dcbcf3034
commit 5f352be6e0

View File

@ -311,6 +311,14 @@ ContainerRender(ContainerT* aContainer,
continue;
}
nsIntRect clipRect = layerToRender->GetLayer()->
CalculateScissorRect(aClipRect, &aManager->GetWorldTransform());
if (clipRect.IsEmpty()) {
continue;
}
nsIntRegion savedVisibleRegion;
bool restoreVisibleRegion = false;
if (i + 1 < children.Length() &&
layerToRender->GetLayer()->GetEffectiveTransform().IsIdentity()) {
LayerComposite* nextLayer = static_cast<LayerComposite*>(children.ElementAt(i + 1)->ImplData());
@ -319,21 +327,17 @@ ContainerRender(ContainerT* aContainer,
nextLayerOpaqueRect = GetOpaqueRect(nextLayer->GetLayer());
}
if (!nextLayerOpaqueRect.IsEmpty()) {
savedVisibleRegion = layerToRender->GetShadowVisibleRegion();
nsIntRegion visibleRegion;
visibleRegion.Sub(layerToRender->GetShadowVisibleRegion(), nextLayerOpaqueRect);
layerToRender->SetShadowVisibleRegion(visibleRegion);
visibleRegion.Sub(savedVisibleRegion, nextLayerOpaqueRect);
if (visibleRegion.IsEmpty()) {
continue;
}
layerToRender->SetShadowVisibleRegion(visibleRegion);
restoreVisibleRegion = true;
}
}
nsIntRect clipRect = layerToRender->GetLayer()->
CalculateScissorRect(aClipRect, &aManager->GetWorldTransform());
if (clipRect.IsEmpty()) {
continue;
}
if (layerToRender->HasLayerBeenComposited()) {
// Composer2D will compose this layer so skip GPU composition
// this time & reset composition flag for next composition phase
@ -349,6 +353,11 @@ ContainerRender(ContainerT* aContainer,
layerToRender->RenderLayer(clipRect);
}
if (restoreVisibleRegion) {
// Restore the region in case it's not covered by opaque content next time
layerToRender->SetShadowVisibleRegion(savedVisibleRegion);
}
if (gfxPrefs::LayersScrollGraph()) {
DrawVelGraph(clipRect, aManager, layerToRender->GetLayer());
}