summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
diff options
context:
space:
mode:
authorLouai Al-Khanji <louai.al-khanji@digia.com>2014-04-30 10:27:57 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-05 14:13:50 +0200
commitac448335f177eff59465300a7141db559c9eadad (patch)
treea70d815ba5cb629e1b2f41a29673b58f98036107 /src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
parent89b70f3910dfec7108d6e95cc96f904fce01da29 (diff)
Direct2D QPA: Draw directly to swap chain
Remove the intermediate pixmap in the backing store and draw directly to the window swap chain. This is faster and reduces memory pressure on the graphics card. In case of native child widgets we need to read back the back buffer, which incurs an extra copy in this case. In an artificial benchmark drawing animated full screen gradients as fast as possible this patch increases performance by 42% on my current machine from 480fps to around 680fps, i.e. the time for actually getting the pixels to the screen is now lower. Change-Id: Ifbeda0e199afec03cecfe76337679a9e9d082bdd Reviewed-by: Risto Avila <risto.avila@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Diffstat (limited to 'src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h')
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
index 7996904639..47c790da5d 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
@@ -56,16 +56,21 @@ public:
QWindowsDirect2DWindow(QWindow *window, const QWindowsWindowData &data);
~QWindowsDirect2DWindow();
+ QPixmap *pixmap();
void flush(QWindowsDirect2DBitmap *bitmap, const QRegion &region, const QPoint &offset);
+ void present();
+ void resizeSwapChain(const QSize &size);
+
+ QSharedPointer<QWindowsDirect2DBitmap> copyBackBuffer() const;
private:
- void resizeSwapChain(const QSize &size);
void setupBitmap();
private:
Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
Microsoft::WRL::ComPtr<ID2D1DeviceContext> m_deviceContext;
QScopedPointer<QWindowsDirect2DBitmap> m_bitmap;
+ QScopedPointer<QPixmap> m_pixmap;
bool m_needsFullFlush;
};