Bug 1224433 - Part 3: Compute the invalidation area for preserve-3d layers by accumulating the leaves. r=roc
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -226,23 +226,23 @@ struct LayerPropertiesBase : public Laye
AddRegion(result, tmp);
}
}
mLayer->ClearInvalidRect();
return result;
}
- IntRect NewTransformedBounds()
+ virtual IntRect NewTransformedBounds()
{
return TransformRect(mLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(),
GetTransformForInvalidation(mLayer));
}
- IntRect OldTransformedBounds()
+ virtual IntRect OldTransformedBounds()
{
return TransformRect(mVisibleRegion.ToUnknownRegion().GetBounds(), mTransform);
}
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
bool& aGeometryChanged)
{
return IntRect();
@@ -268,18 +268,18 @@ struct ContainerLayerProperties : public
, mPreXScale(aLayer->GetPreXScale())
, mPreYScale(aLayer->GetPreYScale())
{
for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) {
mChildren.AppendElement(Move(CloneLayerTreePropertiesInternal(child)));
}
}
- virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
- bool& aGeometryChanged)
+ nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
+ bool& aGeometryChanged) override
{
ContainerLayer* container = mLayer->AsContainerLayer();
nsIntRegion invalidOfLayer; // Invalid regions of this layer.
nsIntRegion result; // Invliad regions for children only.
bool childrenChanged = false;
if (mPreXScale != container->GetPreXScale() ||
@@ -377,16 +377,41 @@ struct ContainerLayerProperties : public
}
// else, effective transforms have applied on children.
result.OrWith(invalidOfLayer);
return result;
}
+ IntRect NewTransformedBounds() override
+ {
+ if (mLayer->Extend3DContext()) {
+ IntRect result;
+ for (UniquePtr<LayerPropertiesBase>& child : mChildren) {
+ result = result.Union(child->NewTransformedBounds());
+ }
+ return result;
+ }
+
+ return LayerPropertiesBase::NewTransformedBounds();
+ }
+
+ IntRect OldTransformedBounds() override
+ {
+ if (mLayer->Extend3DContext()) {
+ IntRect result;
+ for (UniquePtr<LayerPropertiesBase>& child : mChildren) {
+ result = result.Union(child->OldTransformedBounds());
+ }
+ return result;
+ }
+ return LayerPropertiesBase::OldTransformedBounds();
+ }
+
// The old list of children:
AutoTArray<UniquePtr<LayerPropertiesBase>,1> mChildren;
float mPreXScale;
float mPreYScale;
};
struct ColorLayerProperties : public LayerPropertiesBase
{