44 #include <private/qimage_p.h> 45 #include <private/qwindowsurface_gl_p.h> 46 #include <private/qeglcontext_p.h> 47 #include <private/qapplication_p.h> 48 #include <private/qgraphicssystem_runtime_p.h> 49 #include <private/qpixmap_x11_p.h> 72 int depth = img.
depth() >> 3;
84 if (r.top() < p.
y()) {
85 src = mem + r.bottom() * lineskip + r.left() * depth;
86 dest = mem + (p.
y() + r.height() - 1) * lineskip + p.
x() * depth;
89 src = mem + r.top() * lineskip + r.left() * depth;
90 dest = mem + p.
y() * lineskip + p.
x() * depth;
93 const int w = r.width();
95 const int bytes = w * depth;
98 if (offset.
y() == 0 &&
qAbs(offset.
x()) < w) {
100 ::memmove(dest, src, bytes);
106 ::memcpy(dest, src, bytes);
117 QImage image(w, h, format);
150 GLuint newTextureId = 0;
156 qWarning(
"eglCreateImageKHR failed (live texture)!");
160 glGenTextures(1, &newTextureId);
170 qWarning(
"Failed to create a texture from an egl image (live texture)!");
171 glDeleteTextures(1, &newTextureId);
179 qWarning(
"Create compatible called on live pixmap! Expect fail soon...");
197 int surfaceWidth = 0;
198 int surfaceHeight = 0;
199 EGLSurface surface = 0;
205 qWarning(
"Failed to lock surface (live texture)!");
211 eglQuerySurface(
QEgl::display(), surface, EGL_WIDTH, (EGLint*) &surfaceWidth);
212 eglQuerySurface(
QEgl::display(), surface, EGL_HEIGHT, (EGLint*) &surfaceHeight);
221 if (data == NULL || pitch == 0) {
222 qWarning(
"Failed to query the live texture!");
226 if (
width() != surfaceWidth ||
height() != surfaceHeight) {
227 qWarning(
"Live texture dimensions don't match!");
299 if (pixmapData->
gl_surface == (
void*)EGL_NO_SURFACE)
310 if (pixmapData->gl_surface) {
311 eglDestroySurface(
QEgl::display(), (EGLSurface)pixmapData->gl_surface);
312 pixmapData->gl_surface = 0;
#define EGL_WRITE_SURFACE_BIT_KHR
iterator erase(iterator pos)
Removes the item pointed to by the iterator pos from the list, and returns an iterator to the next it...
Format
The following image formats are available in Qt.
int width() const
Returns the width of the pixmap.
static void invalidateSurfaces()
QPixmap * backingX11Pixmap
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Q_OPENGL_EXPORT QGLWidget * qt_gl_share_widget()
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
static EGLint preserved_attribs[]
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Qt::HANDLE handle() const
Returns the pixmap's handle to the device context.
int bytesPerLine() const
Returns the number of bytes per image scanline.
int depth() const
Returns the depth of the pixmap.
Q_DECL_CONSTEXPR T qAbs(const T &t)
void fromImage(const QImage &image, Qt::ImageConversionFlags flags)
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR
static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
QGLContext::BindOptions options
QImage * lock(EGLSyncKHR fenceSync)
QMeeGoLivePixmapDataList::Iterator pos
bool scroll(int dx, int dy, const QRect &rect)
PixelType pixelType() const
#define EGL_BITMAP_POINTER_KHR
The QLinkedList class is a template class that provides linked lists.
QGLTexture * texture() const
void destroySurfaceForPixmapData(QPixmapData *pmd)
T * data() const
Returns a pointer to the shared data object.
Q_GUI_EXPORT EGLDisplay display()
QPixmapData * createCompatiblePixmapData() const
Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
The QGLContext class encapsulates an OpenGL rendering context.
#define EGL_MAP_PRESERVE_PIXELS_KHR
void resize(int width, int height)
#define EGL_READ_SURFACE_BIT_KHR
void initializeThroughEGLImage()
#define EGL_NATIVE_PIXMAP_KHR
EGLSurface getSurfaceForBackingPixmap()
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
friend class QX11PixmapData
int depth() const
Returns the depth of the image.
Q_GUI_EXPORT EGLConfig defaultConfig(int devType, API api, ConfigOptions options)
#define EGL_IMAGE_PRESERVED_KHR
int width() const
Returns the width of the image.
QMeeGoLivePixmapData(int w, int h, QImage::Format format)
static EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs=0)
static void ensureInitialized()
bool hasAlphaChannel() const
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
int height() const
Returns the height of the image.
int y() const
Returns the y coordinate of this point.
#define EGL_LOCK_USAGE_HINT_KHR
int height() const
Returns the height of the pixmap.
static QMeeGoLivePixmapDataList all_live_pixmaps
static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
static EGLint lock_attribs[]
iterator insert(iterator before, const T &t)
Inserts value in front of the item pointed to by the iterator before.
int x() const
Returns the x coordinate of this point.
Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
#define EGL_BITMAP_PITCH_KHR
bool hasAlphaChannel() const
Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false...
#define glEGLImageTargetTexture2DOES
bool release(QImage *img)
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.