From 9a2d7d1f309574abbe615d47076d7b1c2f08012b Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Mon, 8 Feb 2016 20:26:54 -0500 Subject: [PATCH] Bug 1237827 - Be sure to clear LayerComposite::mLayerComposited between each composite. r=mattwoodrow --- .../composite/ContainerLayerComposite.cpp | 4 ++-- gfx/layers/composite/LayerManagerComposite.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index f7a46eeeff99..317e9c5e37d3 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -564,8 +564,8 @@ RenderLayers(ContainerT* aContainer, if (layerToRender->HasLayerBeenComposited()) { // Composer2D will compose this layer so skip GPU composition - // this time & reset composition flag for next composition phase - layerToRender->SetLayerComposited(false); + // this time. The flag will be reset for the next composition phase + // at the beginning of LayerManagerComposite::Rener(). gfx::IntRect clearRect = layerToRender->GetClearRect(); if (!clearRect.IsEmpty()) { // Clear layer's visible rect on FrameBuffer with transparent pixels diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 1124e42bcbe9..254e14a5e76f 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -762,6 +762,21 @@ LayerManagerComposite::PopGroupForLayerEffects(RefPtr a Matrix4x4()); } +// Used to clear the 'mLayerComposited' flag at the beginning of each Render(). +static void +ClearLayerFlags(Layer* aLayer) { + if (!aLayer) { + return; + } + if (aLayer->AsLayerComposite()) { + aLayer->AsLayerComposite()->SetLayerComposited(false); + } + for (Layer* child = aLayer->GetFirstChild(); child; + child = child->GetNextSibling()) { + ClearLayerFlags(child); + } +} + void LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion) { @@ -773,6 +788,8 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion) return; } + ClearLayerFlags(mRoot); + // At this time, it doesn't really matter if these preferences change // during the execution of the function; we should be safe in all // permutations. However, may as well just get the values onces and