summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2017-06-15 16:10:20 +0200
committerJohan Helsing <johan.helsing@qt.io>2017-06-16 09:34:10 +0000
commitb6bf50fd81c77498aecc024ac52a82c8322dfd3b (patch)
tree9a348821060a45942edd3158ec1c07896172e8d9
parent8e3518c0afbca915d4ec1daded13e6c4f95f3231 (diff)
Set size and format in SharedMemoryBuffer::toOpenGlTexture
The texture returned previously would have size (1,1) and format NoFormat Change-Id: Ic627b7ff9d10cc87cd9307f5f18ea96458fae212 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
-rw-r--r--src/compositor/wayland_wrapper/qwlclientbuffer.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
index 01a4f3d73..7d7e787c4 100644
--- a/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
+++ b/src/compositor/wayland_wrapper/qwlclientbuffer.cpp
@@ -170,11 +170,14 @@ QOpenGLTexture *SharedMemoryBuffer::toOpenGlTexture(int plane)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// TODO: partial texture upload
QImage image = this->image();
+ m_shmTexture->setSize(image.width(), image.height());
if (image.hasAlphaChannel()) {
+ m_shmTexture->setFormat(QOpenGLTexture::RGBAFormat);
if (image.format() != QImage::Format_RGBA8888)
image = image.convertToFormat(QImage::Format_RGBA8888);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
} else {
+ m_shmTexture->setFormat(QOpenGLTexture::RGBFormat);
if (image.format() != QImage::Format_RGBX8888)
image = image.convertToFormat(QImage::Format_RGBX8888);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.constBits());