Make sure to clip in QXcbBackingStore::flush()

Clip to image and window dimensions to prevent X errors.

Change-Id: I7fa581217444e00d6eb83ac356c600f86ae03636
Reviewed-on: http://codereview.qt-project.org/5140
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Holger Ihrig <holger.ihrig@nokia.com>
bb10
Samuel Rødal 2011-09-19 13:42:20 +02:00 committed by Qt by Nokia
parent 9a096d9eb0
commit 003060e292
1 changed files with 12 additions and 3 deletions

View File

@ -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));