summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index fadcb4d5b8..df6cf318bb 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -251,16 +251,25 @@ void QXcbBackingStore::endPaint(const QRegion &)
void QXcbBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
{
- QRect bounds = region.boundingRect();
-
if (!m_image || m_image->size().isEmpty())
return;
+ QSize imageSize = m_image->size();
+
+ QRegion clipped = region;
+ clipped &= QRect(0, 0, window->width(), window->height());
+ clipped &= QRect(0, 0, imageSize.width(), imageSize.height()).translated(-offset);
+
+ QRect bounds = clipped.boundingRect();
+
+ if (bounds.isNull())
+ return;
+
Q_XCB_NOOP(connection());
QXcbWindow *platformWindow = static_cast<QXcbWindow *>(window->handle());
- QVector<QRect> rects = region.rects();
+ QVector<QRect> rects = clipped.rects();
for (int i = 0; i < rects.size(); ++i)
m_image->put(platformWindow->xcb_window(), rects.at(i).topLeft(), rects.at(i).translated(offset));