Bug 980642 - Implement Clear regions for ClientLayerManager/LayerManagerComposite. r=roc

This commit is contained in:
Matt Woodrow 2014-03-28 16:38:32 +13:00
parent 6fa7f32cb8
commit ebd1398b79
6 changed files with 24 additions and 4 deletions

View File

@ -352,7 +352,7 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
// forward this transaction's changeset to our LayerManagerComposite
bool sent;
AutoInfallibleTArray<EditReply, 10> replies;
if (HasShadowManager() && mForwarder->EndTransaction(&replies, aScheduleComposite, &sent)) {
if (HasShadowManager() && mForwarder->EndTransaction(&replies, mRegionToClear, aScheduleComposite, &sent)) {
for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
const EditReply& reply = replies[i];

View File

@ -497,6 +497,14 @@ LayerManagerComposite::Render()
// Render our layers.
RootLayer()->RenderLayer(clipRect);
if (!mRegionToClear.IsEmpty()) {
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
while ((r = iter.Next())) {
mCompositor->ClearRect(Rect(r->x, r->y, r->width, r->height));
}
}
// Allow widget to render a custom foreground.
mCompositor->GetWidget()->DrawWindowOverlay(this, nsIntRect(actualBounds.x,
actualBounds.y,

View File

@ -740,6 +740,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
// change, dimension change would be done at the stage, update the size here is free of
// race condition.
mLayerManager->UpdateRenderBounds(aTargetConfig.clientBounds());
mLayerManager->SetRegionToClear(aTargetConfig.clearRegion());
mCompositionManager->Updated(aIsFirstPaint, aTargetConfig);
Layer* root = aLayerTree->GetRoot();

View File

@ -49,6 +49,7 @@ struct TargetConfig {
ScreenRotation rotation;
nsIntRect clientBounds;
ScreenOrientation orientation;
nsIntRegion clearRegion;
};
// Create a shadow layer for |layer|

View File

@ -465,7 +465,10 @@ ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
}
bool
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, bool aScheduleComposite, bool* aSent)
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
const nsIntRegion& aRegionToClear,
bool aScheduleComposite,
bool* aSent)
{
*aSent = false;
@ -561,7 +564,11 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, bool
mWindowOverlayChanged = false;
TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation, mTxn->mClientBounds, mTxn->mTargetOrientation);
TargetConfig targetConfig(mTxn->mTargetBounds,
mTxn->mTargetRotation,
mTxn->mClientBounds,
mTxn->mTargetOrientation,
aRegionToClear);
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();

View File

@ -329,7 +329,10 @@ public:
* |aReplies| are directions from the LayerManagerComposite to the
* caller of EndTransaction().
*/
bool EndTransaction(InfallibleTArray<EditReply>* aReplies, bool aScheduleComposite, bool* aSent);
bool EndTransaction(InfallibleTArray<EditReply>* aReplies,
const nsIntRegion& aRegionToClear,
bool aScheduleComposite,
bool* aSent);
/**
* Set an actor through which layer updates will be pushed.