Direct2D QPA: Speed up widget painting
By only starting/ending drawing once in the backing store, we can avoid multiple start/ends and thus flushes of the direct2d device context. This can potentially be much faster with some drivers when many widgets that draw to the same backing store need to redraw. Because starts/ends of QWindowsDirect2DDeviceContext are already refcounted this works out of the box. Change-Id: Ib48edceef6a1041ae0509587c77ac0caa8b29fc6 Reviewed-by: Risto Avila <risto.avila@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
774082e2ee
commit
81fde3a976
@ -75,6 +75,16 @@ QWindowsDirect2DBackingStore::~QWindowsDirect2DBackingStore()
|
||||
{
|
||||
}
|
||||
|
||||
void QWindowsDirect2DBackingStore::beginPaint(const QRegion &)
|
||||
{
|
||||
platformPixmap(m_pixmap.data())->bitmap()->deviceContext()->begin();
|
||||
}
|
||||
|
||||
void QWindowsDirect2DBackingStore::endPaint()
|
||||
{
|
||||
platformPixmap(m_pixmap.data())->bitmap()->deviceContext()->end();
|
||||
}
|
||||
|
||||
QPaintDevice *QWindowsDirect2DBackingStore::paintDevice()
|
||||
{
|
||||
return m_pixmap.data();
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
QWindowsDirect2DBackingStore(QWindow *window);
|
||||
~QWindowsDirect2DBackingStore();
|
||||
|
||||
void beginPaint(const QRegion &);
|
||||
void endPaint();
|
||||
|
||||
QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
|
||||
void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE;
|
||||
void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user