Use XCB types in XRenderPicture API

Usage of xcb_pixmap_t and xcb_render_picture_t
This commit is contained in:
Martin Gräßlin 2013-02-12 09:16:42 +01:00
parent 7faede41c7
commit 24c681448a
2 changed files with 16 additions and 16 deletions

View file

@ -75,10 +75,10 @@ XRenderPicture xRenderBlendPicture(double opacity)
// XRenderFind(Standard)Format() is a roundtrip, so cache the results
static XRenderPictFormat* renderformats[ 33 ];
static Picture createPicture(Pixmap pix, int depth)
static xcb_render_picture_t createPicture(xcb_pixmap_t pix, int depth)
{
if (pix == None)
return None;
if (pix == XCB_PIXMAP_NONE)
return XCB_RENDER_PICTURE_NONE;
if (renderformats[ depth ] == NULL) {
switch(depth) {
case 1:
@ -131,7 +131,7 @@ XRenderPicture::XRenderPicture(QPixmap pix)
xcb_free_pixmap(connection(), xpix);
}
XRenderPicture::XRenderPicture(Pixmap pix, int depth)
XRenderPicture::XRenderPicture(xcb_pixmap_t pix, int depth)
: d(new XRenderPictureData(createPicture(pix, depth)))
{
}

View file

@ -49,11 +49,11 @@ class KWIN_EXPORT XRenderPictureData
: public QSharedData
{
public:
explicit XRenderPictureData(Picture pic = None);
explicit XRenderPictureData(xcb_render_picture_t pic = XCB_RENDER_PICTURE_NONE);
~XRenderPictureData();
Picture value();
xcb_render_picture_t value();
private:
Picture picture;
xcb_render_picture_t picture;
Q_DISABLE_COPY(XRenderPictureData)
};
@ -67,11 +67,11 @@ private:
class KWIN_EXPORT XRenderPicture
{
public:
explicit XRenderPicture(Picture pic = None);
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(QPixmap pix);
XRenderPicture(Pixmap pix, int depth);
operator Picture();
XRenderPicture(xcb_pixmap_t pix, int depth);
operator xcb_render_picture_t();
private:
KSharedPtr< XRenderPictureData > d;
};
@ -88,7 +88,7 @@ private:
};
inline
XRenderPictureData::XRenderPictureData(Picture pic)
XRenderPictureData::XRenderPictureData(xcb_render_picture_t pic)
: picture(pic)
{
}
@ -96,24 +96,24 @@ XRenderPictureData::XRenderPictureData(Picture pic)
inline
XRenderPictureData::~XRenderPictureData()
{
if (picture != None)
XRenderFreePicture(display(), picture);
if (picture != XCB_RENDER_PICTURE_NONE)
xcb_render_free_picture(connection(), picture);
}
inline
Picture XRenderPictureData::value()
xcb_render_picture_t XRenderPictureData::value()
{
return picture;
}
inline
XRenderPicture::XRenderPicture(Picture pic)
XRenderPicture::XRenderPicture(xcb_render_picture_t pic)
: d(new XRenderPictureData(pic))
{
}
inline
XRenderPicture::operator Picture()
XRenderPicture::operator xcb_render_picture_t()
{
return d->value();
}