diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-05-31 10:22:55 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-05-31 10:48:36 +0200 |
commit | 66febd27cb3bacf5a4996f184725f318bce0f4fc (patch) | |
tree | b05f4303ccbbfd57bad0c9ec34dca97ed23023ac /src | |
parent | 589a562c0123544dece4bd5479083f1e23b3d932 (diff) |
Windows: Bring back the HDC to the raster engine, Q_OS_WIN.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/kernel.pri | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindowdefs.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwindowdefs_win.h (renamed from src/widgets/platforms/win/qwindowdefs_win.h) | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 57 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster_p.h | 7 |
5 files changed, 45 insertions, 29 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 8662329a2d..827ed21cf4 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -91,3 +91,5 @@ qpa { LIBS_PRIVATE +=$$QT_LIBS_GLIB } } + +win32:HEADERS+=kernel/qwindowdefs_win.h diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index 1dc1aeb6c1..3414c8cfc5 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -105,9 +105,9 @@ typedef long WId; #endif // Q_WS_MAC -#if defined(Q_WS_WIN) -#include <QtGui/qwindowdefs_win.h> -#endif // Q_WS_WIN +#if defined(Q_OS_WIN) +# include <QtGui/qwindowdefs_win.h> +#endif // Q_OS_WIN #if defined(Q_WS_X11) diff --git a/src/widgets/platforms/win/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h index 396853e609..fbcc73ad2a 100644 --- a/src/widgets/platforms/win/qwindowdefs_win.h +++ b/src/gui/kernel/qwindowdefs_win.h @@ -115,8 +115,6 @@ typedef long HRESULT; #endif typedef struct tagMSG MSG; -typedef HWND WId; - QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 61d7216230..7232f9c910 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -75,7 +75,7 @@ // #include "qbezier_p.h" #include "qoutlinemapper_p.h" -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) # include <qt_windows.h> # include <qvarlengtharray.h> # include <private/qfontengine_p.h> @@ -92,7 +92,7 @@ # include <private/qfontengine_ft_p.h> #endif -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) # include <malloc.h> #endif #include <limits.h> @@ -118,9 +118,22 @@ void dumpClip(int width, int height, const QClipData *clip); // 4 pixels. #define int_dim(pos, dim) (int(pos+dim) - int(pos)) -#ifdef Q_WS_WIN -extern bool qt_cleartype_enabled; -#endif +#ifdef Q_OS_WIN + +static inline bool winClearTypeFontsEnabled() +{ + UINT result = 0; + SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0); + return result == FE_FONTSMOOTHINGCLEARTYPE; +} + +bool QRasterPaintEngine::clearTypeFontsEnabled() +{ + static const bool result = winClearTypeFontsEnabled(); + return result; +} + +#endif // Q_OS_WIN #ifdef Q_WS_MAC extern bool qt_applefontsmoothing_enabled; @@ -316,7 +329,7 @@ void QRasterPaintEngine::init() Q_D(QRasterPaintEngine); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN d->hdc = 0; #endif @@ -462,14 +475,14 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) } #endif -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) d->isPlain45DegreeRotation = true; #endif if (d->mono_surface) d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; -#if defined(Q_WS_WIN) - else if (qt_cleartype_enabled) +#if defined(Q_OS_WIN) + else if (clearTypeFontsEnabled()) #elif defined (Q_WS_MAC) else if (qt_applefontsmoothing_enabled) #else @@ -570,7 +583,7 @@ void QRasterPaintEngine::updateMatrix(const QTransform &matrix) ensureOutlineMapper(); -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN Q_D(QRasterPaintEngine); d->isPlain45DegreeRotation = false; if (txop >= QTransform::TxRotate) { @@ -3038,7 +3051,7 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_WS_WIN) || defined(Q_WS_MAC) +#if defined (Q_OS_WIN) || defined(Q_WS_MAC) bool drawCached = true; @@ -3054,8 +3067,9 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte // ### cases we should delegate painting to the font engine // ### directly... -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - QFontEngine::Type fontEngineType = ti.fontEngine->type(); +/* + #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + conQFontEngine::Type fontEngineType = ti.fontEngine->type(); // qDebug() << "type" << fontEngineType << s->matrix.type(); if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) ti.fontEngine)->ttf && s->matrix.type() > QTransform::TxTranslate) || (s->matrix.type() <= QTransform::TxTranslate @@ -3064,9 +3078,10 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte drawCached = false; } #else +*/ if (s->matrix.type() > QTransform::TxTranslate) drawCached = false; -#endif +// #endif if (drawCached) { QRasterPaintEngineState *s = state(); @@ -3082,14 +3097,14 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte return; } -#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC +#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_OS_WIN || Q_WS_MAC if (s->matrix.type() <= QTransform::TxTranslate || (s->matrix.type() == QTransform::TxScale && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { drawGlyphsS60(p, ti); return; } -#else // Q_WS_WIN || Q_WS_MAC +#else // Q_OS_WIN || Q_WS_MAC QFontEngine *fontEngine = ti.fontEngine; @@ -3314,7 +3329,7 @@ CGContextRef QRasterPaintEngine::getCGContext() const } #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN /*! \internal */ @@ -3630,7 +3645,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, const int rasterPoolInitialSize = MINIMUM_POOL_SIZE; int rasterPoolSize = rasterPoolInitialSize; unsigned char *rasterPoolBase; -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) rasterPoolBase = // We make use of setjmp and longjmp in qgrayraster.c which requires // 16-byte alignment, hence we hardcode this requirement here.. @@ -3683,7 +3698,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rendered_spans += q_gray_rendered_spans(*grayRaster.data()); -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) _aligned_free(rasterPoolBase); #else if (rasterPoolBase != rasterPoolOnStack) // initially on the stack @@ -3692,7 +3707,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, rasterPoolSize = new_size; rasterPoolBase = -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) // We make use of setjmp and longjmp in qgrayraster.c which requires // 16-byte alignment, hence we hardcode this requirement here.. (unsigned char *) _aligned_malloc(rasterPoolSize, sizeof(void*) * 2); @@ -3709,7 +3724,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, } } -#if defined(Q_WS_WIN64) +#if defined(Q_OS_WIN64) _aligned_free(rasterPoolBase); #else if (rasterPoolBase != rasterPoolOnStack) // initially on the stack diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 5c3f2dfd06..6d0388bfa3 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -224,10 +224,11 @@ public: CGContextRef getCGContext() const; #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN void setDC(HDC hdc); HDC getDC() const; void releaseDC(HDC hdc) const; + static bool clearTypeFontsEnabled(); #endif void alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h); @@ -324,7 +325,7 @@ public: QScopedPointer<QOutlineMapper> outlineMapper; QScopedPointer<QRasterBuffer> rasterBuffer; -#if defined (Q_WS_WIN) +#if defined (Q_OS_WIN) HDC hdc; #elif defined(Q_WS_MAC) CGContextRef cgContext; @@ -352,7 +353,7 @@ public: uint mono_surface : 1; uint outlinemapper_xform_dirty : 1; -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN uint isPlain45DegreeRotation : 1; #endif |