diff options
author | Louai Al-Khanji <louai.al-khanji@theqtcompany.com> | 2016-04-28 10:24:38 -0700 |
---|---|---|
committer | Louai Al-Khanji <louai.al-khanji@qt.io> | 2016-04-29 16:09:14 +0000 |
commit | a1fd5d02bd9d5efb4334dc6f9d393eaaaa377bab (patch) | |
tree | 0029c51880855b0e5e028eec53dd194f8b52d022 /src/plugins/platforms/xcb/qxcbbackingstore.h | |
parent | cd1eff1e1ef3097e5dd1a01f88eb1052ee63022d (diff) |
xcb: support nested paint operations in remote scenarios
Recent changes to the xcb platform plugin added logic to paint to a
server-side X Pixmap when the MIT-SHM extension is unavailable. Those
changes also added logic to keep track of the dirty areas that need to
be flushed to the server from the backing store when the backing store
is flushed to a window.
Because a single QRegion was used to track those areas, nested paint
operations no longer accurately tracked all the dirty areas. Consider:
void Widget::paintEvent(QPaintEvent *) {
QPainter p1(this);
for (int i = 0; longRunningOperationInProgress(); i++) {
QPixmap pixmap(size());
QPainter p2(&pixmap);
p2.drawText(pixmap.rect(), i & 1 ? "Working." : "Working..");
p2.end();
QBackingStore *bs = backingStore();
bs->beginPaint(rect());
p1.drawPixmap(0, 0, pixmap);
bs->endPaint();
bs->flush(rect(), windowHandle());
}
p1.fillRect(rect(), Qt::red);
p1.drawText(rect(), "Done!");
}
While this code could be restructured, it is a common pattern in legacy
Qt applications which cannot be easily changed.
Change-Id: I3b919266abe41c96a584cb02f41cafac3f9d1d7c
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.h')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbbackingstore.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 1f5652d918..5a8f385c1b 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -41,6 +41,7 @@ #define QXCBBACKINGSTORE_H #include <qpa/qplatformbackingstore.h> +#include <QtCore/QStack> #include <xcb/xcb.h> @@ -75,7 +76,7 @@ public: private: QXcbShmImage *m_image; - QRegion m_paintRegion; + QStack<QRegion> m_paintRegions; QImage m_rgbImage; }; |