xcb: port away from last QRegion::rects()

Use begin()/end() instead.

In QXcbShmImage::flushPixmap(), instead of gettings different rects(),
depending on a bool parameter, just call yourself again with the
modified QRegion, which we can then just iterate over.

Change-Id: I6d4f7c6e4e5d2a24520716847ca9331bf39337c8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Marc Mutz 2017-12-06 10:56:30 +01:00
parent 9e18722086
commit a016bed95f

View File

@ -445,12 +445,11 @@ void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, c
void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
{
QVector<QRect> rects;
if (!fullRegion) {
rects = m_pendingFlush.intersected(region).rects();
auto actualRegion = m_pendingFlush.intersected(region);
m_pendingFlush -= region;
} else {
rects = region.rects();
flushPixmap(actualRegion, true);
return;
}
xcb_image_t xcb_subimage;
@ -467,7 +466,7 @@ void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
const bool needsByteSwap = xcb_subimage.byte_order != m_xcb_image->byte_order;
for (const QRect &rect : qAsConst(rects)) {
for (const QRect &rect : region) {
// We must make sure that each request is not larger than max_req_size.
// Each request takes req_size + m_xcb_image->stride * height bytes.
static const uint32_t req_size = sizeof(xcb_put_image_request_t);