Commit 5e0e708a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

Port away from deprecated QImage::byteCount

Summary:
QImage::byteCount() was deprecated in Qt 5.10. It is advised to use
QImage::sizeInBytes() method instead.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22355
parent 4e5d3d00
......@@ -229,7 +229,7 @@ void ScreenShotEffect::postPaintScreen()
// copy content from framebuffer into image
img = QImage(QSize(width, height), QImage::Format_ARGB32);
glReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
glReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.sizeInBytes(), (GLvoid*)img.bits());
GLRenderTarget::popRenderTarget();
ScreenShotEffect::convertFromGLImage(img, width, height);
}
......
......@@ -144,7 +144,7 @@ void XRenderPicture::fromImage(const QImage &img)
xcb_gcontext_t cid = xcb_generate_id(c);
xcb_create_gc(c, cid, xpix, 0, nullptr);
xcb_put_image(c, XCB_IMAGE_FORMAT_Z_PIXMAP, xpix, cid, img.width(), img.height(),
0, 0, 0, depth, img.byteCount(), img.constBits());
0, 0, 0, depth, img.sizeInBytes(), img.constBits());
xcb_free_gc(c, cid);
d = new XRenderPictureData(createPicture(xpix, depth));
......
......@@ -224,7 +224,7 @@ void EglGbmBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegi
glFlush();
if (m_backend->saveFrames()) {
QImage img = QImage(QSize(m_backBuffer->width(), m_backBuffer->height()), QImage::Format_ARGB32);
glReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
glReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.sizeInBytes(), (GLvoid*)img.bits());
convertFromGLImage(img, m_backBuffer->width(), m_backBuffer->height());
img.save(QStringLiteral("%1/%2.png").arg(m_backend->saveFrames()).arg(QString::number(m_frameCounter++)));
}
......
......@@ -94,7 +94,7 @@ void X11Renderer::render()
QImage image = renderToImage(geo);
xcb_put_image(c, XCB_IMAGE_FORMAT_Z_PIXMAP, client()->client()->frameId(), m_gc,
image.width(), image.height(), geo.x(), geo.y(), 0, client()->client()->depth(),
image.byteCount(), image.constBits());
image.sizeInBytes(), image.constBits());
};
renderPart(left);
renderPart(top);
......
......@@ -87,7 +87,7 @@ void X11WindowedQPainterBackend::present(int mask, const QRegion &damage)
const QImage &buffer = (*it)->buffer;
xcb_put_image(c, XCB_IMAGE_FORMAT_Z_PIXMAP, (*it)->window, m_gc,
buffer.width(), buffer.height(), 0, 0, 0, 24,
buffer.byteCount(), buffer.constBits());
buffer.sizeInBytes(), buffer.constBits());
}
}
......
......@@ -480,7 +480,7 @@ void X11WindowedBackend::createCursor(const QImage &srcImage, const QPoint &hots
xcb_create_pixmap(m_connection, 32, pix, m_screen->root, img.width(), img.height());
xcb_create_gc(m_connection, gc, pix, 0, nullptr);
xcb_put_image(m_connection, XCB_IMAGE_FORMAT_Z_PIXMAP, pix, gc, img.width(), img.height(), 0, 0, 0, 32, img.byteCount(), img.constBits());
xcb_put_image(m_connection, XCB_IMAGE_FORMAT_Z_PIXMAP, pix, gc, img.width(), img.height(), 0, 0, 0, 32, img.sizeInBytes(), img.constBits());
XRenderPicture pic(pix, 32);
xcb_render_create_cursor(m_connection, cid, pic, qRound(hotspot.x() * outputScale), qRound(hotspot.y() * outputScale));
......
......@@ -1238,7 +1238,7 @@ void SceneXRenderDecorationRenderer::render()
Q_ASSERT(image.devicePixelRatio() == 1);
xcb_put_image(c, XCB_IMAGE_FORMAT_Z_PIXMAP, m_pixmaps[index], m_gc,
image.width(), image.height(), geo.x() - offset.x(), geo.y() - offset.y(), 0, 32,
image.byteCount(), image.constBits());
image.sizeInBytes(), image.constBits());
};
const QRect geometry = scheduled.boundingRect();
renderPart(left.intersected(geometry), left.topLeft(), int(DecorationPart::Left));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment