From 388944314acd156af7b29266b5922276b788d147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 13 Aug 2013 07:19:09 +0200 Subject: [PATCH] Drop QPixmap ctor of XRenderPicture Was a todo to remove it as it's just using a toImage. Removing this ctor should make it for the user more obvious that put image is used. --- effects/screenedge/screenedgeeffect.cpp | 10 +++++----- effects/trackmouse/trackmouse.cpp | 2 +- effects/zoom/zoom.cpp | 2 +- libkwineffects/kwinxrenderutils.cpp | 5 ----- libkwineffects/kwinxrenderutils.h | 2 -- scene_xrender.cpp | 10 +++++----- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/effects/screenedge/screenedgeeffect.cpp b/effects/screenedge/screenedgeeffect.cpp index 8c5bea1236..5e3c9e5585 100644 --- a/effects/screenedge/screenedgeeffect.cpp +++ b/effects/screenedge/screenedgeeffect.cpp @@ -218,13 +218,13 @@ T *ScreenEdgeEffect::createCornerGlow(ElectricBorder border) { switch (border) { case ElectricTopLeft: - return new T(m_glow->pixmap(QStringLiteral("bottomright"))); + return new T(m_glow->pixmap(QStringLiteral("bottomright")).toImage()); case ElectricTopRight: - return new T(m_glow->pixmap(QStringLiteral("bottomleft"))); + return new T(m_glow->pixmap(QStringLiteral("bottomleft")).toImage()); case ElectricBottomRight: - return new T(m_glow->pixmap(QStringLiteral("topleft"))); + return new T(m_glow->pixmap(QStringLiteral("topleft")).toImage()); case ElectricBottomLeft: - return new T(m_glow->pixmap(QStringLiteral("topright"))); + return new T(m_glow->pixmap(QStringLiteral("topright")).toImage()); default: return NULL; } @@ -291,7 +291,7 @@ T *ScreenEdgeEffect::createEdgeGlow(ElectricBorder border, const QSize &size) p.drawPixmap(QPoint(pixmapPosition.x(), size.height() - r.height()), r); } p.end(); - return new T(image); + return new T(image.toImage()); } bool ScreenEdgeEffect::isActive() const diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index 39a0da5828..ff60855060 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -261,7 +261,7 @@ void TrackMouseEffect::loadTexture() } #ifdef KWIN_HAVE_XRENDER_COMPOSITING if ( effects->compositingType() == XRenderCompositing) { - QPixmap pixmap(f[i]); + QImage pixmap(f[i]); m_picture[i] = new XRenderPicture(pixmap); m_size[i] = pixmap.size(); m_lastRect[i].setSize(pixmap.size()); diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index 236d4abe40..524b17b9e8 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -190,7 +190,7 @@ void ZoomEffect::recreateTexture() texture.reset(new GLTexture(img)); #ifdef KWIN_HAVE_XRENDER_COMPOSITING if (effects->compositingType() == XRenderCompositing) - xrenderPicture.reset(new XRenderPicture(QPixmap::fromImage(img))); + xrenderPicture.reset(new XRenderPicture(img)); #endif XcursorImageDestroy(ximg); } diff --git a/libkwineffects/kwinxrenderutils.cpp b/libkwineffects/kwinxrenderutils.cpp index 03727deb4b..41d3f1e3f1 100644 --- a/libkwineffects/kwinxrenderutils.cpp +++ b/libkwineffects/kwinxrenderutils.cpp @@ -107,11 +107,6 @@ static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth) return pic; } -XRenderPicture::XRenderPicture(const QPixmap &pix) -{ - XRenderPicture(pix.toImage()); -} - XRenderPicture::XRenderPicture(const QImage &img) { const int depth = img.depth(); diff --git a/libkwineffects/kwinxrenderutils.h b/libkwineffects/kwinxrenderutils.h index a02028d766..a5b6ee29df 100644 --- a/libkwineffects/kwinxrenderutils.h +++ b/libkwineffects/kwinxrenderutils.h @@ -68,8 +68,6 @@ class KWIN_EXPORT XRenderPicture { 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(); diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 8d38a2e2ea..5c487e081e 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -881,7 +881,7 @@ void SceneXrender::EffectFrame::render(QRegion region, double opacity, double fr if (!m_selectionPicture) { // Lazy creation const QPixmap pix = m_effectFrame->selectionFrame().framePixmap(); if (!pix.isNull()) // don't try if there's no content - m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap()); + m_selectionPicture = new XRenderPicture(m_effectFrame->selectionFrame().framePixmap().toImage()); } if (m_selectionPicture) { const QRect geom = m_effectFrame->selection(); @@ -898,7 +898,7 @@ void SceneXrender::EffectFrame::render(QRegion region, double opacity, double fr QPoint topLeft(m_effectFrame->geometry().x(), m_effectFrame->geometry().center().y() - m_effectFrame->iconSize().height() / 2); if (!m_iconPicture) // lazy creation - m_iconPicture = new XRenderPicture(m_effectFrame->icon()); + m_iconPicture = new XRenderPicture(m_effectFrame->icon().toImage()); QRect geom = QRect(topLeft, m_effectFrame->iconSize()); xcb_render_composite(connection(), XCB_RENDER_PICT_OP_OVER, *m_iconPicture, fill, effects->xrenderBufferPicture(), @@ -1011,7 +1011,7 @@ void SceneXrender::EffectFrame::updatePicture() if (m_effectFrame->style() == EffectFrameStyled) { const QPixmap pix = m_effectFrame->frame().framePixmap(); if (!pix.isNull()) - m_picture = new XRenderPicture(pix); + m_picture = new XRenderPicture(pix.toImage()); } } @@ -1050,7 +1050,7 @@ void SceneXrender::EffectFrame::updateTextPicture() } p.drawText(rect, m_effectFrame->alignment(), text); p.end(); - m_textPicture = new XRenderPicture(pixmap); + m_textPicture = new XRenderPicture(pixmap.toImage()); } SceneXRenderShadow::SceneXRenderShadow(Toplevel *toplevel) @@ -1115,7 +1115,7 @@ bool SceneXRenderShadow::prepareBackend() const uint32_t values[] = {XCB_RENDER_REPEAT_NORMAL}; for (int i=0; i