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.
This commit is contained in:
Martin Gräßlin 2013-08-13 07:19:09 +02:00
parent 7baaa46daa
commit 388944314a
6 changed files with 12 additions and 19 deletions

View file

@ -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

View file

@ -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());

View file

@ -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);
}

View file

@ -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();

View file

@ -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();

View file

@ -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<ShadowElementsCount; ++i) {
delete m_pictures[i];
m_pictures[i] = new XRenderPicture(shadowPixmap(ShadowElements(i)));
m_pictures[i] = new XRenderPicture(shadowPixmap(ShadowElements(i)).toImage());
xcb_render_change_picture(connection(), *m_pictures[i], XCB_RENDER_CP_REPEAT, values);
}
return true;