From 3bcbff57e127af37ecf00ed1ab4682b1a9a21bd1 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Fri, 19 Sep 2014 13:42:17 +0300 Subject: direct2d: Fix composition mode support When the composition mode changes to a mode which is not supported by Direct2D's primitive blending, the rendering follows the emulated (slow) code path using rasterFill(). This allows the direct2d paint engine to handle all composition modes supported by QImage. Task-number: QTBUG-40602 Change-Id: I0ac0b5c89aab2483cb2ef7768d6dec8e16913249 Done-with: Andrew Knight Reviewed-by: Andrew Knight --- .../direct2d/qwindowsdirect2ddevicecontext.cpp | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp') diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp index 6e4f64e6f5..23e6118132 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp @@ -125,4 +125,38 @@ bool QWindowsDirect2DDeviceContext::end() return d->end(); } +void QWindowsDirect2DDeviceContext::suspend() +{ + Q_D(QWindowsDirect2DDeviceContext); + if (d->refCount > 0) + d->deviceContext->EndDraw(); +} + +void QWindowsDirect2DDeviceContext::resume() +{ + Q_D(QWindowsDirect2DDeviceContext); + if (d->refCount > 0) + d->deviceContext->BeginDraw(); +} + +QWindowsDirect2DDeviceContextSuspender::QWindowsDirect2DDeviceContextSuspender(QWindowsDirect2DDeviceContext *dc) + : m_dc(dc) +{ + Q_ASSERT(m_dc); + m_dc->suspend(); +} + +QWindowsDirect2DDeviceContextSuspender::~QWindowsDirect2DDeviceContextSuspender() +{ + resume(); +} + +void QWindowsDirect2DDeviceContextSuspender::resume() +{ + if (m_dc) { + m_dc->resume(); + m_dc = Q_NULLPTR; + } +} + QT_END_NAMESPACE -- cgit v1.2.3