Bug 1236043 - Use TiledRegion for the invalid region of a layer. r=jrmuizel

MozReview-Commit-ID: BNUyUPbrnU1

--HG--
extra : rebase_source : 80342a281d6fd30ba8d12b77b3af4aec60376294
This commit is contained in:
Markus Stange 2016-04-18 13:49:14 -04:00
parent 733dca9123
commit 40e0b92cb8
6 changed files with 20 additions and 19 deletions

View File

@ -132,7 +132,6 @@ struct LayerPropertiesBase : public LayerProperties
: mLayer(aLayer)
, mMaskLayer(nullptr)
, mVisibleRegion(mLayer->GetLocalVisibleRegion().ToUnknownRegion())
, mInvalidRegion(aLayer->GetInvalidRegion())
, mPostXScale(aLayer->GetPostXScale())
, mPostYScale(aLayer->GetPostYScale())
, mOpacity(aLayer->GetLocalOpacity())
@ -202,7 +201,7 @@ struct LayerPropertiesBase : public LayerProperties
}
AddRegion(result, ComputeChangeInternal(aCallback, aGeometryChanged));
AddTransformedRegion(result, mLayer->GetInvalidRegion(), mTransform);
AddTransformedRegion(result, mLayer->GetInvalidRegion().GetRegion(), mTransform);
if (mMaskLayer && otherMask) {
AddTransformedRegion(result, mMaskLayer->ComputeChange(aCallback, aGeometryChanged),
@ -252,7 +251,6 @@ struct LayerPropertiesBase : public LayerProperties
UniquePtr<LayerPropertiesBase> mMaskLayer;
nsTArray<UniquePtr<LayerPropertiesBase>> mAncestorMaskLayers;
nsIntRegion mVisibleRegion;
nsIntRegion mInvalidRegion;
Matrix4x4 mTransform;
float mPostXScale;
float mPostYScale;

View File

@ -28,6 +28,7 @@
#include "mozilla/gfx/BaseMargin.h" // for BaseMargin
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/TiledRegion.h" // for TiledIntRegion
#include "mozilla/gfx/Types.h" // for SurfaceFormat
#include "mozilla/gfx/UserData.h" // for UserData, etc
#include "mozilla/layers/LayersTypes.h"
@ -1662,20 +1663,24 @@ public:
* Returns the current area of the layer (in layer-space coordinates)
* marked as needed to be recomposited.
*/
const nsIntRegion& GetInvalidRegion() { return mInvalidRegion; }
const gfx::TiledIntRegion& GetInvalidRegion() { return mInvalidRegion; }
void AddInvalidRegion(const nsIntRegion& aRegion) {
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.Add(aRegion);
}
/**
* Mark the entirety of the layer's visible region as being invalid.
*/
void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion().ToUnknownRegion(); }
void SetInvalidRectToVisibleRegion()
{
mInvalidRegion.SetEmpty();
mInvalidRegion.Add(GetVisibleRegion().ToUnknownRegion());
}
/**
* Adds to the current invalid rect.
*/
void AddInvalidRect(const gfx::IntRect& aRect) { mInvalidRegion.Or(mInvalidRegion, aRect); }
void AddInvalidRect(const gfx::IntRect& aRect) { mInvalidRegion.Add(aRect); }
/**
* Clear the invalid rect, marking the layer as being identical to what is currently
@ -1833,7 +1838,7 @@ protected:
bool mForceIsolatedGroup;
Maybe<ParentLayerIntRect> mClipRect;
gfx::IntRect mTileSourceRect;
nsIntRegion mInvalidRegion;
gfx::TiledIntRegion mInvalidRegion;
nsTArray<RefPtr<AsyncPanZoomController> > mApzcs;
uint32_t mContentFlags;
bool mUseTileSourceRect;

View File

@ -54,9 +54,8 @@ public:
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(20);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
mInvalidRegion.Add(aRegion);
mValidRegion.Sub(mValidRegion, mInvalidRegion.GetRegion());
}
virtual void PaintThebes(gfxContext* aContext,

View File

@ -60,9 +60,8 @@ public:
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(20);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
mInvalidRegion.Add(aRegion);
mValidRegion.Sub(mValidRegion, mInvalidRegion.GetRegion());
}
virtual void RenderLayer() override { RenderLayerWithReadback(nullptr); }

View File

@ -54,10 +54,10 @@ public:
// PaintedLayer
virtual Layer* AsLayer() override { return this; }
virtual void InvalidateRegion(const nsIntRegion& aRegion) override {
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(20);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, mInvalidRegion);
mInvalidRegion.Add(aRegion);
nsIntRegion invalidRegion = mInvalidRegion.GetRegion();
mValidRegion.Sub(mValidRegion, invalidRegion);
mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, invalidRegion);
}
// Shadow methods

View File

@ -844,7 +844,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
}
common.maskLayerParent() = nullptr;
common.animations() = mutant->GetAnimations();
common.invalidRegion() = mutant->GetInvalidRegion();
common.invalidRegion() = mutant->GetInvalidRegion().GetRegion();
common.scrollMetadata() = mutant->GetAllScrollMetadata();
for (size_t i = 0; i < mutant->GetAncestorMaskLayerCount(); i++) {
auto layer = Shadow(mutant->GetAncestorMaskLayerAt(i)->AsShadowableLayer());