xcb: cleanup the code for detecting when to create/destroy SHM segment
- removed the check for "m_segmentSize > 0" as according to the code it
will never be <= 0.
- wrap the entire logic in connection()->hasShm() { .. } as that is when
the logic becomes relevant. This makes the code more readable.
Change-Id: I572420df8e29cc46593f8a13c250f8c05c6a9108
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
bb10
parent
0dd3e02aac
commit
cba414a26b
|
|
@ -219,12 +219,14 @@ void QXcbBackingStoreImage::create(const QSize &size, const xcb_format_t *fmt, Q
|
|||
if (!segmentSize)
|
||||
return;
|
||||
|
||||
if (hasShm() && m_segmentSize > 0 && (m_segmentSize < segmentSize || m_segmentSize / 2 >= segmentSize))
|
||||
destroyShmSegment(m_segmentSize);
|
||||
if (!hasShm() && connection()->hasShm())
|
||||
{
|
||||
qCDebug(lcQpaXcb) << "creating shared memory" << segmentSize << "for" << size << "depth" << fmt->depth << "bits" << fmt->bits_per_pixel;
|
||||
createShmSegment(segmentSize);
|
||||
if (connection()->hasShm()) {
|
||||
if (m_shm_info.shmaddr && (m_segmentSize < segmentSize || m_segmentSize / 2 >= segmentSize))
|
||||
destroyShmSegment(m_segmentSize);
|
||||
if (!m_shm_info.shmaddr) {
|
||||
qCDebug(lcQpaXcb) << "creating shared memory" << segmentSize << "for"
|
||||
<< size << "depth" << fmt->depth << "bits" << fmt->bits_per_pixel;
|
||||
createShmSegment(segmentSize);
|
||||
}
|
||||
}
|
||||
|
||||
m_xcb_image->data = m_shm_info.shmaddr ? m_shm_info.shmaddr : (uint8_t *)malloc(segmentSize);
|
||||
|
|
|
|||
Loading…
Reference in New Issue