DirectWrite: Implement transforms for grayscale aa

When cleartype rendering was turned off, transforms would be
badly broken with the DirectWrite engine because we did not
implement the appropriate code path there. In Qt 5.6, this
would become especially visible, since DirectWrite is always
used when high-dpi scaling is enabled.

[ChangeLog][Windows][DirectWrite] Added transformation
support to DirectWrite engine when using grayscale antialiasing.

Task-number: QTBUG-49562
Change-Id: Ic5f7dd5b020a85ed1b6473c511a67cdb5ed5cedb
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
bb10
Eskil Abrahamsen Blomfeldt 2015-12-15 12:46:51 +01:00 committed by Konstantin Ritt
parent a6ef446d4c
commit 8a401371ea
2 changed files with 8 additions and 2 deletions

View File

@ -485,9 +485,9 @@ qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
return 0;
}
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
{
QImage im = alphaRGBMapForGlyph(glyph, subPixelPosition, QTransform());
QImage im = alphaRGBMapForGlyph(glyph, subPixelPosition, t);
QImage alphaMap(im.width(), im.height(), QImage::Format_Alpha8);
@ -504,6 +504,11 @@ QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed sub
return alphaMap;
}
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition)
{
return alphaMapForGlyph(glyph, subPixelPosition, QTransform());
}
bool QWindowsFontEngineDirectWrite::supportsSubPixelPositions() const
{
return true;

View File

@ -86,6 +86,7 @@ public:
bool supportsSubPixelPositions() const;
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition);
QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t);
QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform);
QFontEngine *cloneWithSize(qreal pixelSize) const;