QMeeGoLivePixmapData::QMeeGoLivePixmapData(Qt::HANDLE h) : QGLPixmapData(QPixmapData::PixmapType) { backingX11Pixmap = new QPixmap(QPixmap::fromX11Pixmap(h)); initializeThroughEGLImage(); pos = all_live_pixmaps.insert(all_live_pixmaps.begin(), this); }
QMeeGoLivePixmapData::QMeeGoLivePixmapData(int w, int h, QImage::Format format) : QGLPixmapData(QPixmapData::PixmapType) { QImage image(w, h, format); QX11PixmapData *pmd = new QX11PixmapData(QPixmapData::PixmapType); pmd->fromImage(image, Qt::NoOpaqueDetection); backingX11Pixmap = new QPixmap(pmd); initializeThroughEGLImage(); }
EGLSurface QMeeGoLivePixmapData::getSurfaceForBackingPixmap() { initializeThroughEGLImage(); // This code is a crative remix of the stuff that can be found in the // Qt's TFP implementation in /src/opengl/qgl_x11egl.cpp ::bindiTextureFromNativePixmap QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(backingX11Pixmap->data_ptr().data()); Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class); bool hasAlpha = pixmapData->hasAlphaChannel(); if (pixmapData->gl_surface && hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha)) return pixmapData->gl_surface; // Check to see if the surface is still valid if (pixmapData->gl_surface && hasAlpha != ((pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha) > 0)) { // Surface is invalid! destroySurfaceForPixmapData(pixmapData); } if (pixmapData->gl_surface == 0) { EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, hasAlpha ? QEgl::Translucent : QEgl::NoOptions); pixmapData->gl_surface = (void*)QEgl::createSurface(backingX11Pixmap, config); if (hasAlpha) pixmapData->flags |= QX11PixmapData::GlSurfaceCreatedWithAlpha; else pixmapData->flags &= ~QX11PixmapData::GlSurfaceCreatedWithAlpha; if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE) return NULL; } return pixmapData->gl_surface; }
QMeeGoLivePixmapData::QMeeGoLivePixmapData(Qt::HANDLE h) : QGLPixmapData(QPixmapData::PixmapType) { backingX11Pixmap = new QPixmap(QPixmap::fromX11Pixmap(h)); initializeThroughEGLImage(); }