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
parent
9a096d9eb0
commit
003060e292
|
|
@ -251,16 +251,25 @@ void QXcbBackingStore::endPaint(const QRegion &)
|
|||
|
||||
void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, 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));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue