Bug 612840. Part 1: Remove CONTENT_NO_TEXT flag since it's not really used. Also remove ShouldRetainTransparentSurface and related code; we'll assume that when text is over opaque pixels in an RGBA surface we can always paint it with subpixel AA --- and make it so in later patches. r=vlad

This commit is contained in:
Robert O'Callahan 2010-12-20 14:26:13 +13:00
Родитель ab2a8549d1
Коммит d8ccf4a713
9 изменённых файлов: 3 добавлений и 99 удалений

Просмотреть файл

@ -443,9 +443,6 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
if (GetContentFlags() & CONTENT_OPAQUE) {
aTo += " [opaqueContent]";
}
if (GetContentFlags() & CONTENT_NO_TEXT) {
aTo += " [noText]";
}
if (GetContentFlags() & CONTENT_NO_TEXT_OVER_TRANSPARENT) {
aTo += " [noTextOverTransparent]";
}

Просмотреть файл

@ -481,20 +481,13 @@ public:
* SetVisibleRegion) will be filled with opaque content.
*/
CONTENT_OPAQUE = 0x01,
/**
* ThebesLayers only!
* If this is set, the caller is promising that the visible region
* contains no text at all. If this is set,
* CONTENT_NO_TEXT_OVER_TRANSPARENT will also be set.
*/
CONTENT_NO_TEXT = 0x02,
/**
* ThebesLayers only!
* If this is set, the caller is promising that the visible region
* contains no text over transparent pixels (any text, if present,
* is over fully opaque pixels).
*/
CONTENT_NO_TEXT_OVER_TRANSPARENT = 0x04
CONTENT_NO_TEXT_OVER_TRANSPARENT = 0x02
};
/**
* CONSTRUCTION PHASE ONLY

Просмотреть файл

@ -439,32 +439,6 @@ ClipToContain(gfxContext* aContext, const nsIntRect& aRect)
aContext->SetMatrix(currentMatrix);
}
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:
// Retain the buffer if all text is over opaque pixels. Otherwise,
// don't retain the buffer, in the hope that the backbuffer has
// opaque pixels where our layer does not.
return (aContentFlags & Layer::CONTENT_NO_TEXT_OVER_TRANSPARENT) != 0;
case gfxASurface::TEXT_QUALITY_BAD:
// If the backbuffer is opaque, then draw directly into it to get
// subpixel AA. If the backbuffer is not an opaque format, then we won't get
// subpixel AA by drawing into it, so we might as well retain.
return aTargetSurface->GetContentType() != gfxASurface::CONTENT_COLOR;
default:
NS_ERROR("Unknown quality type");
return PR_TRUE;
}
}
static nsIntRegion
IntersectWithClip(const nsIntRegion& aRegion, gfxContext* aContext)
{
@ -495,7 +469,7 @@ BasicThebesLayer::Paint(gfxContext* aContext,
if (!BasicManager()->IsRetained() ||
(opacity == 1.0 && !canUseOpaqueSurface &&
!ShouldRetainTransparentSurface(mContentFlags, targetSurface) &&
!(mContentFlags & CONTENT_NO_TEXT_OVER_TRANSPARENT) &&
!MustRetainContent())) {
mValidRegion.SetEmpty();
mBuffer.Clear();

Просмотреть файл

@ -160,39 +160,6 @@ public:
return nsnull;
}
enum TextQuality {
/**
* TEXT_QUALITY_OK means that text is always rendered to a
* transparent surface just as well as it would be rendered to an
* opaque surface. This would normally only be true if
* subpixel antialiasing is disabled or if the platform's
* transparent surfaces support component alpha.
*/
TEXT_QUALITY_OK,
/**
* TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS means that text is rendered
* to a transparent surface just as well as it would be rendered to an
* opaque surface, but only if all the pixels the text is drawn
* over already have opaque alpha values.
*/
TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS,
/**
* TEXT_QUALITY_BAD means that text is rendered
* to a transparent surface worse than it would be rendered to an
* opaque surface, even if all the pixels the text is drawn
* over already have opaque alpha values.
*/
TEXT_QUALITY_BAD
};
/**
* Determine how well text would be rendered in transparent surfaces that
* are similar to this surface.
*/
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
return TEXT_QUALITY_BAD;
}
int CairoStatus();
/* Make sure that the given dimensions don't overflow a 32-bit signed int

Просмотреть файл

@ -61,13 +61,6 @@ public:
virtual ~gfxD2DSurface();
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
// D2D always draws text in transparent surfaces with grayscale-AA,
// even if the text is over opaque pixels.
return TEXT_QUALITY_BAD;
}
void Present();
void Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip);

Просмотреть файл

@ -57,10 +57,6 @@ public:
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
const gfxIntSize& aSize);
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
return TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS;
}
virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }

Просмотреть файл

@ -81,11 +81,6 @@ public:
const gfxIntSize& size,
gfxImageFormat format);
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
return TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS;
}
nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
nsresult EndPrinting();
nsresult AbortPrinting();

Просмотреть файл

@ -77,11 +77,6 @@ public:
virtual already_AddRefed<gfxASurface>
CreateSimilarSurface(gfxContentType aType, const gfxIntSize& aSize);
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
return TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS;
}
virtual const gfxIntSize GetSize() const { return mSize; }
Display* XDisplay() { return mDisplay; }

Просмотреть файл

@ -166,7 +166,7 @@ protected:
ThebesLayerData() :
mActiveScrolledRoot(nsnull), mLayer(nsnull),
mIsSolidColorInVisibleRegion(PR_FALSE),
mHasText(PR_FALSE), mHasTextOverTransparent(PR_FALSE),
mHasTextOverTransparent(PR_FALSE),
mForceTransparentSurface(PR_FALSE) {}
/**
* Record that an item has been added to the ThebesLayer, so we
@ -236,10 +236,6 @@ protected:
* True if every pixel in mVisibleRegion will have color mSolidColor.
*/
PRPackedBool mIsSolidColorInVisibleRegion;
/**
* True if there is any text visible in the layer.
*/
PRPackedBool mHasText;
/**
* True if there is any text visible in the layer that's over
* transparent pixels in the layer.
@ -871,7 +867,6 @@ ContainerState::PopThebesLayerData()
}
PRUint32 flags =
((isOpaque && !data->mForceTransparentSurface) ? Layer::CONTENT_OPAQUE : 0) |
(data->mHasText ? 0 : Layer::CONTENT_NO_TEXT) |
(data->mHasTextOverTransparent ? 0 : Layer::CONTENT_NO_TEXT_OVER_TRANSPARENT);
layer->SetContentFlags(flags);
@ -934,7 +929,6 @@ ContainerState::ThebesLayerData::Accumulate(nsDisplayListBuilder* aBuilder,
mOpaqueRegion = tmp;
}
} else if (aItem->HasText()) {
mHasText = PR_TRUE;
if (!mOpaqueRegion.Contains(aVisibleRect)) {
mHasTextOverTransparent = PR_TRUE;
}