summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-12-06 10:11:53 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-12-06 18:30:57 +0000
commit9e187220868dedfa911da758881b85ffd0c64418 (patch)
tree372465eadec34de3d8c238923bc04576ec0cd4db /src/plugins/platforms/xcb/qxcbbackingstore.cpp
parent03026973700f1fcdff602dffa3d94b04912acd44 (diff)
xcb: share code for QRegion -> xcb_rectangle_t[] conversion
... between QXcbWindow and QxcbShmImage. Replaces one QRegion::rects() call (to be deprecated), fixes potential overflows that QXcbShmImage did not handle, but QXcbWindow did, and saves ~1KiB of text size. Change-Id: I55d37021164feefe0cb3e60bd6d22b1976a6467b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 1e046aa677..979c8142f7 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -520,16 +520,7 @@ void QXcbShmImage::setClip(const QRegion &region)
static const uint32_t values[] = { XCB_NONE };
xcb_change_gc(xcb_connection(), m_gc, mask, values);
} else {
- const QVector<QRect> qrects = region.rects();
- QVector<xcb_rectangle_t> xcb_rects(qrects.size());
-
- for (int i = 0; i < qrects.size(); i++) {
- xcb_rects[i].x = qrects[i].x();
- xcb_rects[i].y = qrects[i].y();
- xcb_rects[i].width = qrects[i].width();
- xcb_rects[i].height = qrects[i].height();
- }
-
+ const auto xcb_rects = qRegionToXcbRectangleList(region);
xcb_set_clip_rectangles(xcb_connection(),
XCB_CLIP_ORDERING_YX_BANDED,
m_gc,