Bug 602757. Part 1: Create gfxContextAutoDisableSubpixelAntialiasing helper. r=vlad,a=blocking

This commit is contained in:
Robert O'Callahan 2011-01-03 14:48:09 +13:00
Родитель 38e3e7272a
Коммит 64c483c0b7
1 изменённых файлов: 23 добавлений и 0 удалений

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

@ -791,4 +791,27 @@ private:
gfxMatrix mMatrix;
};
class THEBES_API gfxContextAutoDisableSubpixelAntialiasing {
public:
gfxContextAutoDisableSubpixelAntialiasing(gfxContext *aContext, PRBool aDisable)
{
if (aDisable) {
mSurface = aContext->CurrentSurface();
mSubpixelAntialiasingEnabled = mSurface->GetSubpixelAntialiasingEnabled();
mSurface->SetSubpixelAntialiasingEnabled(PR_FALSE);
}
}
~gfxContextAutoDisableSubpixelAntialiasing()
{
if (mSurface) {
mSurface->SetSubpixelAntialiasingEnabled(mSubpixelAntialiasingEnabled);
}
}
private:
nsRefPtr<gfxASurface> mSurface;
PRPackedBool mSubpixelAntialiasingEnabled;
};
#endif /* GFX_CONTEXT_H */