mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1435648 - Part 2: Preallocate the mAssignedDisplayItems array to the size it was last time. r=mstange
This commit is contained in:
parent
c415ea1075
commit
df0359273e
@ -1478,7 +1478,8 @@ public:
|
||||
mXScale(1.f), mYScale(1.f),
|
||||
mAppUnitsPerDevPixel(0),
|
||||
mTranslation(0, 0),
|
||||
mAnimatedGeometryRootPosition(0, 0) {}
|
||||
mAnimatedGeometryRootPosition(0, 0),
|
||||
mLastItemCount(0) {}
|
||||
|
||||
/**
|
||||
* Record the number of clips in the PaintedLayer's mask layer.
|
||||
@ -1541,6 +1542,9 @@ public:
|
||||
// DrawPaintedLayer, for example when progressive paint is enabled.
|
||||
nsIntRegion mVisibilityComputedRegion;
|
||||
|
||||
// The number of items assigned to this layer on the previous paint.
|
||||
size_t mLastItemCount;
|
||||
|
||||
/**
|
||||
* This is set when the painted layer has no component alpha.
|
||||
*/
|
||||
@ -3140,6 +3144,9 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
|
||||
oldData, item);
|
||||
}
|
||||
|
||||
PaintedDisplayItemLayerUserData* userData = GetPaintedDisplayItemLayerUserData(data->mLayer);
|
||||
userData->mLastItemCount = data->mAssignedDisplayItems.Length();
|
||||
|
||||
NewLayerEntry* newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex];
|
||||
|
||||
RefPtr<Layer> layer;
|
||||
@ -4567,6 +4574,9 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
||||
if (layer) {
|
||||
paintedLayerData->mLayer = layer;
|
||||
|
||||
PaintedDisplayItemLayerUserData* userData = GetPaintedDisplayItemLayerUserData(layer);
|
||||
paintedLayerData->mAssignedDisplayItems.SetCapacity(userData->mLastItemCount);
|
||||
|
||||
NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
|
||||
"Layer already in list???");
|
||||
mNewChildLayers[paintedLayerData->mNewChildLayersIndex].mLayer = layer.forget();
|
||||
|
Loading…
Reference in New Issue
Block a user