Bug 539356 - Part 20 - Simplify regions to avoid excessive region calculation. r=roc

This commit is contained in:
Oleg Romashin 2012-06-11 16:45:39 +12:00
Родитель dfe1af8b8b
Коммит 7aaf0454e0
8 изменённых файлов: 22 добавлений и 14 удалений

Просмотреть файл

@ -115,7 +115,7 @@ struct LayerPropertiesBase : public LayerProperties
}
result = result.Union(ComputeChangeInternal(aCallback));
result = result.Union(TransformRect(mLayer->GetInvalidRect(), mTransform));
result = result.Union(TransformRect(mLayer->GetInvalidRegion().GetBounds(), mTransform));
if (mMaskLayer && otherMask) {
nsIntRect maskDiff = mMaskLayer->ComputeChange(aCallback);

Просмотреть файл

@ -911,23 +911,23 @@ public:
* Returns the current area of the layer (in layer-space coordinates)
* marked as needed to be recomposited.
*/
const nsIntRect& GetInvalidRect() { return mInvalidRect; }
const nsIntRegion& GetInvalidRegion() { return mInvalidRegion; }
/**
* Mark the entirety of the layer's visible region as being invalid.
*/
void SetInvalidRectToVisibleRegion() { mInvalidRect = GetVisibleRegion().GetBounds(); }
void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion(); }
/**
* Adds to the current invalid rect.
*/
void AddInvalidRect(const nsIntRect& aRect) { mInvalidRect = mInvalidRect.Union(aRect); }
void AddInvalidRect(const nsIntRect& aRect) { mInvalidRegion.Or(mInvalidRegion, aRect); }
/**
* Clear the invalid rect, marking the layer as being identical to what is currently
* composited.
*/
void ClearInvalidRect() { mInvalidRect.SetEmpty(); }
void ClearInvalidRect() { mInvalidRegion.SetEmpty(); }
#ifdef DEBUG
@ -994,12 +994,12 @@ protected:
float mOpacity;
nsIntRect mClipRect;
nsIntRect mTileSourceRect;
nsIntRect mInvalidRect;
PRUint32 mContentFlags;
bool mUseClipRect;
bool mUseTileSourceRect;
bool mIsFixedPosition;
DebugOnly<PRUint32> mDebugColorIndex;
nsIntRegion mInvalidRegion;
};
/**

Просмотреть файл

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

Просмотреть файл

@ -53,8 +53,9 @@ void
ThebesLayerD3D10::InvalidateRegion(const nsIntRegion &aRegion)
{
mValidRegion.Sub(mValidRegion, aRegion);
AddInvalidRect(aRegion.GetBounds());
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(10);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
}
void ThebesLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,

Просмотреть файл

@ -47,8 +47,9 @@ ThebesLayerD3D9::~ThebesLayerD3D9()
void
ThebesLayerD3D9::InvalidateRegion(const nsIntRegion &aRegion)
{
mValidRegion.Sub(mValidRegion, aRegion);
AddInvalidRect(aRegion.GetBounds());
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(10);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
}
void

Просмотреть файл

@ -784,8 +784,9 @@ ThebesLayerOGL::SetVisibleRegion(const nsIntRegion &aRegion)
void
ThebesLayerOGL::InvalidateRegion(const nsIntRegion &aRegion)
{
mValidRegion.Sub(mValidRegion, aRegion);
AddInvalidRect(aRegion.GetBounds());
mInvalidRegion.Or(mInvalidRegion, aRegion);
mInvalidRegion.SimplifyOutward(10);
mValidRegion.Sub(mValidRegion, mInvalidRegion);
}
void

Просмотреть файл

@ -674,6 +674,8 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
nsIntRect invalid;
if (props) {
invalid = props->ComputeDifferences(root, computeInvalidFunc);
} else if (widgetTransaction) {
LayerProperties::ClearInvalidations(root);
}
if (view) {

Просмотреть файл

@ -5274,6 +5274,8 @@ PresShell::Paint(nsIView* aViewToPaint,
nsIntRect invalid;
if (props) {
invalid = props->ComputeDifferences(layerManager->GetRoot(), computeInvalidFunc);
} else {
LayerProperties::ClearInvalidations(layerManager->GetRoot());
}
if (!invalid.IsEmpty()) {
if (props) {