From e9e73f113413753331350ad4a1d09ecb715ab4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 4 Aug 2013 14:50:25 +0200 Subject: [PATCH] add XRenderPicture(QImage) constructor was implicitly present for QPixmap::toImage REVIEW: 111878 --- libkwineffects/kwinxrenderutils.cpp | 10 +++++++--- libkwineffects/kwinxrenderutils.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libkwineffects/kwinxrenderutils.cpp b/libkwineffects/kwinxrenderutils.cpp index 85f0d0fd22..cfd3bc5859 100644 --- a/libkwineffects/kwinxrenderutils.cpp +++ b/libkwineffects/kwinxrenderutils.cpp @@ -109,11 +109,15 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth) XRenderPicture::XRenderPicture(const QPixmap &pix) { - if (!Extensions::nonNativePixmaps()) { + if (Extensions::nonNativePixmaps()) { + XRenderPicture(pix.toImage()); + } else { d = new XRenderPictureData(createPicture(pix.handle(), pix.depth())); - return; } - QImage img(pix.toImage()); +} + +XRenderPicture::XRenderPicture(const QImage &img) +{ const int depth = img.depth(); xcb_pixmap_t xpix = xcb_generate_id(connection()); xcb_create_pixmap(connection(), depth, xpix, rootWindow(), img.width(), img.height()); diff --git a/libkwineffects/kwinxrenderutils.h b/libkwineffects/kwinxrenderutils.h index f2ad1c3317..a02028d766 100644 --- a/libkwineffects/kwinxrenderutils.h +++ b/libkwineffects/kwinxrenderutils.h @@ -70,6 +70,7 @@ public: explicit XRenderPicture(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE); // TODO: Qt5 - replace QPixmap by QImage to make it more obvious that it uses PutImage explicit XRenderPicture(const QPixmap &pix); + explicit XRenderPicture(const QImage &img); XRenderPicture(xcb_pixmap_t pix, int depth); operator xcb_render_picture_t(); private: