direct2d: Fix font size when display scaling is in use

Since we already tell direct2d that we are using pixel sizes in the
QWindowsDirect2DDeviceContextPrivate constructor and thereby enable
scaling inside direct2d, there is no need to scale the font size again.

Change-Id: Id9c9ed4d2848bcd09f997e41fb87802a3fe2432b
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
This commit is contained in:
Louai Al-Khanji 2014-09-22 13:53:08 +03:00
parent 1ce6e432b6
commit 4073a3dd77
1 changed files with 8 additions and 15 deletions

View File

@ -109,13 +109,6 @@ static inline ID2D1Factory1 *factory()
return QWindowsDirect2DContext::instance()->d2dFactory();
}
inline static FLOAT pixelSizeToDIP(int pixelSize)
{
FLOAT dpiX, dpiY;
QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&dpiX, &dpiY);
return FLOAT(pixelSize) * 96.0f / dpiY;
}
class Direct2DPathGeometryWriter
{
public:
@ -866,14 +859,14 @@ public:
Q_Q(QWindowsDirect2DPaintEngine);
DWRITE_GLYPH_RUN glyphRun = {
fontFace, // IDWriteFontFace *fontFace;
pixelSizeToDIP(fontDef.pixelSize), // FLOAT fontEmSize;
numGlyphs, // UINT32 glyphCount;
glyphIndices, // const UINT16 *glyphIndices;
glyphAdvances, // const FLOAT *glyphAdvances;
glyphOffsets, // const DWRITE_GLYPH_OFFSET *glyphOffsets;
FALSE, // BOOL isSideways;
rtl ? 1 : 0 // UINT32 bidiLevel;
fontFace, // IDWriteFontFace *fontFace;
fontDef.pixelSize, // FLOAT fontEmSize;
numGlyphs, // UINT32 glyphCount;
glyphIndices, // const UINT16 *glyphIndices;
glyphAdvances, // const FLOAT *glyphAdvances;
glyphOffsets, // const DWRITE_GLYPH_OFFSET *glyphOffsets;
FALSE, // BOOL isSideways;
rtl ? 1 : 0 // UINT32 bidiLevel;
};
const bool antiAlias = bool((q->state()->renderHints & QPainter::TextAntialiasing)