Backed out changeset b049e0ae4d1d (bug 1039145)

This commit is contained in:
Carsten "Tomcat" Book 2014-07-18 10:45:24 +02:00
parent 9522edcc50
commit 4e4432eac0
5 changed files with 14 additions and 27 deletions

View File

@ -155,12 +155,6 @@ LayerManager::CreateAsynchronousImageContainer()
return container.forget();
}
bool
LayerManager::AreComponentAlphaLayersEnabled()
{
return gfxPrefs::ComponentAlphaEnabled();
}
//--------------------------------------------------
// Layer
@ -1029,8 +1023,7 @@ ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToS
void
ContainerLayer::DefaultComputeSupportsComponentAlphaChildren(bool* aNeedsSurfaceCopy)
{
if (!(GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA_DESCENDANT) ||
!Manager()->AreComponentAlphaLayersEnabled()) {
if (!(GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA_DESCENDANT)) {
mSupportsComponentAlphaChildren = false;
if (aNeedsSurfaceCopy) {
*aNeedsSurfaceCopy = false;
@ -1038,30 +1031,32 @@ ContainerLayer::DefaultComputeSupportsComponentAlphaChildren(bool* aNeedsSurface
return;
}
mSupportsComponentAlphaChildren = false;
bool supportsComponentAlphaChildren = false;
bool needsSurfaceCopy = false;
CompositionOp blendMode = GetEffectiveMixBlendMode();
if (UseIntermediateSurface()) {
if (GetEffectiveVisibleRegion().GetNumRects() == 1 &&
(GetContentFlags() & Layer::CONTENT_OPAQUE))
{
mSupportsComponentAlphaChildren = true;
supportsComponentAlphaChildren = true;
} else {
gfx::Matrix transform;
if (HasOpaqueAncestorLayer(this) &&
GetEffectiveTransform().Is2D(&transform) &&
!gfx::ThebesMatrix(transform).HasNonIntegerTranslation() &&
blendMode == gfx::CompositionOp::OP_OVER) {
mSupportsComponentAlphaChildren = true;
supportsComponentAlphaChildren = true;
needsSurfaceCopy = true;
}
}
} else if (blendMode == gfx::CompositionOp::OP_OVER) {
mSupportsComponentAlphaChildren =
supportsComponentAlphaChildren =
(GetContentFlags() & Layer::CONTENT_OPAQUE) ||
(GetParent() && GetParent()->SupportsComponentAlphaChildren());
}
mSupportsComponentAlphaChildren = supportsComponentAlphaChildren &&
gfxPrefs::ComponentAlphaEnabled();
if (aNeedsSurfaceCopy) {
*aNeedsSurfaceCopy = mSupportsComponentAlphaChildren && needsSurfaceCopy;
}

View File

@ -308,20 +308,12 @@ public:
bool IsSnappingEffectiveTransforms() { return mSnapEffectiveTransforms; }
/**
* Returns true if the layer manager can't render component alpha
* layers, and layer building should do it's best to avoid
* creating them.
*/
virtual bool ShouldAvoidComponentAlphaLayers() { return false; }
/**
* Returns true if this LayerManager can properly support layers with
* SurfaceMode::SURFACE_COMPONENT_ALPHA. LayerManagers that can't will use
* transparent surfaces (and lose subpixel-AA for text).
* SurfaceMode::SURFACE_COMPONENT_ALPHA. This can include disabling component
* alpha if required.
*/
virtual bool AreComponentAlphaLayersEnabled();
virtual bool AreComponentAlphaLayersEnabled() { return true; }
/**
* CONSTRUCTION PHASE ONLY

View File

@ -105,7 +105,7 @@ public:
virtual void EndTransaction(DrawThebesLayerCallback aCallback,
void* aCallbackData,
EndTransactionFlags aFlags = END_DEFAULT);
virtual bool ShouldAvoidComponentAlphaLayers() { return IsWidgetLayerManager(); }
virtual bool AreComponentAlphaLayersEnabled() { return !IsWidgetLayerManager(); }
void AbortTransaction();

View File

@ -146,7 +146,7 @@ public:
CompositorChild* GetCompositorChild();
// Disable component alpha layers with the software compositor.
virtual bool ShouldAvoidComponentAlphaLayers() { return !IsCompositingCheap(); }
virtual bool AreComponentAlphaLayersEnabled() MOZ_OVERRIDE { return IsCompositingCheap(); }
/**
* Called for each iteration of a progressive tile update. Updates

View File

@ -3419,7 +3419,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
int32_t appUnitsPerDevPixel;
uint32_t stateFlags = 0;
if ((aContainerFrame->GetStateBits() & NS_FRAME_NO_COMPONENT_ALPHA) &&
mRetainingManager && mRetainingManager->ShouldAvoidComponentAlphaLayers()) {
mRetainingManager && !mRetainingManager->AreComponentAlphaLayersEnabled()) {
stateFlags = ContainerState::NO_COMPONENT_ALPHA;
}
uint32_t flags;
@ -3441,7 +3441,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
if (hasComponentAlphaChildren &&
mRetainingManager &&
mRetainingManager->ShouldAvoidComponentAlphaLayers() &&
!mRetainingManager->AreComponentAlphaLayersEnabled() &&
containerLayer->HasMultipleChildren() &&
!stateFlags) {
// Since we don't want any component alpha layers on BasicLayers, we repeat