44 #include <QtGui/private/qt_x11_p.h> 45 #include <QtGui/private/qegl_p.h> 46 #include <QtGui/private/qeglproperties_p.h> 47 #include <QtGui/private/qeglcontext_p.h> 49 #if !defined(QT_OPENGL_ES_1) 50 #include <QtOpenGL/private/qpaintengineex_opengl2_p.h> 53 #ifndef QT_OPENGL_ES_2 54 #include <QtOpenGL/private/qpaintengine_opengl_p.h> 57 #include <QtOpenGL/private/qgl_p.h> 58 #include <QtOpenGL/private/qgl_egl_p.h> 82 eglGetConfigAttrib(
QEgl::display(), rgbConfig, EGL_CONFIG_ID, &rgbConfigId);
83 eglGetConfigAttrib(
QEgl::display(), argbConfig, EGL_CONFIG_ID, &argbConfigId);
93 if (rgbConfig == argbConfig)
102 qWarning(
"QX11GLPixmapData - RGB & ARGB contexts aren't shared");
114 rgbPixmapData->
resize(8, 8);
118 rgbPixmapData->
gl_surface = (
void*)sharePixmapSurface;
131 if (argbConfig != rgbConfig) {
133 argbPixmapData->
resize(8, 8);
135 QPixmap argbPixmap(argbPixmapData);
156 qDebug(
"Using QX11GLPixmapData with EGL config %d for ARGB and config %d for RGB", argbConfigId, rgbConfigId);
211 qt_x11gl_share_contexts()->cleanup();
217 return qt_x11gl_share_contexts();
222 static bool checkedForX11GLPixmaps =
false;
223 static bool haveX11GLPixmaps =
false;
225 if (checkedForX11GLPixmaps)
226 return haveX11GLPixmaps;
228 haveX11GLPixmaps = qt_x11gl_share_contexts()->isValid();
229 checkedForX11GLPixmaps =
true;
231 return haveX11GLPixmaps;
256 XSync(
X11->display, False);
260 eglWaitNative(EGL_CORE_NATIVE_ENGINE);
273 XSync(
X11->display, False);
277 eglWaitNative(EGL_CORE_NATIVE_ENGINE);
290 XSync(
X11->display, False);
294 eglWaitNative(EGL_CORE_NATIVE_ENGINE);
300 #if !defined(QT_OPENGL_ES_1) 304 #ifndef QT_OPENGL_ES_2 321 ctx->d_func()->sharing =
true;
330 #if defined(QT_OPENGL_ES_1) 331 engine = qt_gl_pixmap_engine();
332 #elif defined(QT_OPENGL_ES_2) 333 engine = qt_gl_pixmap_2_engine();
336 engine = qt_gl_pixmap_2_engine();
338 engine = qt_gl_pixmap_engine();
344 if (engine->isActive()) {
345 qWarning(
"Pixmap paint engine already active");
347 #if defined(QT_OPENGL_ES_1) 349 #elif defined(QT_OPENGL_ES_2) 358 engine->setAutoDestruct(
true);
369 if ((EGLSurface)
gl_surface == EGL_NO_SURFACE) {
371 EGLConfig cfg =
ctx->d_func()->eglContext->config();
376 if (surface == EGL_NO_SURFACE) {
381 ctx->d_func()->eglSurface = surface;
382 ctx->d_func()->valid =
true;
void qt_glformat_from_eglconfig(QGLFormat &format, const EGLConfig config)
The QColor class provides colors based on RGB, HSV or CMYK values.
QGLContext * context() const
static void addShare(const QGLContext *context, const QGLContext *share)
#define QT_END_NAMESPACE
This macro expands to.
bool createContext(QEglContext *shareContext=0, const QEglProperties *properties=0)
static QGLTextureCache * instance()
void qAddPostRoutine(QtCleanUpFunction p)
QGLContext * sharedQGLContext
static QGLFormat glFormat()
void resize(int width, int height)
QPaintEngine * paintEngine() const
Q_GUI_EXPORT QString errorString(EGLint code=eglGetError())
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT EGLDisplay display()
bool scroll(int dx, int dy, const QRect &rect)
Q_GLOBAL_STATIC_WITH_INITIALIZER(QX11GLSharedContexts, qt_x11gl_share_contexts, { qAddPostRoutine(qt_cleanup_x11gl_share_contexts);}) static void qt_cleanup_x11gl_share_contexts()
The QGLContext class encapsulates an OpenGL rendering context.
bool scroll(int dx, int dy, const QRect &rect)
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
void copy(const QPixmapData *data, const QRect &rect)
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
void copy(const QPixmapData *data, const QRect &rect)
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
QEglContext * argbContext
bool qt_gl_preferGL2Engine()
static bool hasX11GLPixmaps()
void fill(const QColor &color)
Q_GUI_EXPORT EGLConfig defaultConfig(int devType, API api, ConfigOptions options)
void fill(const QColor &color)
Q_GUI_EXPORT EGLSurface createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *surfaceAttribs=0)
bool hasAlphaChannel() const
bool makeCurrent(EGLSurface surface)
virtual void beginPaint()
void setConfig(EGLConfig config)
The QRect class defines a rectangle in the plane using integer precision.
virtual void makeCurrent()
Makes this context the current OpenGL rendering context.
The QPixmap class is an off-screen image representation that can be used as a paint device...
virtual ~QX11GLPixmapData()
The QSize class defines the size of a two-dimensional object using integer point precision.
static QX11GLSharedContexts * sharedContexts()
static void qt_cleanup_x11gl_share_contexts()