mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 579276. Part 7: Don't retain transparent layers that would hurt text rendering. r=cjones
This commit is contained in:
parent
7e230f4f3c
commit
3f950a172c
@ -367,6 +367,23 @@ InheritContextFlags(gfxContext* aSource, gfxContext* aDest)
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
ShouldRetainTransparentSurface(PRUint32 aContentFlags,
|
||||
gfxASurface* aTargetSurface)
|
||||
{
|
||||
if (aContentFlags & Layer::CONTENT_NO_TEXT)
|
||||
return PR_TRUE;
|
||||
|
||||
switch (aTargetSurface->GetTextQualityInTransparentSurfaces()) {
|
||||
case gfxASurface::TEXT_QUALITY_OK:
|
||||
return PR_TRUE;
|
||||
case gfxASurface::TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS:
|
||||
return (aContentFlags & Layer::CONTENT_NO_TEXT_OVER_TRANSPARENT) != 0;
|
||||
default:
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BasicThebesLayer::Paint(gfxContext* aContext,
|
||||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
@ -377,15 +394,20 @@ BasicThebesLayer::Paint(gfxContext* aContext,
|
||||
"Can only draw in drawing phase");
|
||||
gfxContext* target = BasicManager()->GetTarget();
|
||||
NS_ASSERTION(target, "We shouldn't be called if there's no target");
|
||||
nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface();
|
||||
|
||||
PRBool canUseOpaqueSurface = CanUseOpaqueSurface();
|
||||
if (!BasicManager()->IsRetained() ||
|
||||
(aOpacity == 1.0 && !canUseOpaqueSurface &&
|
||||
!ShouldRetainTransparentSurface(mContentFlags, targetSurface))) {
|
||||
mValidRegion.SetEmpty();
|
||||
mBuffer.Clear();
|
||||
|
||||
if (!BasicManager()->IsRetained()) {
|
||||
if (aOpacity != 1.0) {
|
||||
target->Save();
|
||||
ClipToContain(target, mVisibleRegion.GetBounds());
|
||||
target->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
|
||||
}
|
||||
mValidRegion.SetEmpty();
|
||||
mBuffer.Clear();
|
||||
aCallback(this, target, mVisibleRegion, nsIntRegion(), aCallbackData);
|
||||
if (aOpacity != 1.0) {
|
||||
target->PopGroupToSource();
|
||||
@ -395,15 +417,12 @@ BasicThebesLayer::Paint(gfxContext* aContext,
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface();
|
||||
PRBool isOpaqueContent =
|
||||
(targetSurface->AreSimilarSurfacesSensitiveToContentType() &&
|
||||
aOpacity == 1.0 &&
|
||||
CanUseOpaqueSurface());
|
||||
{
|
||||
PRBool opaqueBuffer = canUseOpaqueSurface &&
|
||||
targetSurface->AreSimilarSurfacesSensitiveToContentType();
|
||||
Buffer::ContentType contentType =
|
||||
isOpaqueContent ? gfxASurface::CONTENT_COLOR :
|
||||
gfxASurface::CONTENT_COLOR_ALPHA;
|
||||
opaqueBuffer ? gfxASurface::CONTENT_COLOR :
|
||||
gfxASurface::CONTENT_COLOR_ALPHA;
|
||||
Buffer::PaintState state = mBuffer.BeginPaint(this, contentType);
|
||||
mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
|
||||
|
||||
@ -425,7 +444,7 @@ BasicThebesLayer::Paint(gfxContext* aContext,
|
||||
}
|
||||
}
|
||||
|
||||
mBuffer.DrawTo(this, isOpaqueContent, target, aOpacity);
|
||||
mBuffer.DrawTo(this, canUseOpaqueSurface, target, aOpacity);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user