From 0f36131d9d5c9c0dd23fbf6d5d7afc86369d7194 Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 28 May 2020 00:00:48 +0200 Subject: [PATCH] Remove dependency to xcb_image --- src/Nazara/Renderer/GLX/ScopedXCB.cpp | 88 --------------------------- src/Nazara/Renderer/GLX/ScopedXCB.hpp | 20 ------ 2 files changed, 108 deletions(-) diff --git a/src/Nazara/Renderer/GLX/ScopedXCB.cpp b/src/Nazara/Renderer/GLX/ScopedXCB.cpp index e92f8f382..35e19cd79 100644 --- a/src/Nazara/Renderer/GLX/ScopedXCB.cpp +++ b/src/Nazara/Renderer/GLX/ScopedXCB.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include namespace Nz @@ -109,91 +108,4 @@ namespace Nz { 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; - } } diff --git a/src/Nazara/Renderer/GLX/ScopedXCB.hpp b/src/Nazara/Renderer/GLX/ScopedXCB.hpp index dc9a4ff1d..b7c2c1fd2 100644 --- a/src/Nazara/Renderer/GLX/ScopedXCB.hpp +++ b/src/Nazara/Renderer/GLX/ScopedXCB.hpp @@ -74,26 +74,6 @@ namespace Nz xcb_connection_t* m_connection; 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