mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 713532. Part 1: Suppress subpixel antialising in retained layers with an ancestor which has a non-integer-translation transform. r=tn
This commit is contained in:
parent
d0513e5d06
commit
31c1e64fa9
@ -792,7 +792,7 @@ static nsIntPoint
|
||||
GetTranslationForThebesLayer(ThebesLayer* aLayer)
|
||||
{
|
||||
gfxMatrix transform;
|
||||
if (!aLayer->GetTransform().Is2D(&transform) &&
|
||||
if (!aLayer->GetTransform().Is2D(&transform) ||
|
||||
transform.HasNonIntegerTranslation()) {
|
||||
NS_ERROR("ThebesLayers should have integer translations only");
|
||||
return nsIntPoint(0, 0);
|
||||
@ -1220,16 +1220,24 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState,
|
||||
}
|
||||
}
|
||||
}
|
||||
nsRect componentAlpha = aItem->GetComponentAlphaBounds(aState->mBuilder);
|
||||
componentAlpha.IntersectRect(componentAlpha, aItem->GetVisibleRect());
|
||||
if (!componentAlpha.IsEmpty()) {
|
||||
nscoord appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem);
|
||||
if (!mOpaqueRegion.Contains(componentAlpha.ScaleToOutsidePixels(
|
||||
aState->mParameters.mXScale, aState->mParameters.mYScale, appUnitsPerDevPixel))) {
|
||||
if (SuppressComponentAlpha(aState->mBuilder, aItem, componentAlpha)) {
|
||||
aItem->DisableComponentAlpha();
|
||||
} else {
|
||||
mNeedComponentAlpha = true;
|
||||
if (aState->mParameters.mDisableSubpixelAntialiasingInDescendants) {
|
||||
// Disable component alpha. This is cheaper than calling GetComponentAlphaBounds since for
|
||||
// most items this is a single virtual call that does nothing.
|
||||
// Note that the transform (if any) on the ThebesLayer is always an integer translation so
|
||||
// we don't have to factor that in here.
|
||||
aItem->DisableComponentAlpha();
|
||||
} else {
|
||||
nsRect componentAlpha = aItem->GetComponentAlphaBounds(aState->mBuilder);
|
||||
componentAlpha.IntersectRect(componentAlpha, aItem->GetVisibleRect());
|
||||
if (!componentAlpha.IsEmpty()) {
|
||||
nscoord appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem);
|
||||
if (!mOpaqueRegion.Contains(componentAlpha.ScaleToOutsidePixels(
|
||||
aState->mParameters.mXScale, aState->mParameters.mYScale, appUnitsPerDevPixel))) {
|
||||
if (SuppressComponentAlpha(aState->mBuilder, aItem, componentAlpha)) {
|
||||
aItem->DisableComponentAlpha();
|
||||
} else {
|
||||
mNeedComponentAlpha = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1684,11 +1692,13 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
}
|
||||
|
||||
gfxMatrix transform2d;
|
||||
bool is2D = transform.Is2D(&transform2d);
|
||||
gfxSize scale;
|
||||
bool isRetained = aLayerBuilder->GetRetainingLayerManager() == aLayer->Manager();
|
||||
// Only fiddle with scale factors for the retaining layer manager, since
|
||||
// it only matters for retained layers
|
||||
if (aLayerBuilder->GetRetainingLayerManager() == aLayer->Manager() &&
|
||||
transform.Is2D(&transform2d)) {
|
||||
// XXX Should we do something for 3D transforms?
|
||||
if (is2D && isRetained) {
|
||||
//Scale factors are normalized to a power of 2 to reduce the number of resolution changes
|
||||
scale = transform2d.ScaleFactors(true);
|
||||
// For frames with a changing transform that's not just a translation,
|
||||
@ -1738,6 +1748,9 @@ ChooseScaleAndSetTransform(FrameLayerBuilder* aLayerBuilder,
|
||||
result.mInActiveTransformedSubtree = true;
|
||||
}
|
||||
}
|
||||
if (isRetained && (!is2D || transform2d.HasNonIntegerTranslation())) {
|
||||
result.mDisableSubpixelAntialiasingInDescendants = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -144,18 +144,25 @@ public:
|
||||
struct ContainerParameters {
|
||||
ContainerParameters() :
|
||||
mXScale(1), mYScale(1),
|
||||
mInTransformedSubtree(false), mInActiveTransformedSubtree(false) {}
|
||||
mInTransformedSubtree(false), mInActiveTransformedSubtree(false),
|
||||
mDisableSubpixelAntialiasingInDescendants(false)
|
||||
{}
|
||||
ContainerParameters(float aXScale, float aYScale) :
|
||||
mXScale(aXScale), mYScale(aYScale),
|
||||
mInTransformedSubtree(false), mInActiveTransformedSubtree(false) {}
|
||||
mInTransformedSubtree(false), mInActiveTransformedSubtree(false),
|
||||
mDisableSubpixelAntialiasingInDescendants(false)
|
||||
{}
|
||||
ContainerParameters(float aXScale, float aYScale,
|
||||
const ContainerParameters& aParent) :
|
||||
mXScale(aXScale), mYScale(aYScale),
|
||||
mInTransformedSubtree(aParent.mInTransformedSubtree),
|
||||
mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree) {}
|
||||
mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree),
|
||||
mDisableSubpixelAntialiasingInDescendants(aParent.mDisableSubpixelAntialiasingInDescendants)
|
||||
{}
|
||||
float mXScale, mYScale;
|
||||
bool mInTransformedSubtree;
|
||||
bool mInActiveTransformedSubtree;
|
||||
bool mDisableSubpixelAntialiasingInDescendants;
|
||||
};
|
||||
/**
|
||||
* Build a container layer for a display item that contains a child
|
||||
|
Loading…
Reference in New Issue
Block a user