diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp index 1d28befe41..2c60409dff 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp @@ -300,6 +300,14 @@ public: : D2D1_ANTIALIAS_MODE_ALIASED; } + inline D2D1_LAYER_OPTIONS1 layerOptions() const + { + if (flags & QWindowsDirect2DPaintEngine::TranslucentTopLevelWindow) + return D2D1_LAYER_OPTIONS1_NONE; + else + return D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND; + } + void updateTransform(const QTransform &transform) { dc()->SetTransform(to_d2d_matrix_3x2_f(transform)); @@ -345,7 +353,7 @@ public: D2D1::IdentityMatrix(), 1.0, NULL, - D2D1_LAYER_OPTIONS1_NONE), + layerOptions()), NULL); pushedClips.push(LayerClip); } @@ -870,7 +878,7 @@ public: const bool antiAlias = bool((q->state()->renderHints & QPainter::TextAntialiasing) && !(fontDef.styleStrategy & QFont::NoAntialias)); - const D2D1_TEXT_ANTIALIAS_MODE antialiasMode = (flags & QWindowsDirect2DPaintEngine::UseGrayscaleAntialiasing) + const D2D1_TEXT_ANTIALIAS_MODE antialiasMode = (flags & QWindowsDirect2DPaintEngine::TranslucentTopLevelWindow) ? D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE : D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE; dc()->SetTextAntialiasMode(antiAlias ? antialiasMode : D2D1_TEXT_ANTIALIAS_MODE_ALIASED); @@ -956,7 +964,7 @@ bool QWindowsDirect2DPaintEngine::begin(QPaintDevice * pdev) D2D1::IdentityMatrix(), 1.0, NULL, - D2D1_LAYER_OPTIONS1_NONE), + d->layerOptions()), NULL); } else { QRect clip(0, 0, pdev->width(), pdev->height()); diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h index 4ed817b75f..af0aaf93f7 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h @@ -61,7 +61,7 @@ class QWindowsDirect2DPaintEngine : public QPaintEngineEx public: enum Flag { NoFlag = 0, - UseGrayscaleAntialiasing = 1, + TranslucentTopLevelWindow = 1 }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp index f739493c1a..36e306929d 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp @@ -310,7 +310,7 @@ void QWindowsDirect2DWindow::setupBitmap() QWindowsDirect2DPaintEngine::Flags flags = QWindowsDirect2DPaintEngine::NoFlag; if (!m_directRendering) - flags |= QWindowsDirect2DPaintEngine::UseGrayscaleAntialiasing; + flags |= QWindowsDirect2DPaintEngine::TranslucentTopLevelWindow; QWindowsDirect2DPlatformPixmap *pp = new QWindowsDirect2DPlatformPixmap(QPlatformPixmap::PixmapType, flags, m_bitmap.data());