Bug 1043426: Avoid doing work for empty visible regions. r=mattwoodrow

This commit is contained in:
Bas Schouten 2014-08-04 13:02:14 +02:00
parent 6d6d53e7b8
commit 4b72634bdc
3 changed files with 13 additions and 4 deletions

View File

@ -1013,7 +1013,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
}
}
mUseIntermediateSurface = useIntermediateSurface;
mUseIntermediateSurface = useIntermediateSurface && !GetEffectiveVisibleRegion().IsEmpty();
if (useIntermediateSurface) {
ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual));
} else {

View File

@ -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<CompositingRenderTarget> 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<gfx::DataSourceSurface> surf = surface->Dump(aManager->GetCompositor());

View File

@ -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;