#ifndef EGLXSurface_h
#define EGLXSurface_h
#if PLATFORM(X11) && USE(EGL) && USE(GRAPHICS_SURFACE)
#include "EGLSurface.h"
#include "XUniquePtr.h"
#include <glx/X11Helper.h>
namespace WebCore {
typedef Pixmap NativePixmap;
class EGLWindowTransportSurface : public EGLTransportSurface {
public:
EGLWindowTransportSurface(const IntSize&, GLPlatformSurface::SurfaceAttributes);
virtual ~EGLWindowTransportSurface();
virtual void swapBuffers() override;
virtual void destroy() override;
};
class EGLPixmapSurface : public EGLOffScreenSurface {
public:
EGLPixmapSurface(GLPlatformSurface::SurfaceAttributes);
virtual ~EGLPixmapSurface();
virtual void destroy() override;
};
class EGLTextureFromPixmap {
public:
EGLTextureFromPixmap(const NativePixmap, bool, EGLConfig);
virtual ~EGLTextureFromPixmap();
bool bindTexImage();
bool isValid() const;
bool reBindTexImage();
void destroy();
private:
EGLImageKHR m_eglImage;
EGLSurface m_surface;
};
class EGLXTransportSurfaceClient : public GLTransportSurfaceClient {
public:
EGLXTransportSurfaceClient(const PlatformBufferHandle, const IntSize&, bool);
virtual ~EGLXTransportSurfaceClient();
virtual void prepareTexture() override;
virtual void destroy() override;
private:
XUniquePtr<XImage> m_image;
IntSize m_size;
PlatformBufferHandle m_handle;
GLuint m_format;
unsigned m_totalBytes;
std::unique_ptr<EGLTextureFromPixmap> m_eglImage;
};
}
#endif
#endif