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: