diff options
author | Louai Al-Khanji <louai.al-khanji@digia.com> | 2014-09-19 13:42:17 +0300 |
---|---|---|
committer | Louai Al-Khanji <louai.al-khanji@digia.com> | 2014-09-26 07:32:29 +0200 |
commit | 3bcbff57e127af37ecf00ed1ab4682b1a9a21bd1 (patch) | |
tree | e9bf080f6a77705115a5e0f0afff64c2b3a32d95 /src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp | |
parent | 095f76046306f205227274eb16d5aad059460496 (diff) |
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 <andrew.knight@digia.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp')
-rw-r--r-- | src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
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 |