47 #include <QtCore/QDebug> 51 const int width = img.
width();
52 const int height = img.
height();
55 || (pixel_type ==
GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
57 for (
int i = 0; i < height; ++i) {
59 for (
int x = 0; x < width; ++x)
60 p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
63 for (
int i = 0; i < height; ++i) {
65 for (
int x = 0; x < width; ++x)
66 p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
73 , mGlxIntegration(glxIntegration)
77 , mConfig(
qglx_findConfig(glxIntegration->xDisplay(),glxIntegration->screen(),window->
widget()->platformWindowFormat(),GLX_PIXMAP_BIT))
80 XVisualInfo *visualInfo = glXGetVisualFromFBConfig(glxIntegration->
xDisplay(),
mConfig);
108 void *pixels =
const_cast<uchar *
>(constBits);
114 constBits = img.bits();
117 uchar *dstBits =
const_cast<uchar *
>(constDstBits);
118 memcpy(dstBits,constBits,(img.width()*4) * img.height());
128 return (
void *) glXGetProcAddress(reinterpret_cast<GLubyte *>(procName.
toLatin1().
data()));
139 if (size.isEmpty()) {
161 qDebug() <<
"Could not make egl surface out of pixmap :(";
static const QPlatformGLContext * currentContext()
Returns the last context which called makeCurrent.
QPointer< QWidget > widget
char * data()
Returns a pointer to the data stored in the byte array.
QPlatformWindowFormat qglx_platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx)
#define GL_UNSIGNED_INT_8_8_8_8_REV
virtual void doneCurrent()
Reimplement in subclass to release current context.
The QString class provides a Unicode character string.
QWaylandDisplay * waylandDisplay() const
Display * xDisplay() const
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
QWaylandReadbackGlxIntegration * mGlxIntegration
void swapBuffers()
Reimplement in subclass to native swap buffers calls.
QWaylandShmBuffer * mBuffer
QSize size() const
Returns the size of the rectangle.
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QRegion class specifies a clip region for a painter.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
virtual void makeCurrent()
Reimplement in subclass to do makeCurrent on native GL context.
QImage mirrored(bool horizontally=false, bool vertically=true) const
Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on ...
void attach(QWaylandBuffer *buffer)
QPlatformWindowFormat platformWindowFormat() const
QWidget has the function qplatformWindowFormat().
GLXFBConfig qglx_findConfig(Display *display, int screen, const QPlatformWindowFormat &format, int drawableBit)
Window rootWindow() const
void * getProcAddress(const QString &procName)
Reimplement in subclass to native getProcAddr calls.
#define TRUE
Synonym for true.
void makeCurrent()
Reimplement in subclass to do makeCurrent on native GL context.
uchar * bits()
Returns a pointer to the first pixel data.
int width() const
Returns the width of the image.
The QPlatformGLContext class provides an abstraction for native GL contexts.
QWaylandReadbackGlxContext(QWaylandReadbackGlxIntegration *glxIntegration, QWaylandReadbackGlxWindow *window)
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
int height() const
Returns the height of the image.
void doneCurrent()
Reimplement in subclass to release current context.
QWaylandReadbackGlxWindow * mWindow
The QSize class defines the size of a two-dimensional object using integer point precision.
void damage(const QRect &rect)
static void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.