summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index bf62052ee5..00f9ecea60 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -103,17 +103,6 @@ static void resolveGetCharWidthI()
ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QStringLiteral("gdi32"), "GetCharWidthI");
}
-static inline quint32 getUInt(unsigned char *p)
-{
- quint32 val;
- val = *p++ << 24;
- val |= *p++ << 16;
- val |= *p++ << 8;
- val |= *p;
-
- return val;
-}
-
static inline quint16 getUShort(unsigned char *p)
{
quint16 val;
@@ -265,7 +254,6 @@ QWindowsFontEngine::QWindowsFontEngine(const QString &name,
m_logfont(lf),
ttf(0),
hasOutline(0),
- lw(0),
cmap(0),
cmapSize(0),
lbearing(SHRT_MIN),
@@ -1161,7 +1149,9 @@ glyph_metrics_t QWindowsFontEngine::alphaMapBoundingBox(glyph_t glyph, QFixed, c
QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
{
HFONT font = hfont;
- if (m_fontEngineData->clearTypeEnabled) {
+
+ bool clearTypeTemporarilyDisabled = (m_fontEngineData->clearTypeEnabled && m_logfont.lfQuality != NONANTIALIASED_QUALITY);
+ if (clearTypeTemporarilyDisabled) {
LOGFONT lf = m_logfont;
lf.lfQuality = ANTIALIASED_QUALITY;
font = CreateFontIndirect(&lf);
@@ -1184,11 +1174,11 @@ QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xfo
for (int y=0; y<mask->height(); ++y) {
uchar *dest = alphaMap.scanLine(y);
if (mask->image().format() == QImage::Format_RGB16) {
- const qint16 *src = (qint16 *) ((const QImage &) mask->image()).scanLine(y);
+ const qint16 *src = reinterpret_cast<const qint16 *>(mask->image().constScanLine(y));
for (int x=0; x<mask->width(); ++x)
dest[x] = 255 - qGray(src[x]);
} else {
- const uint *src = (uint *) ((const QImage &) mask->image()).scanLine(y);
+ const uint *src = reinterpret_cast<const uint *>(mask->image().constScanLine(y));
for (int x=0; x<mask->width(); ++x) {
if (QWindowsNativeImage::systemFormat() == QImage::Format_RGB16)
dest[x] = 255 - qGray(src[x]);
@@ -1200,7 +1190,7 @@ QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xfo
// Cleanup...
delete mask;
- if (m_fontEngineData->clearTypeEnabled) {
+ if (clearTypeTemporarilyDisabled) {
DeleteObject(font);
}
@@ -1233,7 +1223,7 @@ QImage QWindowsFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed, const QTra
QImage rgbMask(mask->width(), mask->height(), QImage::Format_RGB32);
for (int y=0; y<mask->height(); ++y) {
uint *dest = (uint *) rgbMask.scanLine(y);
- const uint *src = (uint *) source.scanLine(y);
+ const uint *src = reinterpret_cast<const uint *>(source.constScanLine(y));
for (int x=0; x<mask->width(); ++x) {
dest[x] = 0xffffffff - (0x00ffffff & src[x]);
}