Bug 1113435 - Only cull the fully rendered region when doing progressive draw. r=jrmuizel

--HG--
extra : rebase_source : 063a04e728be38aaf2dc812ead3957c001e61e64
This commit is contained in:
Benoit Girard 2015-02-18 14:51:05 -05:00
parent 36b4b0736c
commit 09f62b1cd4
4 changed files with 29 additions and 1 deletions

View File

@ -236,6 +236,8 @@ public:
*/
virtual const nsIntRegion& GetValidLowPrecisionRegion() const = 0;
virtual const nsIntRegion& GetValidRegion() const = 0;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
/**
* Store a fence that will signal when the current buffer is no longer being read.

View File

@ -233,7 +233,7 @@ LayerManagerComposite::ApplyOcclusionCulling(Layer* aLayer, nsIntRegion& aOpaque
!aLayer->GetMaskLayer() &&
aLayer->GetLocalOpacity() == 1.0f) {
if (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) {
localOpaque.Or(localOpaque, composite->GetShadowVisibleRegion());
localOpaque.Or(localOpaque, composite->GetFullyRenderedRegion());
}
localOpaque.MoveBy(transform2d._31, transform2d._32);
const nsIntRect* clip = aLayer->GetEffectiveClipRect();
@ -1151,6 +1151,20 @@ LayerComposite::SetLayerManager(LayerManagerComposite* aManager)
mCompositor = aManager->GetCompositor();
}
nsIntRegion
LayerComposite::GetFullyRenderedRegion() {
if (TiledLayerComposer* tiled = GetTiledLayerComposer()) {
nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion();
// Discard the region which hasn't been drawn yet when doing
// progressive drawing. Note that if the shadow visible region
// shrunk the tiled valig region may not have discarded this yet.
shadowVisibleRegion.And(shadowVisibleRegion, tiled->GetValidRegion());
return shadowVisibleRegion;
} else {
return GetShadowVisibleRegion();
}
}
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
/*static*/ bool

View File

@ -441,6 +441,13 @@ public:
bool HasLayerBeenComposited() { return mLayerComposited; }
nsIntRect GetClearRect() { return mClearRect; }
/**
* Return the part of the visible region that has been fully rendered.
* While progressive drawing is in progress this region will be
* a subset of the shadow visible region.
*/
nsIntRegion GetFullyRenderedRegion();
protected:
gfx::Matrix4x4 mShadowTransform;
nsIntRegion mShadowVisibleRegion;

View File

@ -231,6 +231,11 @@ public:
return mLowPrecisionTiledBuffer.GetValidRegion();
}
const nsIntRegion& GetValidRegion() const MOZ_OVERRIDE
{
return mTiledBuffer.GetValidRegion();
}
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE
{
CompositableHost::SetCompositor(aCompositor);