From ae5c61f89f3920c8e92310d3ba382cb556016757 Mon Sep 17 00:00:00 2001 From: Sunny Sidhu Date: Sun, 29 Nov 2015 02:07:55 -0500 Subject: [PATCH] Bug 1220873 - Make Layer::mVisibleRegion a LayerIntRegion. r=botond --- dom/base/nsDOMWindowUtils.cpp | 4 ++-- embedding/browser/nsWebBrowser.cpp | 2 +- gfx/ipc/GfxMessageUtils.h | 8 +++++--- gfx/layers/LayerMetricsWrapper.h | 4 ++-- gfx/layers/LayerSorter.cpp | 4 ++-- gfx/layers/LayerTreeInvalidation.cpp | 14 +++++++------- gfx/layers/Layers.cpp | 18 +++++++++--------- gfx/layers/Layers.h | 12 ++++++------ gfx/layers/ReadbackProcessor.cpp | 2 +- gfx/layers/RotatedBuffer.cpp | 8 ++++---- .../test/gtest/TestAsyncPanZoomController.cpp | 4 ++-- gfx/layers/basic/BasicCanvasLayer.h | 2 +- gfx/layers/basic/BasicColorLayer.cpp | 2 +- gfx/layers/basic/BasicContainerLayer.cpp | 4 ++-- gfx/layers/basic/BasicContainerLayer.h | 2 +- gfx/layers/basic/BasicImageLayer.cpp | 2 +- gfx/layers/basic/BasicLayerManager.cpp | 10 +++++----- gfx/layers/basic/BasicLayersImpl.h | 2 +- gfx/layers/basic/BasicPaintedLayer.cpp | 4 ++-- gfx/layers/basic/BasicPaintedLayer.h | 4 ++-- gfx/layers/client/ClientCanvasLayer.h | 2 +- gfx/layers/client/ClientColorLayer.cpp | 2 +- gfx/layers/client/ClientContainerLayer.h | 2 +- gfx/layers/client/ClientImageLayer.cpp | 2 +- gfx/layers/client/ClientPaintedLayer.cpp | 4 ++-- gfx/layers/client/ClientPaintedLayer.h | 2 +- gfx/layers/client/ClientTiledPaintedLayer.cpp | 4 ++-- .../composite/ContainerLayerComposite.cpp | 12 ++++++------ gfx/layers/composite/LayerManagerComposite.cpp | 10 +++++----- gfx/layers/composite/LayerManagerComposite.h | 8 ++++---- gfx/layers/composite/PaintedLayerComposite.cpp | 2 +- gfx/layers/ipc/CompositorParent.cpp | 2 +- gfx/layers/ipc/LayersMessages.ipdlh | 3 ++- gfx/tests/gtest/TestCompositor.cpp | 6 +++--- gfx/tests/gtest/TestLayers.cpp | 2 +- layout/base/FrameLayerBuilder.cpp | 12 ++++++------ layout/base/nsPresContext.cpp | 2 +- layout/base/nsPresShell.cpp | 2 +- widget/gonk/HwcComposer2D.cpp | 2 +- 39 files changed, 98 insertions(+), 95 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 9c0b9d01d44..03e6b16a55d 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2567,7 +2567,7 @@ CheckLeafLayers(Layer* aLayer, const nsIntPoint& aOffset, nsIntRegion* aCoveredR child = child->GetNextSibling(); } } else { - nsIntRegion rgn = aLayer->GetVisibleRegion(); + nsIntRegion rgn = aLayer->GetVisibleRegion().ToUnknownRegion(); rgn.MoveBy(offset); nsIntRegion tmp; tmp.And(rgn, *aCoveredRegion); @@ -2603,7 +2603,7 @@ nsDOMWindowUtils::LeafLayersPartitionWindow(bool* aResult) if (!CheckLeafLayers(root, offset, &coveredRegion)) { *aResult = false; } - if (!coveredRegion.IsEqual(root->GetVisibleRegion())) { + if (!coveredRegion.IsEqual(root->GetVisibleRegion().ToUnknownRegion())) { *aResult = false; } #endif diff --git a/embedding/browser/nsWebBrowser.cpp b/embedding/browser/nsWebBrowser.cpp index 16dd55fff4c..ef7a29f9dca 100644 --- a/embedding/browser/nsWebBrowser.cpp +++ b/embedding/browser/nsWebBrowser.cpp @@ -1737,7 +1737,7 @@ nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) RefPtr root = layerManager->CreatePaintedLayer(); if (root) { nsIntRect dirtyRect = aRegion.GetBounds(); - root->SetVisibleRegion(dirtyRect); + root->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(dirtyRect)); layerManager->SetRoot(root); } diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index af1ba71fbf7..feac536f85b 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -396,9 +396,11 @@ struct RegionParamTraits } }; -template<> -struct ParamTraits - : RegionParamTraits +template +struct ParamTraits> + : RegionParamTraits, + mozilla::gfx::IntRectTyped, + typename mozilla::gfx::IntRegionTyped::RectIterator> {}; template<> diff --git a/gfx/layers/LayerMetricsWrapper.h b/gfx/layers/LayerMetricsWrapper.h index a14a7735e56..e18fdeec37f 100644 --- a/gfx/layers/LayerMetricsWrapper.h +++ b/gfx/layers/LayerMetricsWrapper.h @@ -343,14 +343,14 @@ public: return nullptr; } - nsIntRegion GetVisibleRegion() const + LayerIntRegion GetVisibleRegion() const { MOZ_ASSERT(IsValid()); if (AtBottomLayer()) { return mLayer->GetVisibleRegion(); } - nsIntRegion region = mLayer->GetVisibleRegion(); + LayerIntRegion region = mLayer->GetVisibleRegion(); region.Transform(mLayer->GetTransform()); return region; } diff --git a/gfx/layers/LayerSorter.cpp b/gfx/layers/LayerSorter.cpp index f3149063f67..3408d3c4924 100644 --- a/gfx/layers/LayerSorter.cpp +++ b/gfx/layers/LayerSorter.cpp @@ -76,8 +76,8 @@ static gfxFloat RecoverZDepth(const Matrix4x4& aTransform, const gfxPoint& aPoin * unsolved without changing our rendering code. */ static LayerSortOrder CompareDepth(Layer* aOne, Layer* aTwo) { - gfxRect ourRect = ThebesRect(aOne->GetEffectiveVisibleRegion().GetBounds()); - gfxRect otherRect = ThebesRect(aTwo->GetEffectiveVisibleRegion().GetBounds()); + gfxRect ourRect = ThebesRect(aOne->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); + gfxRect otherRect = ThebesRect(aTwo->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); MOZ_ASSERT(aOne->GetParent() && aOne->GetParent()->Extend3DContext() && aTwo->GetParent() && aTwo->GetParent()->Extend3DContext()); diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 8425cd8f804..146ff820b2f 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -125,7 +125,7 @@ NotifySubdocumentInvalidationRecursive(Layer* aLayer, NotifySubDocInvalidationFu NotifySubdocumentInvalidationRecursive(child, aCallback); } - aCallback(container, container->GetVisibleRegion()); + aCallback(container, container->GetVisibleRegion().ToUnknownRegion()); } struct LayerPropertiesBase : public LayerProperties @@ -133,7 +133,7 @@ struct LayerPropertiesBase : public LayerProperties explicit LayerPropertiesBase(Layer* aLayer) : mLayer(aLayer) , mMaskLayer(nullptr) - , mVisibleRegion(aLayer->GetVisibleRegion()) + , mVisibleRegion(aLayer->GetVisibleRegion().ToUnknownRegion()) , mInvalidRegion(aLayer->GetInvalidRegion()) , mPostXScale(aLayer->GetPostXScale()) , mPostYScale(aLayer->GetPostYScale()) @@ -235,13 +235,13 @@ struct LayerPropertiesBase : public LayerProperties IntRect NewTransformedBounds() { - return TransformRect(mLayer->GetVisibleRegion().GetBounds(), + return TransformRect(mLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(), GetTransformForInvalidation(mLayer)); } IntRect OldTransformedBounds() { - return TransformRect(mVisibleRegion.GetBounds(), mTransform); + return TransformRect(mVisibleRegion.ToUnknownRegion().GetBounds(), mTransform); } virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback, @@ -347,7 +347,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase } if (invalidateChildsCurrentArea) { aGeometryChanged = true; - AddTransformedRegion(result, child->GetVisibleRegion(), + AddTransformedRegion(result, child->GetVisibleRegion().ToUnknownRegion(), GetTransformForInvalidation(child)); if (aCallback) { NotifySubdocumentInvalidationRecursive(child, aCallback); @@ -454,7 +454,7 @@ struct ImageLayerProperties : public LayerPropertiesBase { ImageLayer* imageLayer = static_cast(mLayer.get()); - if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) { + if (!imageLayer->GetVisibleRegion().ToUnknownRegion().IsEqual(mVisibleRegion)) { aGeometryChanged = true; IntRect result = NewTransformedBounds(); result = result.Union(OldTransformedBounds()); @@ -596,7 +596,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu } else { ClearInvalidations(aRoot); } - IntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), + IntRect result = TransformRect(aRoot->GetVisibleRegion().ToUnknownRegion().GetBounds(), aRoot->GetLocalTransform()); result = result.Union(OldTransformedBounds()); if (aGeometryChanged != nullptr) { diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index ee1ef230a12..8693819f181 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -619,7 +619,7 @@ Layer::GetEffectiveClipRect() return GetClipRect(); } -const nsIntRegion& +const LayerIntRegion& Layer::GetEffectiveVisibleRegion() { if (LayerComposite* shadow = AsLayerComposite()) { @@ -1023,7 +1023,7 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult, } IntPoint offset; - aResult = GetEffectiveVisibleRegion(); + aResult = GetEffectiveVisibleRegion().ToUnknownRegion(); for (Layer* layer = this; layer; layer = layer->GetParent()) { gfx::Matrix matrix; if (!layer->GetLocalTransform().Is2D(&matrix) || @@ -1060,7 +1060,7 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult, // Retreive the translation from sibling to |layer|. The accumulated // visible region is currently oriented with |layer|. IntPoint siblingOffset = RoundedToInt(siblingMatrix.GetTranslation()); - nsIntRegion siblingVisibleRegion(sibling->GetEffectiveVisibleRegion()); + nsIntRegion siblingVisibleRegion(sibling->GetEffectiveVisibleRegion().ToUnknownRegion()); // Translate the siblings region to |layer|'s origin. siblingVisibleRegion.MoveBy(-siblingOffset.x, -siblingOffset.y); // Apply the sibling's clip. @@ -1894,7 +1894,7 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix) AppendToString(aStream, mLayerBounds, " [bounds=", "]"); } if (!mVisibleRegion.IsEmpty()) { - AppendToString(aStream, mVisibleRegion, " [visible=", "]"); + AppendToString(aStream, mVisibleRegion.ToUnknownRegion(), " [visible=", "]"); } else { aStream << " [not visible]"; } @@ -2013,7 +2013,7 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) DumpTransform(s->mutable_transform(), lc->GetShadowTransform()); } if (!lc->GetShadowVisibleRegion().IsEmpty()) { - DumpRegion(s->mutable_vregion(), lc->GetShadowVisibleRegion()); + DumpRegion(s->mutable_vregion(), lc->GetShadowVisibleRegion().ToUnknownRegion()); } } // Clip @@ -2025,8 +2025,8 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) DumpTransform(layer->mutable_transform(), mTransform); } // Visible region - if (!mVisibleRegion.IsEmpty()) { - DumpRegion(layer->mutable_vregion(), mVisibleRegion); + if (!mVisibleRegion.ToUnknownRegion().IsEmpty()) { + DumpRegion(layer->mutable_vregion(), mVisibleRegion.ToUnknownRegion()); } // EventRegions if (!mEventRegions.IsEmpty()) { @@ -2422,7 +2422,7 @@ PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite) AppendToString(aStream, aLayerComposite->GetShadowTransform(), " [shadow-transform=", "]"); } if (!aLayerComposite->GetShadowVisibleRegion().IsEmpty()) { - AppendToString(aStream, aLayerComposite->GetShadowVisibleRegion(), " [shadow-visible=", "]"); + AppendToString(aStream, aLayerComposite->GetShadowVisibleRegion().ToUnknownRegion(), " [shadow-visible=", "]"); } } @@ -2435,7 +2435,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget) return; } - const IntRect& bounds = aLayer->GetVisibleRegion().GetBounds(); + const IntRect& bounds = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(); gfx::Rect transformedBounds = aTarget->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y), Float(bounds.width), Float(bounds.height))); transformedBounds.RoundOut(); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index c72b11650e7..eb85e37e4e3 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -845,7 +845,7 @@ public: * visible region will be ignored. So if a layer draws outside the bounds * of its visible region, it needs to ensure that what it draws is valid. */ - virtual void SetVisibleRegion(const nsIntRegion& aRegion) + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) { if (!mVisibleRegion.IsEqual(aRegion)) { MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) VisibleRegion was %s is %s", this, @@ -1261,7 +1261,7 @@ public: const Maybe& GetClipRect() const { return mClipRect; } uint32_t GetContentFlags() { return mContentFlags; } const gfx::IntRect& GetLayerBounds() const { return mLayerBounds; } - const nsIntRegion& GetVisibleRegion() const { return mVisibleRegion; } + const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; } const FrameMetrics& GetFrameMetrics(uint32_t aIndex) const; uint32_t GetFrameMetricsCount() const { return mFrameMetrics.Length(); } const nsTArray& GetAllFrameMetrics() { return mFrameMetrics; } @@ -1473,7 +1473,7 @@ public: // values that should be used when drawing this layer to screen, // accounting for this layer possibly being a shadow. const Maybe& GetEffectiveClipRect(); - const nsIntRegion& GetEffectiveVisibleRegion(); + const LayerIntRegion& GetEffectiveVisibleRegion(); bool Extend3DContext() { return GetContentFlags() & CONTENT_EXTEND_3D_CONTEXT; @@ -1644,7 +1644,7 @@ public: /** * Mark the entirety of the layer's visible region as being invalid. */ - void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion(); } + void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion().ToUnknownRegion(); } /** * Adds to the current invalid rect. @@ -1787,7 +1787,7 @@ protected: nsTArray> mAncestorMaskLayers; gfx::UserData mUserData; gfx::IntRect mLayerBounds; - nsIntRegion mVisibleRegion; + LayerIntRegion mVisibleRegion; nsTArray mFrameMetrics; EventRegions mEventRegions; gfx::Matrix4x4 mTransform; @@ -2088,7 +2088,7 @@ public: RenderTargetIntRect GetIntermediateSurfaceRect() { NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface"); - return RenderTargetIntRect::FromUnknownRect(GetEffectiveVisibleRegion().GetBounds()); + return RenderTargetIntRect::FromUnknownRect(GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); } /** diff --git a/gfx/layers/ReadbackProcessor.cpp b/gfx/layers/ReadbackProcessor.cpp index 657e6b93822..22d7a53affc 100644 --- a/gfx/layers/ReadbackProcessor.cpp +++ b/gfx/layers/ReadbackProcessor.cpp @@ -63,7 +63,7 @@ FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset) nsIntPoint backgroundOffset(int32_t(backgroundTransform._31), int32_t(backgroundTransform._32)); IntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize()); - const nsIntRegion& visibleRegion = l->GetEffectiveVisibleRegion(); + const nsIntRegion visibleRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion(); if (!visibleRegion.Intersects(rectInBackground)) continue; // Since l is present in the background, from here on we either choose l diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index e0a026799c5..6bf67b1b2b1 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -221,14 +221,14 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer, // Also clip to the visible region if we're told to. if (!aLayer->GetValidRegion().Contains(BufferRect()) || (ToData(aLayer)->GetClipToVisibleRegion() && - !aLayer->GetVisibleRegion().Contains(BufferRect())) || - IsClippingCheap(aTarget, aLayer->GetEffectiveVisibleRegion())) { + !aLayer->GetVisibleRegion().ToUnknownRegion().Contains(BufferRect())) || + IsClippingCheap(aTarget, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion())) { // We don't want to draw invalid stuff, so we need to clip. Might as // well clip to the smallest area possible --- the visible region. // Bug 599189 if there is a non-integer-translation transform in aTarget, // we might sample pixels outside GetEffectiveVisibleRegion(), which is wrong // and may cause gray lines. - gfxUtils::ClipToRegion(aTarget, aLayer->GetEffectiveVisibleRegion()); + gfxUtils::ClipToRegion(aTarget, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion()); clipped = true; } @@ -454,7 +454,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, while (true) { mode = aLayer->GetSurfaceMode(); - neededRegion = aLayer->GetVisibleRegion(); + neededRegion = aLayer->GetVisibleRegion().ToUnknownRegion(); canReuseBuffer &= BufferSizeOkFor(neededRegion.GetBounds().Size()); result.mContentType = layerContentType; diff --git a/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp b/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp index 412117fd104..cc5b131811f 100644 --- a/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp @@ -2080,7 +2080,7 @@ protected: if (aScrollId == FrameMetrics::START_SCROLL_ID) { metrics.SetIsLayersIdRoot(true); } - IntRect layerBound = aLayer->GetVisibleRegion().GetBounds(); + IntRect layerBound = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(); metrics.SetCompositionBounds(ParentLayerRect(layerBound.x, layerBound.y, layerBound.width, layerBound.height)); metrics.SetScrollableRect(aScrollableRect); @@ -2755,7 +2755,7 @@ TEST_F(APZHitTestingTester, Bug1148350) { } mcc->AdvanceByMillis(100); - layers[0]->SetVisibleRegion(nsIntRegion(IntRect(0,50,200,150))); + layers[0]->SetVisibleRegion(LayerIntRegion(LayerIntRect(0,50,200,150))); layers[0]->SetBaseTransform(Matrix4x4::Translation(0, 50, 0)); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); diff --git a/gfx/layers/basic/BasicCanvasLayer.h b/gfx/layers/basic/BasicCanvasLayer.h index 3e5d4a19d4a..3cd930c1ea2 100644 --- a/gfx/layers/basic/BasicCanvasLayer.h +++ b/gfx/layers/basic/BasicCanvasLayer.h @@ -24,7 +24,7 @@ public: CopyableCanvasLayer(aLayerManager, static_cast(this)) { } - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/basic/BasicColorLayer.cpp b/gfx/layers/basic/BasicColorLayer.cpp index 3281574be7e..e847af9d1e0 100644 --- a/gfx/layers/basic/BasicColorLayer.cpp +++ b/gfx/layers/basic/BasicColorLayer.cpp @@ -39,7 +39,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/basic/BasicContainerLayer.cpp b/gfx/layers/basic/BasicContainerLayer.cpp index 25ee8bb0e0b..d73131e9b17 100644 --- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -109,7 +109,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect) return false; nsIntPoint offset(int32_t(transform._31), int32_t(transform._32)); - gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset); + gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds() + offset); nsIntRegion covered; for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) { @@ -121,7 +121,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect) ThebesMatrix(childTransform).HasNonIntegerTranslation() || l->GetEffectiveOpacity() != 1.0) return false; - nsIntRegion childRegion = l->GetEffectiveVisibleRegion(); + nsIntRegion childRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion(); childRegion.MoveBy(int32_t(childTransform._31), int32_t(childTransform._32)); childRegion.And(childRegion, rect); if (l->GetClipRect()) { diff --git a/gfx/layers/basic/BasicContainerLayer.h b/gfx/layers/basic/BasicContainerLayer.h index beca21da3ff..c8227f6e97d 100644 --- a/gfx/layers/basic/BasicContainerLayer.h +++ b/gfx/layers/basic/BasicContainerLayer.h @@ -29,7 +29,7 @@ protected: virtual ~BasicContainerLayer(); public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/basic/BasicImageLayer.cpp b/gfx/layers/basic/BasicImageLayer.cpp index 3023b6f641d..12ce1b00039 100644 --- a/gfx/layers/basic/BasicImageLayer.cpp +++ b/gfx/layers/basic/BasicImageLayer.cpp @@ -38,7 +38,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 32c206133d3..937fa474767 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -245,7 +245,7 @@ public: // Set the opaque rect to match the bounds of the visible region. void AnnotateOpaqueRect() { - const nsIntRegion& visibleRegion = mLayer->GetEffectiveVisibleRegion(); + const nsIntRegion visibleRegion = mLayer->GetEffectiveVisibleRegion().ToUnknownRegion(); const IntRect& bounds = visibleRegion.GetBounds(); DrawTarget *dt = mTarget->GetDrawTarget(); @@ -432,7 +432,7 @@ MarkLayersHidden(Layer* aLayer, const IntRect& aClipRect, return; } - nsIntRegion region = aLayer->GetEffectiveVisibleRegion(); + nsIntRegion region = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion(); IntRect r = region.GetBounds(); TransformIntRect(r, transform, ToOutsideIntRect); r.IntersectRect(r, aDirtyRect); @@ -920,7 +920,7 @@ BasicLayerManager::FlushGroup(PaintLayerContext& aPaintContext, bool aNeedsClipT if (!mTransactionIncomplete) { if (aNeedsClipToVisibleRegion) { gfxUtils::ClipToRegion(aPaintContext.mTarget, - aPaintContext.mLayer->GetEffectiveVisibleRegion()); + aPaintContext.mLayer->GetEffectiveVisibleRegion().ToUnknownRegion()); } CompositionOp op = GetEffectiveOperator(aPaintContext.mLayer); @@ -1032,7 +1032,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, paintLayerContext.Apply2DTransform(); - const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion(); + const nsIntRegion visibleRegion = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion(); // If needsGroup is true, we'll clip to the visible region after we've popped the group if (needsClipToVisibleRegion && !needsGroup) { gfxUtils::ClipToRegion(aTarget, visibleRegion); @@ -1053,7 +1053,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, if (is2D) { if (needsGroup) { PushedGroup pushedGroup = - PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion()); + PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion()); PaintSelfOrChildren(paintLayerContext, pushedGroup.mGroupTarget); PopGroupForLayer(pushedGroup); } else { diff --git a/gfx/layers/basic/BasicLayersImpl.h b/gfx/layers/basic/BasicLayersImpl.h index eb2cc981ce6..8ea3f9f0599 100644 --- a/gfx/layers/basic/BasicLayersImpl.h +++ b/gfx/layers/basic/BasicLayersImpl.h @@ -62,7 +62,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/basic/BasicPaintedLayer.cpp b/gfx/layers/basic/BasicPaintedLayer.cpp index b93ac4d1dab..81acd0b630f 100644 --- a/gfx/layers/basic/BasicPaintedLayer.cpp +++ b/gfx/layers/basic/BasicPaintedLayer.cpp @@ -63,7 +63,7 @@ BasicPaintedLayer::PaintThebes(gfxContext* aContext, mValidRegion.SetEmpty(); mContentClient->Clear(); - nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext); + nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion().ToUnknownRegion(), aContext); RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds()); @@ -168,7 +168,7 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback, // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, - GetEffectiveVisibleRegion()); + GetEffectiveVisibleRegion().ToUnknownRegion()); SetAntialiasingFlags(this, target); RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds()); diff --git a/gfx/layers/basic/BasicPaintedLayer.h b/gfx/layers/basic/BasicPaintedLayer.h index ae5d896121b..4518b64fce9 100644 --- a/gfx/layers/basic/BasicPaintedLayer.h +++ b/gfx/layers/basic/BasicPaintedLayer.h @@ -44,7 +44,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(BasicManager()->InConstruction(), "Can only set properties in construction phase"); @@ -119,7 +119,7 @@ protected: // here (OR doesn't automatically simplify to the simplest possible // representation of a region.) nsIntRegion tmp; - tmp.Or(mVisibleRegion, aExtendedRegionToDraw); + tmp.Or(mVisibleRegion.ToUnknownRegion(), aExtendedRegionToDraw); mValidRegion.Or(mValidRegion, tmp); } diff --git a/gfx/layers/client/ClientCanvasLayer.h b/gfx/layers/client/ClientCanvasLayer.h index d2308197b17..6e633ad4b7c 100644 --- a/gfx/layers/client/ClientCanvasLayer.h +++ b/gfx/layers/client/ClientCanvasLayer.h @@ -44,7 +44,7 @@ protected: virtual ~ClientCanvasLayer(); public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/client/ClientColorLayer.cpp b/gfx/layers/client/ClientColorLayer.cpp index 9452b15d784..d58d1e108c7 100644 --- a/gfx/layers/client/ClientColorLayer.cpp +++ b/gfx/layers/client/ClientColorLayer.cpp @@ -34,7 +34,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/client/ClientContainerLayer.h b/gfx/layers/client/ClientContainerLayer.h index 30d6669d98b..c6ad5b65800 100644 --- a/gfx/layers/client/ClientContainerLayer.h +++ b/gfx/layers/client/ClientContainerLayer.h @@ -71,7 +71,7 @@ public: } } - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/client/ClientImageLayer.cpp b/gfx/layers/client/ClientImageLayer.cpp index d3104fbead0..454dfe20ddf 100644 --- a/gfx/layers/client/ClientImageLayer.cpp +++ b/gfx/layers/client/ClientImageLayer.cpp @@ -46,7 +46,7 @@ protected: mImageClientTypeContainer = CompositableType::UNKNOWN; } - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/client/ClientPaintedLayer.cpp b/gfx/layers/client/ClientPaintedLayer.cpp index 69ed841d579..8192d93cec2 100644 --- a/gfx/layers/client/ClientPaintedLayer.cpp +++ b/gfx/layers/client/ClientPaintedLayer.cpp @@ -75,7 +75,7 @@ ClientPaintedLayer::PaintThebes() // from RGB to RGBA, because we might need to repaint with // subpixel AA) state.mRegionToInvalidate.And(state.mRegionToInvalidate, - GetEffectiveVisibleRegion()); + GetEffectiveVisibleRegion().ToUnknownRegion()); bool didUpdate = false; RotatedContentBuffer::DrawIterator iter; @@ -110,7 +110,7 @@ ClientPaintedLayer::PaintThebes() // so deleting this Hold for whatever reason will break things. ClientManager()->Hold(this); contentClientRemote->Updated(state.mRegionToDraw, - mVisibleRegion, + mVisibleRegion.ToUnknownRegion(), state.mDidSelfCopy); } } diff --git a/gfx/layers/client/ClientPaintedLayer.h b/gfx/layers/client/ClientPaintedLayer.h index 670a1c75fd5..cfc17ba10e6 100644 --- a/gfx/layers/client/ClientPaintedLayer.h +++ b/gfx/layers/client/ClientPaintedLayer.h @@ -50,7 +50,7 @@ protected: } public: - virtual void SetVisibleRegion(const nsIntRegion& aRegion) override + virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override { NS_ASSERTION(ClientManager()->InConstruction(), "Can only set properties in construction phase"); diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp index eee40667829..ef0d6783816 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -410,7 +410,7 @@ ClientTiledPaintedLayer::RenderLayer() ClientManager()->GetPaintedLayerCallback(); void *data = ClientManager()->GetPaintedLayerCallbackData(); - IntSize layerSize = mVisibleRegion.GetBounds().Size(); + IntSize layerSize = mVisibleRegion.ToUnknownRegion().GetBounds().Size(); if (mContentClient && !mContentClient->SupportsLayerSize(layerSize, ClientManager())) { ClearCachedResources(); MOZ_ASSERT(!mContentClient); @@ -439,7 +439,7 @@ ClientTiledPaintedLayer::RenderLayer() TILING_LOG("TILING %p: Initial valid region %s\n", this, Stringify(mValidRegion).c_str()); TILING_LOG("TILING %p: Initial low-precision valid region %s\n", this, Stringify(mLowPrecisionValidRegion).c_str()); - nsIntRegion neededRegion = mVisibleRegion; + nsIntRegion neededRegion = mVisibleRegion.ToUnknownRegion(); #ifndef MOZ_IGNORE_PAINT_WILL_RESAMPLE // This is handled by PadDrawTargetOutFromRegion in TiledContentClient for mobile if (MayResample()) { diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index d35a519ead5..d1ae2e8e573 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -83,11 +83,11 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect, std::stringstream ss; aLayer->PrintInfo(ss, ""); - nsIntRegion visibleRegion = aLayer->GetVisibleRegion(); + LayerIntRegion visibleRegion = aLayer->GetVisibleRegion(); uint32_t maxWidth = std::min(visibleRegion.GetBounds().width, 500); - IntPoint topLeft = visibleRegion.GetBounds().TopLeft(); + IntPoint topLeft = visibleRegion.ToUnknownRegion().GetBounds().TopLeft(); aManager->GetTextRenderer()->RenderText(ss.str().c_str(), topLeft, aLayer->GetEffectiveTransform(), 16, maxWidth); @@ -96,7 +96,7 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect, template static gfx::IntRect ContainerVisibleRect(ContainerT* aContainer) { - gfx::IntRect surfaceRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + gfx::IntRect surfaceRect = aContainer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds(); return surfaceRect; } @@ -233,7 +233,7 @@ ContainerRenderVR(ContainerT* aContainer, IntRectToRect(static_cast(layer)->GetBounds()); } else { layerBounds = - IntRectToRect(layer->GetEffectiveVisibleRegion().GetBounds()); + IntRectToRect(layer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); } const gfx::Matrix4x4 childTransform = layer->GetEffectiveTransform(); layerBounds = childTransform.TransformBounds(layerBounds); @@ -642,7 +642,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager) { Compositor* compositor = aManager->GetCompositor(); - gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds(); RefPtr previousTarget = compositor->GetCurrentRenderTarget(); gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height); @@ -710,7 +710,7 @@ ContainerRender(ContainerT* aContainer, return; } - gfx::Rect visibleRect(aContainer->GetEffectiveVisibleRegion().GetBounds()); + gfx::Rect visibleRect(aContainer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); RefPtr compositor = aManager->GetCompositor(); #ifdef MOZ_DUMP_PAINTING if (gfxEnv::DumpCompositorTextures()) { diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index e8074aed99b..593ace4d584 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -238,7 +238,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer, // Recalculate our visible region. LayerComposite* composite = aLayer->AsLayerComposite(); - LayerIntRegion visible = LayerIntRegion::FromUnknownRegion(composite->GetShadowVisibleRegion()); + LayerIntRegion visible = composite->GetShadowVisibleRegion(); // If we have descendants, throw away the visible region stored on this // layer, and use the region accumulated by our descendants instead. @@ -251,7 +251,7 @@ LayerManagerComposite::PostProcessLayers(Layer* aLayer, visible.SubOut(LayerIntRegion::FromUnknownRegion(obscured)); } - composite->SetShadowVisibleRegion(visible.ToUnknownRegion()); + composite->SetShadowVisibleRegion(visible); // Transform the newly calculated visible region into our parent's space, // apply our clip to it (if any), and accumulate it into |aVisibleRegion| @@ -1140,7 +1140,7 @@ LayerManagerComposite::ComputeRenderIntegrityInternal(Layer* aLayer, } // See if there's any incomplete rendering - nsIntRegion incompleteRegion = aLayer->GetEffectiveVisibleRegion(); + nsIntRegion incompleteRegion = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion(); incompleteRegion.Sub(incompleteRegion, paintedLayer->GetValidRegion()); if (!incompleteRegion.IsEmpty()) { @@ -1475,14 +1475,14 @@ nsIntRegion LayerComposite::GetFullyRenderedRegion() { if (TiledContentHost* tiled = GetCompositableHost() ? GetCompositableHost()->AsTiledContentHost() : nullptr) { - nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion(); + nsIntRegion shadowVisibleRegion = GetShadowVisibleRegion().ToUnknownRegion(); // 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(); + return GetShadowVisibleRegion().ToUnknownRegion(); } } diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index ed07925e054..9762c3630de 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -449,7 +449,7 @@ public: * * They are analogous to the Layer interface. */ - void SetShadowVisibleRegion(const nsIntRegion& aRegion) + void SetShadowVisibleRegion(const LayerIntRegion& aRegion) { mShadowVisibleRegion = aRegion; } @@ -486,7 +486,7 @@ public: // These getters can be used anytime. float GetShadowOpacity() { return mShadowOpacity; } const Maybe& GetShadowClipRect() { return mShadowClipRect; } - const nsIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; } + const LayerIntRegion& GetShadowVisibleRegion() { return mShadowVisibleRegion; } const gfx::Matrix4x4& GetShadowTransform() { return mShadowTransform; } bool GetShadowTransformSetByAnimation() { return mShadowTransformSetByAnimation; } bool HasLayerBeenComposited() { return mLayerComposited; } @@ -501,7 +501,7 @@ public: protected: gfx::Matrix4x4 mShadowTransform; - nsIntRegion mShadowVisibleRegion; + LayerIntRegion mShadowVisibleRegion; Maybe mShadowClipRect; LayerManagerComposite* mCompositeManager; RefPtr mCompositor; @@ -576,7 +576,7 @@ RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor, // into. The final mask gets rendered into the original render target. // Calculate the size of the intermediate surfaces. - gfx::Rect visibleRect(aLayer->GetEffectiveVisibleRegion().GetBounds()); + gfx::Rect visibleRect(aLayer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds()); gfx::Matrix4x4 transform = aLayer->GetEffectiveTransform(); // TODO: Use RenderTargetIntRect and TransformTo<...> here gfx::IntRect surfaceRect = diff --git a/gfx/layers/composite/PaintedLayerComposite.cpp b/gfx/layers/composite/PaintedLayerComposite.cpp index 3e040305604..e6493d3edfd 100644 --- a/gfx/layers/composite/PaintedLayerComposite.cpp +++ b/gfx/layers/composite/PaintedLayerComposite.cpp @@ -112,7 +112,7 @@ PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) mBuffer->GetLayer() == this, "buffer is corrupted"); - const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion(); + const nsIntRegion visibleRegion = GetEffectiveVisibleRegion().ToUnknownRegion(); #ifdef MOZ_DUMP_PAINTING if (gfxEnv::DumpCompositorTextures()) { diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index cf4389d17c1..da6bf3e7549 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -773,7 +773,7 @@ CompositorParent::Invalidate() { if (mLayerManager && mLayerManager->GetRoot()) { mLayerManager->AddInvalidRegion( - mLayerManager->GetRoot()->GetVisibleRegion().GetBounds()); + mLayerManager->GetRoot()->GetVisibleRegion().ToUnknownRegion().GetBounds()); } } diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 5e8302333c0..d7c58ce0bb6 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -34,6 +34,7 @@ using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h using mozilla::LayerMargin from "Units.h"; using mozilla::LayerPoint from "Units.h"; using mozilla::LayerRect from "Units.h"; +using mozilla::LayerIntRegion from "Units.h"; using mozilla::ParentLayerIntRect from "Units.h"; using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h"; using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h"; @@ -202,7 +203,7 @@ struct Animation { // Change a layer's attributes struct CommonLayerAttributes { IntRect layerBounds; - nsIntRegion visibleRegion; + LayerIntRegion visibleRegion; EventRegions eventRegions; TransformMatrix transform; bool transformIsPerspective; diff --git a/gfx/tests/gtest/TestCompositor.cpp b/gfx/tests/gtest/TestCompositor.cpp index 04eaa8ab65f..d6b7442cbcb 100644 --- a/gfx/tests/gtest/TestCompositor.cpp +++ b/gfx/tests/gtest/TestCompositor.cpp @@ -243,19 +243,19 @@ TEST(Gfx, CompositorSimpleTree) { // background ColorLayer* colorLayer = layers[1]->AsColorLayer(); colorLayer->SetColor(Color(1.f, 0.f, 1.f, 1.f)); - colorLayer->SetBounds(colorLayer->GetVisibleRegion().GetBounds()); + colorLayer->SetBounds(colorLayer->GetVisibleRegion().ToUnknownRegion().GetBounds()); } { ColorLayer* colorLayer = layers[2]->AsColorLayer(); colorLayer->SetColor(Color(1.f, 0.f, 0.f, 1.f)); - colorLayer->SetBounds(colorLayer->GetVisibleRegion().GetBounds()); + colorLayer->SetBounds(colorLayer->GetVisibleRegion().ToUnknownRegion().GetBounds()); } { ColorLayer* colorLayer = layers[3]->AsColorLayer(); colorLayer->SetColor(Color(0.f, 0.f, 1.f, 1.f)); - colorLayer->SetBounds(colorLayer->GetVisibleRegion().GetBounds()); + colorLayer->SetBounds(colorLayer->GetVisibleRegion().ToUnknownRegion().GetBounds()); } RefPtr refDT = CreateDT(); diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp index 5f63a66af23..ac7ab49272b 100644 --- a/gfx/tests/gtest/TestLayers.cpp +++ b/gfx/tests/gtest/TestLayers.cpp @@ -214,7 +214,7 @@ already_AddRefed CreateLayerTree( } else { RefPtr layer = CreateLayer(aLayerTreeDescription[i], manager.get()); if (aVisibleRegions) { - layer->SetVisibleRegion(aVisibleRegions[layerNumber]); + layer->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(aVisibleRegions[layerNumber])); layer->SetEventRegions(EventRegions(aVisibleRegions[layerNumber])); } if (aTransforms) { diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 586b74453c7..ca4568f8296 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2284,7 +2284,7 @@ ComputeAndSetIgnoreInvalidationRect(PaintedLayer* aLayer, nsIntRect maxNewVisibleBounds = dirtyRect.ScaleToOutsidePixels(aData->mXScale, aData->mYScale, aData->mAppUnitsPerDevPixel) - aLayerTranslation; - aData->mOldVisibleBounds = aLayer->GetVisibleRegion().GetBounds(); + aData->mOldVisibleBounds = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(); // When the visible region of aLayer changes (e.g. due to scrolling), // three distinct types of invalidations need to be triggered: @@ -2462,7 +2462,7 @@ SetOuterVisibleRegion(Layer* aLayer, nsIntRegion* aOuterVisibleRegion, } } - aLayer->SetVisibleRegion(*aOuterVisibleRegion); + aLayer->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(*aOuterVisibleRegion)); } void @@ -3181,7 +3181,7 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB // can find and recycle it later. ParentLayerIntRect emptyRect; data->mLayer->SetClipRect(Some(emptyRect)); - data->mLayer->SetVisibleRegion(nsIntRegion()); + data->mLayer->SetVisibleRegion(LayerIntRegion()); data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion().GetBounds()); data->mLayer->SetEventRegions(EventRegions()); } @@ -4808,7 +4808,7 @@ InvalidateVisibleBoundsChangesForScrolledLayer(PaintedLayer* aLayer) // window that are in the visible region's bounds but not in the visible // region itself, but that is acceptable for scrolled layers. nsIntRegion rgn; - rgn.Or(data->mOldVisibleBounds, aLayer->GetVisibleRegion().GetBounds()); + rgn.Or(data->mOldVisibleBounds, aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds()); rgn.Sub(rgn, *data->mIgnoreInvalidationsOutsideRect); if (!rgn.IsEmpty()) { aLayer->InvalidateRegion(rgn); @@ -5408,7 +5408,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, // If aContainerItem is non-null some BuildContainerLayer further up the // call stack is responsible for setting containerLayer's visible region. if (!aContainerItem) { - containerLayer->SetVisibleRegion(pixBounds); + containerLayer->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(pixBounds)); } if (aParameters.mLayerContentsVisibleRect) { *aParameters.mLayerContentsVisibleRect = pixBounds + scaleParameters.mOffset; @@ -5743,7 +5743,7 @@ static void DrawForcedBackgroundColor(DrawTarget& aDrawTarget, aBackgroundColor) { if (NS_GET_A(aBackgroundColor) > 0) { - nsIntRect r = aLayer->GetVisibleRegion().GetBounds(); + LayerIntRect r = aLayer->GetVisibleRegion().GetBounds(); ColorPattern color(ToDeviceColor(aBackgroundColor)); aDrawTarget.FillRect(Rect(r.x, r.y, r.width, r.height), color); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index db352b3cda6..80492021dd2 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2543,7 +2543,7 @@ nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer, return; } - nsIntPoint topLeft = aContainer->GetVisibleRegion().GetBounds().TopLeft(); + nsIntPoint topLeft = aContainer->GetVisibleRegion().ToUnknownRegion().GetBounds().TopLeft(); nsIntRegionRectIterator iter(aRegion); while (const nsIntRect* r = iter.Next()) { diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9f28d2a20e1..8aa73e87b5f 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -6130,7 +6130,7 @@ PresShell::Paint(nsView* aViewToPaint, pc->GetVisibleArea().ToOutsidePixels(pc->AppUnitsPerDevPixel()); bgcolor = NS_ComposeColors(bgcolor, mCanvasBackgroundColor); root->SetColor(Color::FromABGR(bgcolor)); - root->SetVisibleRegion(bounds); + root->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(bounds)); layerManager->SetRoot(root); } MaybeSetupTransactionIdAllocator(layerManager, aViewToPaint); diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 842189fa464..d9ac2ebbf08 100644 --- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -278,7 +278,7 @@ HwcComposer2D::PrepareLayerList(Layer* aLayer, bool fillColor = false; - const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion(); + const nsIntRegion visibleRegion = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion(); if (visibleRegion.IsEmpty()) { return true; }