Remove dependency to xcb_image
This commit is contained in:
parent
a1d7bc49c2
commit
0f36131d9d
|
|
@ -5,7 +5,6 @@
|
||||||
#include <Nazara/Renderer/GLX/ScopedXCB.hpp>
|
#include <Nazara/Renderer/GLX/ScopedXCB.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Renderer/GLX/Display.hpp>
|
#include <Nazara/Renderer/GLX/Display.hpp>
|
||||||
#include <xcb/xcb_image.h>
|
|
||||||
#include <Nazara/Renderer/Debug.hpp>
|
#include <Nazara/Renderer/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
|
|
@ -109,91 +108,4 @@ namespace Nz
|
||||||
{
|
{
|
||||||
return m_gcontext;
|
return m_gcontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************
|
|
||||||
XCBPixmap
|
|
||||||
***********************************************/
|
|
||||||
|
|
||||||
XCBPixmap::XCBPixmap() :
|
|
||||||
m_connection(nullptr),
|
|
||||||
m_pixmap(XCB_NONE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
XCBPixmap::XCBPixmap(xcb_connection_t* connection) :
|
|
||||||
m_connection(connection),
|
|
||||||
m_pixmap(XCB_NONE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
XCBPixmap::~XCBPixmap()
|
|
||||||
{
|
|
||||||
Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
void XCBPixmap::Connect(xcb_connection_t* connection)
|
|
||||||
{
|
|
||||||
NazaraAssert(connection && !m_connection, "Connection must be established");
|
|
||||||
|
|
||||||
m_connection = connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XCBPixmap::Create(uint8_t depth, xcb_drawable_t drawable, uint16_t width, uint16_t height)
|
|
||||||
{
|
|
||||||
NazaraAssert(m_pixmap == XCB_NONE, "Pixmap must have been destroyed before or just created");
|
|
||||||
|
|
||||||
m_pixmap = xcb_generate_id(m_connection);
|
|
||||||
|
|
||||||
return X11::CheckCookie(
|
|
||||||
m_connection,
|
|
||||||
xcb_create_pixmap(
|
|
||||||
m_connection,
|
|
||||||
depth,
|
|
||||||
m_pixmap,
|
|
||||||
drawable,
|
|
||||||
width,
|
|
||||||
height
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XCBPixmap::CreatePixmapFromBitmapData(xcb_drawable_t drawable, uint8_t* data, uint32_t width, uint32_t height, uint32_t depth, uint32_t fg, uint32_t bg, xcb_gcontext_t* gcp)
|
|
||||||
{
|
|
||||||
NazaraAssert(m_pixmap == XCB_NONE, "Pixmap must have been destroyed before or just created");
|
|
||||||
|
|
||||||
m_pixmap = xcb_create_pixmap_from_bitmap_data(
|
|
||||||
m_connection,
|
|
||||||
drawable,
|
|
||||||
data,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth,
|
|
||||||
fg,
|
|
||||||
bg,
|
|
||||||
gcp
|
|
||||||
);
|
|
||||||
|
|
||||||
return m_pixmap != XCB_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XCBPixmap::Destroy()
|
|
||||||
{
|
|
||||||
if (m_pixmap == XCB_NONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!X11::CheckCookie(
|
|
||||||
m_connection,
|
|
||||||
xcb_free_pixmap(
|
|
||||||
m_connection,
|
|
||||||
m_pixmap
|
|
||||||
))
|
|
||||||
)
|
|
||||||
NazaraError("Failed to free pixmap");
|
|
||||||
|
|
||||||
m_pixmap = XCB_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
XCBPixmap::operator xcb_pixmap_t() const
|
|
||||||
{
|
|
||||||
return m_pixmap;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,26 +74,6 @@ namespace Nz
|
||||||
xcb_connection_t* m_connection;
|
xcb_connection_t* m_connection;
|
||||||
xcb_gcontext_t m_gcontext;
|
xcb_gcontext_t m_gcontext;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XCBPixmap
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
XCBPixmap();
|
|
||||||
XCBPixmap(xcb_connection_t* connection);
|
|
||||||
~XCBPixmap();
|
|
||||||
|
|
||||||
void Connect(xcb_connection_t* connection);
|
|
||||||
bool Create(uint8_t depth, xcb_drawable_t drawable, uint16_t width, uint16_t height);
|
|
||||||
bool CreatePixmapFromBitmapData(xcb_drawable_t drawable, uint8_t* data, uint32_t width, uint32_t height, uint32_t depth, uint32_t fg, uint32_t bg, xcb_gcontext_t* gcp);
|
|
||||||
|
|
||||||
void Destroy();
|
|
||||||
|
|
||||||
operator xcb_pixmap_t() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
xcb_connection_t* m_connection;
|
|
||||||
xcb_pixmap_t m_pixmap;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <Nazara/Renderer/GLX/ScopedXCB.inl>
|
#include <Nazara/Renderer/GLX/ScopedXCB.inl>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue