Bug 1220873 - Make Layer::mVisibleRegion a LayerIntRegion. r=botond

This commit is contained in:
Sunny Sidhu 2015-11-29 02:07:55 -05:00
parent 3eed137d9a
commit ae5c61f89f
39 changed files with 98 additions and 95 deletions

View File

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

View File

@ -1737,7 +1737,7 @@ nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
RefPtr<PaintedLayer> root = layerManager->CreatePaintedLayer();
if (root) {
nsIntRect dirtyRect = aRegion.GetBounds();
root->SetVisibleRegion(dirtyRect);
root->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(dirtyRect));
layerManager->SetRoot(root);
}

View File

@ -396,9 +396,11 @@ struct RegionParamTraits
}
};
template<>
struct ParamTraits<nsIntRegion>
: RegionParamTraits<nsIntRegion, mozilla::gfx::IntRect, nsIntRegionRectIterator>
template<class Units>
struct ParamTraits<mozilla::gfx::IntRegionTyped<Units>>
: RegionParamTraits<mozilla::gfx::IntRegionTyped<Units>,
mozilla::gfx::IntRectTyped<Units>,
typename mozilla::gfx::IntRegionTyped<Units>::RectIterator>
{};
template<>

View File

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

View File

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

View File

@ -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<ImageLayer*>(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) {

View File

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

View File

@ -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<ParentLayerIntRect>& 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<FrameMetrics>& 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<ParentLayerIntRect>& 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<RefPtr<Layer>> mAncestorMaskLayers;
gfx::UserData mUserData;
gfx::IntRect mLayerBounds;
nsIntRegion mVisibleRegion;
LayerIntRegion mVisibleRegion;
nsTArray<FrameMetrics> 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());
}
/**

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ public:
CopyableCanvasLayer(aLayerManager, static_cast<BasicImplData*>(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");

View File

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

View File

@ -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()) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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()) {

View File

@ -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<uint32_t>(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<class ContainerT>
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<CanvasLayer*>(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<CompositingRenderTarget> 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> compositor = aManager->GetCompositor();
#ifdef MOZ_DUMP_PAINTING
if (gfxEnv::DumpCompositorTextures()) {

View File

@ -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();
}
}

View File

@ -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<ParentLayerIntRect>& 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<ParentLayerIntRect> mShadowClipRect;
LayerManagerComposite* mCompositeManager;
RefPtr<Compositor> 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 =

View File

@ -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()) {

View File

@ -773,7 +773,7 @@ CompositorParent::Invalidate()
{
if (mLayerManager && mLayerManager->GetRoot()) {
mLayerManager->AddInvalidRegion(
mLayerManager->GetRoot()->GetVisibleRegion().GetBounds());
mLayerManager->GetRoot()->GetVisibleRegion().ToUnknownRegion().GetBounds());
}
}

View File

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

View File

@ -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<DrawTarget> refDT = CreateDT();

View File

@ -214,7 +214,7 @@ already_AddRefed<Layer> CreateLayerTree(
} else {
RefPtr<Layer> 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) {

View File

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

View File

@ -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()) {

View File

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

View File

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