diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index edf22039c232..e500d384b173 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -1013,7 +1013,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS } } - mUseIntermediateSurface = useIntermediateSurface; + mUseIntermediateSurface = useIntermediateSurface && !GetEffectiveVisibleRegion().IsEmpty(); if (useIntermediateSurface) { ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual)); } else { diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index 555d3907abde..d568216963ae 100644 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -401,6 +401,7 @@ RenderLayers(ContainerT* aContainer, for (size_t i = 0u; i < aContainer->mPrepared->mLayers.Length(); i++) { PreparedLayer& preparedData = aContainer->mPrepared->mLayers[i]; LayerComposite* layerToRender = preparedData.mLayer; + nsIntRect clipRect = preparedData.mClipRect; if (layerToRender->HasLayerBeenComposited()) { // Composer2D will compose this layer so skip GPU composition @@ -502,6 +503,11 @@ ContainerRender(ContainerT* aContainer, LayerManagerComposite* aManager, const nsIntRect& aClipRect) { + nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + if (visibleRect.IsEmpty()) { + return; + } + MOZ_ASSERT(aContainer->mPrepared); if (aContainer->UseIntermediateSurface()) { RefPtr surface; @@ -516,7 +522,6 @@ ContainerRender(ContainerT* aContainer, float opacity = aContainer->GetEffectiveOpacity(); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpPainting) { RefPtr surf = surface->Dump(aManager->GetCompositor()); diff --git a/gfx/layers/composite/ThebesLayerComposite.cpp b/gfx/layers/composite/ThebesLayerComposite.cpp index 3b4870f3f835..d476a0aa93c9 100644 --- a/gfx/layers/composite/ThebesLayerComposite.cpp +++ b/gfx/layers/composite/ThebesLayerComposite.cpp @@ -108,6 +108,12 @@ ThebesLayerComposite::GetRenderState() void ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect) { + const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion(); + + if (visibleRegion.IsEmpty()) { + return; + } + if (!mBuffer || !mBuffer->IsAttached()) { return; } @@ -133,8 +139,6 @@ ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect) LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(mMaskLayer, effectChain); AddBlendModeEffect(effectChain); - const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion(); - TiledLayerProperties tiledLayerProps; if (mRequiresTiledProperties) { tiledLayerProps.mVisibleRegion = visibleRegion;