mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Backout changeset 90ab708bab8b (bug 539356) because of performance and correctness regressions
This commit is contained in:
parent
12c6e3a4cf
commit
881434cf7b
@ -89,7 +89,8 @@ public:
|
||||
mLayerBuilder(aLayerBuilder),
|
||||
mContainerFrame(aContainerFrame), mContainerLayer(aContainerLayer),
|
||||
mParameters(aParameters),
|
||||
mNextFreeRecycledThebesLayer(0)
|
||||
mNextFreeRecycledThebesLayer(0), mNextFreeRecycledColorLayer(0),
|
||||
mNextFreeRecycledImageLayer(0)
|
||||
{
|
||||
nsPresContext* presContext = aContainerFrame->PresContext();
|
||||
mAppUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||
@ -298,12 +299,12 @@ protected:
|
||||
* Grab the next recyclable ColorLayer, or create one if there are no
|
||||
* more recyclable ColorLayers.
|
||||
*/
|
||||
already_AddRefed<ColorLayer> CreateOrRecycleColorLayer(ThebesLayer* aThebes);
|
||||
already_AddRefed<ColorLayer> CreateOrRecycleColorLayer();
|
||||
/**
|
||||
* Grab the next recyclable ImageLayer, or create one if there are no
|
||||
* more recyclable ImageLayers.
|
||||
*/
|
||||
already_AddRefed<ImageLayer> CreateOrRecycleImageLayer(ThebesLayer* aThebes);
|
||||
already_AddRefed<ImageLayer> CreateOrRecycleImageLayer();
|
||||
/**
|
||||
* Grab a recyclable ImageLayer for use as a mask layer for aLayer (that is a
|
||||
* mask layer which has been used for aLayer before), or create one if such
|
||||
@ -395,9 +396,13 @@ protected:
|
||||
typedef nsAutoTArray<nsRefPtr<Layer>,1> AutoLayersArray;
|
||||
AutoLayersArray mNewChildLayers;
|
||||
nsTArray<nsRefPtr<ThebesLayer> > mRecycledThebesLayers;
|
||||
nsTArray<nsRefPtr<ColorLayer> > mRecycledColorLayers;
|
||||
nsTArray<nsRefPtr<ImageLayer> > mRecycledImageLayers;
|
||||
nsDataHashtable<nsPtrHashKey<Layer>, nsRefPtr<ImageLayer> >
|
||||
mRecycledMaskImageLayers;
|
||||
PRUint32 mNextFreeRecycledThebesLayer;
|
||||
PRUint32 mNextFreeRecycledColorLayer;
|
||||
PRUint32 mNextFreeRecycledImageLayer;
|
||||
nscoord mAppUnitsPerDevPixel;
|
||||
bool mSnappingEnabled;
|
||||
};
|
||||
@ -433,9 +438,6 @@ public:
|
||||
gfxPoint mActiveScrolledRootPosition;
|
||||
|
||||
nsIntRegion mRegionToInvalidate;
|
||||
|
||||
nsRefPtr<ColorLayer> mColorLayer;
|
||||
nsRefPtr<ImageLayer> mImageLayer;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -950,12 +952,15 @@ FrameLayerBuilder::GetInactiveLayerManagerFor(nsDisplayItem* aItem)
|
||||
}
|
||||
|
||||
already_AddRefed<ColorLayer>
|
||||
ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
|
||||
ContainerState::CreateOrRecycleColorLayer()
|
||||
{
|
||||
ThebesDisplayItemLayerUserData* data =
|
||||
static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
|
||||
nsRefPtr<ColorLayer> layer = data->mColorLayer;
|
||||
if (layer) {
|
||||
nsRefPtr<ColorLayer> layer;
|
||||
if (mNextFreeRecycledColorLayer < mRecycledColorLayers.Length()) {
|
||||
// Recycle a layer
|
||||
layer = mRecycledColorLayers[mNextFreeRecycledColorLayer];
|
||||
++mNextFreeRecycledColorLayer;
|
||||
// Clear clip rect and mask layer so we don't accidentally stay clipped.
|
||||
// We will reapply any necessary clipping.
|
||||
layer->SetClipRect(nsnull);
|
||||
layer->SetMaskLayer(nsnull);
|
||||
} else {
|
||||
@ -964,22 +969,21 @@ ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
|
||||
if (!layer)
|
||||
return nsnull;
|
||||
// Mark this layer as being used for Thebes-painting display items
|
||||
data->mColorLayer = layer;
|
||||
layer->SetUserData(&gColorLayerUserData, nsnull);
|
||||
|
||||
// Remove other layer types we might have stored for this ThebesLayer
|
||||
data->mImageLayer = nsnull;
|
||||
}
|
||||
return layer.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<ImageLayer>
|
||||
ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
|
||||
ContainerState::CreateOrRecycleImageLayer()
|
||||
{
|
||||
ThebesDisplayItemLayerUserData* data =
|
||||
static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
|
||||
nsRefPtr<ImageLayer> layer = data->mImageLayer;
|
||||
if (layer) {
|
||||
nsRefPtr<ImageLayer> layer;
|
||||
if (mNextFreeRecycledImageLayer < mRecycledImageLayers.Length()) {
|
||||
// Recycle a layer
|
||||
layer = mRecycledImageLayers[mNextFreeRecycledImageLayer];
|
||||
++mNextFreeRecycledImageLayer;
|
||||
// Clear clip rect and mask layer so we don't accidentally stay clipped.
|
||||
// We will reapply any necessary clipping.
|
||||
layer->SetClipRect(nsnull);
|
||||
layer->SetMaskLayer(nsnull);
|
||||
} else {
|
||||
@ -988,11 +992,7 @@ ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
|
||||
if (!layer)
|
||||
return nsnull;
|
||||
// Mark this layer as being used for Thebes-painting display items
|
||||
data->mImageLayer = layer;
|
||||
layer->SetUserData(&gImageLayerUserData, nsnull);
|
||||
|
||||
// Remove other layer types we might have stored for this ThebesLayer
|
||||
data->mColorLayer = nsnull;
|
||||
}
|
||||
return layer.forget();
|
||||
}
|
||||
@ -1315,7 +1315,7 @@ ContainerState::PopThebesLayerData()
|
||||
NS_ASSERTION(!(data->mIsSolidColorInVisibleRegion && imageContainer),
|
||||
"Can't be a solid color as well as an image!");
|
||||
if (imageContainer) {
|
||||
nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer(data->mLayer);
|
||||
nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer();
|
||||
imageLayer->SetContainer(imageContainer);
|
||||
data->mImage->ConfigureLayer(imageLayer);
|
||||
// The layer's current transform is applied first, then the result is scaled.
|
||||
@ -1328,7 +1328,7 @@ ContainerState::PopThebesLayerData()
|
||||
}
|
||||
layer = imageLayer;
|
||||
} else {
|
||||
nsRefPtr<ColorLayer> colorLayer = CreateOrRecycleColorLayer(data->mLayer);
|
||||
nsRefPtr<ColorLayer> colorLayer = CreateOrRecycleColorLayer();
|
||||
colorLayer->SetIsFixedPosition(data->mLayer->GetIsFixedPosition());
|
||||
colorLayer->SetColor(data->mSolidColor);
|
||||
|
||||
@ -2179,7 +2179,11 @@ ContainerState::CollectOldLayers()
|
||||
layer = layer->GetNextSibling()) {
|
||||
NS_ASSERTION(!layer->HasUserData(&gMaskLayerUserData),
|
||||
"Mask layer in layer tree; could not be recycled.");
|
||||
if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
|
||||
if (layer->HasUserData(&gColorLayerUserData)) {
|
||||
mRecycledColorLayers.AppendElement(static_cast<ColorLayer*>(layer));
|
||||
} else if (layer->HasUserData(&gImageLayerUserData)) {
|
||||
mRecycledImageLayers.AppendElement(static_cast<ImageLayer*>(layer));
|
||||
} else if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
|
||||
NS_ASSERTION(layer->AsThebesLayer(), "Wrong layer type");
|
||||
mRecycledThebesLayers.AppendElement(static_cast<ThebesLayer*>(layer));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user