44 #include "../../../eglconvenience/qeglconvenience.h" 46 #include <QtOpenGL/QGLContext> 47 #include <QtOpenGL/private/qglextensions_p.h> 51 #include <QtCore/QDebug> 55 const int width = img.
width();
56 const int height = img.
height();
59 || (pixel_type ==
GL_UNSIGNED_BYTE && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
61 for (
int i = 0; i < height; ++i) {
63 for (
int x = 0; x < width; ++x)
64 p[x] = ((p[x] << 16) & 0xff0000) | ((p[x] >> 16) & 0xff) | (p[x] & 0xff00ff00);
67 for (
int i = 0; i < height; ++i) {
69 for (
int x = 0; x < width; ++x)
70 p[x] = (p[x] << 8) | ((p[x] >> 24) & 0xff);
76 : mEglIntegration(eglIntegration)
81 , mPixmapSurface(EGL_NO_SURFACE)
84 eglContextAttrs.
append(EGL_CONTEXT_CLIENT_VERSION);
86 eglContextAttrs.
append(EGL_NONE);
125 void *pixels =
const_cast<uchar *
>(constBits);
131 constBits = img.bits();
134 uchar *dstBits =
const_cast<uchar *
>(constDstBits);
135 memcpy(dstBits,constBits,(img.width()*4) * img.height());
143 return (
void *) eglGetProcAddress(procName.
toLatin1().
data());
154 if (size.isEmpty()) {
171 if (mPixmapSurface == EGL_NO_SURFACE) {
172 qDebug() <<
"Could not make egl surface out of pixmap :(";
static const QPlatformGLContext * currentContext()
Returns the last context which called makeCurrent.
QWaylandReadbackEglContext(QWaylandReadbackEglIntegration *eglIntegration, QWaylandReadbackEglWindow *window)
QPointer< QWidget > widget
char * data()
Returns a pointer to the data stored in the byte array.
Window rootWindow() const
EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat, int surfaceType)
#define GL_UNSIGNED_INT_8_8_8_8_REV
virtual void doneCurrent()
Reimplement in subclass to release current context.
virtual QPlatformWindowFormat platformWindowFormat() const
QWidget has the function qplatformWindowFormat().
~QWaylandReadbackEglContext()
void swapBuffers()
Reimplement in subclass to native swap buffers calls.
The QString class provides a Unicode character string.
void * getProcAddress(const QString &procName)
Reimplement in subclass to native getProcAddr calls.
QWaylandReadbackEglIntegration * mEglIntegration
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
EGLSurface mPixmapSurface
Display * xDisplay() const
QSize size() const
Returns the size of the rectangle.
QWaylandShmBuffer * mBuffer
void append(const T &t)
Inserts value at the end of the vector.
The QImage class provides a hardware-independent image representation that allows direct access to th...
void makeCurrent()
Reimplement in subclass to do makeCurrent on native GL context.
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)
void doneCurrent()
Reimplement in subclass to release current context.
static void qgl_byteSwapImage(QImage &img, GLenum pixel_type)
uchar * bits()
Returns a pointer to the first pixel data.
int width() const
Returns the width of the image.
QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config)
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.
The QSize class defines the size of a two-dimensional object using integer point precision.
const T * constData() const
Returns a const pointer to the data stored in the vector.
void damage(const QRect &rect)
QWaylandReadbackEglWindow * mWindow
QWaylandDisplay * waylandDisplay() const
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.