Bug 579276. Part 6: Add gfxASurface::GetTextQualityInTransparentSurfaces API. r=jrmuizel,sr=vlad

This commit is contained in:
Robert O'Callahan 2010-09-02 21:18:41 +12:00
Родитель 396aec34d8
Коммит 359694e234
5 изменённых файлов: 54 добавлений и 1 удалений

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

@ -156,6 +156,39 @@ public:
return PR_TRUE;
}
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

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

@ -57,6 +57,12 @@ 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);

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

@ -60,6 +60,10 @@ public:
{
return PR_FALSE;
}
virtual TextQuality GetTextQualityInTransparentSurfaces()
{
return TEXT_QUALITY_OK_OVER_OPAQUE_PIXELS;
}
const gfxSize& GetSize() const { return mSize; }

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

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