summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-02-12 14:50:49 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-02-12 16:03:16 (GMT)
commitaf1f28a0d78deee31c5df0d7d042ae7671c8c34c (patch)
treee42d9effcddda6289afbeb4d9817db68467ce308 /src
parent040151b51780084f3a2b764bab7e2359677eb0b1 (diff)
downloadQt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.zip
Qt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.tar.gz
Qt-af1f28a0d78deee31c5df0d7d042ae7671c8c34c.tar.bz2
Cleanup QEglContext & EGLDisplays
This basicaly replaces display(), openDisplay() & defaultDisplay() methods with a single display() and nativeDisplay(), the latter being implemented in the platform-specific files and everything else being cross-platform code. Reviewed-By: Trond
Diffstat (limited to 'src')
-rw-r--r--src/gui/egl/qegl.cpp64
-rw-r--r--src/gui/egl/qegl_p.h12
-rw-r--r--src/gui/egl/qegl_qws.cpp6
-rw-r--r--src/gui/egl/qegl_symbian.cpp8
-rw-r--r--src/gui/egl/qegl_wince.cpp13
-rw-r--r--src/gui/egl/qegl_x11.cpp7
-rw-r--r--src/gui/egl/qeglproperties.cpp6
-rw-r--r--src/opengl/qgl_qws.cpp5
-rw-r--r--src/opengl/qgl_wince.cpp5
-rw-r--r--src/opengl/qgl_x11egl.cpp13
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp9
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp15
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp4
13 files changed, 60 insertions, 107 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index ae3d6c3..f66bd5a 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -54,9 +54,10 @@ QT_BEGIN_NAMESPACE
static QEglContext * volatile currentGLContext = 0;
static QEglContext * volatile currentVGContext = 0;
+EGLDisplay QEglContext::dpy = EGL_NO_DISPLAY;
+
QEglContext::QEglContext()
: apiType(QEgl::OpenGL)
- , dpy(EGL_NO_DISPLAY)
, ctx(EGL_NO_CONTEXT)
, cfg(0)
, currentSurface(EGL_NO_SURFACE)
@@ -68,7 +69,7 @@ QEglContext::QEglContext()
QEglContext::~QEglContext()
{
- destroy();
+ destroyContext();
if (currentGLContext == this)
currentGLContext = 0;
@@ -86,14 +87,6 @@ bool QEglContext::isCurrent() const
return current;
}
-// Open the EGL display associated with "device".
-bool QEglContext::openDisplay(QPaintDevice *device)
-{
- if (dpy == EGL_NO_DISPLAY)
- dpy = defaultDisplay(device);
- return (dpy != EGL_NO_DISPLAY);
-}
-
// Choose a configuration that matches "properties".
bool QEglContext::chooseConfig
(const QEglProperties& properties, QEgl::PixelFormatMatch match)
@@ -102,7 +95,7 @@ bool QEglContext::chooseConfig
do {
// Get the number of matching configurations for this set of properties.
EGLint matching = 0;
- if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching)
+ if (!eglChooseConfig(display(), props.properties(), 0, 0, &matching) || !matching)
continue;
// If we want the best pixel format, then return the first
@@ -179,7 +172,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
if (shareContext && shareContext->ctx == EGL_NO_CONTEXT)
shareContext = 0;
if (shareContext) {
- ctx = eglCreateContext(dpy, cfg, shareContext->ctx, contextProps.properties());
+ ctx = eglCreateContext(display(), cfg, shareContext->ctx, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError());
shareContext = 0;
@@ -209,7 +202,7 @@ void QEglContext::destroySurface(EGLSurface surface)
}
// Destroy the context. Note: this does not destroy the surface.
-void QEglContext::destroy()
+void QEglContext::destroyContext()
{
if (ctx != EGL_NO_CONTEXT && ownsContext)
eglDestroyContext(dpy, ctx);
@@ -248,7 +241,7 @@ bool QEglContext::makeCurrent(EGLSurface surface)
eglBindAPI(EGL_OPENVG_API);
#endif
- bool ok = eglMakeCurrent(dpy, surface, surface, ctx);
+ bool ok = eglMakeCurrent(display(), surface, surface, ctx);
if (!ok)
qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError());
return ok;
@@ -277,7 +270,7 @@ bool QEglContext::doneCurrent()
eglBindAPI(EGL_OPENVG_API);
#endif
- bool ok = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ bool ok = eglMakeCurrent(display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (!ok)
qWarning() << "QEglContext::doneCurrent():" << errorString(eglGetError());
return ok;
@@ -299,7 +292,7 @@ bool QEglContext::swapBuffers(EGLSurface surface)
if(ctx == EGL_NO_CONTEXT)
return false;
- bool ok = eglSwapBuffers(dpy, surface);
+ bool ok = eglSwapBuffers(display(), surface);
if (!ok)
qWarning() << "QEglContext::swapBuffers():" << errorString(eglGetError());
return ok;
@@ -338,7 +331,7 @@ void QEglContext::waitClient()
// Query the value of a configuration attribute.
bool QEglContext::configAttrib(int name, EGLint *value) const
{
- return eglGetConfigAttrib(dpy, cfg, name, value);
+ return eglGetConfigAttrib(display(), cfg, name, value);
}
// Retrieve all of the properties on "cfg". If zero, return
@@ -357,27 +350,38 @@ QEglProperties QEglContext::configProperties(EGLConfig cfg) const
return props;
}
-// Initialize and return the default display.
-EGLDisplay QEglContext::defaultDisplay(QPaintDevice *device)
+EGLDisplay QEglContext::display()
{
- static EGLDisplay dpy = EGL_NO_DISPLAY;
- if (dpy == EGL_NO_DISPLAY) {
- dpy = getDisplay(device);
+ static bool openedDisplay = false;
+
+ if (!openedDisplay) {
+ dpy = eglGetDisplay(nativeDisplay());
+ openedDisplay = true;
+ if (dpy == EGL_NO_DISPLAY) {
+ qWarning("QEglContext::display(): Falling back to EGL_DEFAULT_DISPLAY");
+ dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ }
if (dpy == EGL_NO_DISPLAY) {
- qWarning() << "QEglContext::defaultDisplay(): Cannot open EGL display";
+ qWarning("QEglContext::display(): Can't even open the default display");
return EGL_NO_DISPLAY;
}
+
if (!eglInitialize(dpy, NULL, NULL)) {
- qWarning() << "QEglContext::defaultDisplay(): Cannot initialize EGL display:" << errorString(eglGetError());
+ qWarning() << "QEglContext::display(): Cannot initialize EGL display:" << errorString(eglGetError());
return EGL_NO_DISPLAY;
}
-#ifdef EGL_OPENGL_ES_API
- eglBindAPI(EGL_OPENGL_ES_API);
-#endif
}
+
return dpy;
}
+#if !defined(Q_WS_X11) && !defined(Q_WS_WINCE) // WinCE & X11 implement this properly
+EGLNativeDisplayType QEglContext::nativeDisplay()
+{
+ return EGL_DEFAULT_DISPLAY;
+}
+#endif
+
// Return the error string associated with a specific code.
QString QEglContext::errorString(EGLint code)
{
@@ -410,7 +414,7 @@ void QEglContext::dumpAllConfigs()
{
QEglProperties props;
EGLint count = 0;
- if (!eglGetConfigs(dpy, 0, 0, &count) || count < 1)
+ if (!eglGetConfigs(display(), 0, 0, &count) || count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
eglGetConfigs(dpy, configs, count, &count);
@@ -423,7 +427,7 @@ void QEglContext::dumpAllConfigs()
QString QEglContext::extensions()
{
- const char* exts = eglQueryString(QEglContext::defaultDisplay(0), EGL_EXTENSIONS);
+ const char* exts = eglQueryString(QEglContext::display(), EGL_EXTENSIONS);
return QString(QLatin1String(exts));
}
@@ -431,7 +435,7 @@ bool QEglContext::hasExtension(const char* extensionName)
{
QList<QByteArray> extensions =
QByteArray(reinterpret_cast<const char *>
- (eglQueryString(QEglContext::defaultDisplay(0), EGL_EXTENSIONS))).split(' ');
+ (eglQueryString(QEglContext::display(), EGL_EXTENSIONS))).split(' ');
return extensions.contains(extensionName);
}
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index a7de9c8..87ed818 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -86,14 +86,12 @@ public:
QEgl::API api() const { return apiType; }
void setApi(QEgl::API api) { apiType = api; }
- bool openDisplay(QPaintDevice *device);
bool chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match = QEgl::ExactPixelFormat);
bool createContext(QEglContext *shareContext = 0, const QEglProperties *properties = 0);
+ void destroyContext();
EGLSurface createSurface(QPaintDevice *device, const QEglProperties *properties = 0);
void destroySurface(EGLSurface surface);
- void destroy();
-
bool makeCurrent(EGLSurface surface);
bool doneCurrent();
bool lazyDoneCurrent();
@@ -108,7 +106,7 @@ public:
static EGLint error() { return eglGetError(); }
static QString errorString(EGLint code);
- EGLDisplay display() const { return dpy; }
+ static EGLDisplay display();
EGLContext context() const { return ctx; }
void setContext(EGLContext context) { ctx = context; ownsContext = false;}
@@ -118,8 +116,6 @@ public:
QEglProperties configProperties(EGLConfig cfg = 0) const;
- static EGLDisplay defaultDisplay(QPaintDevice *device);
-
void dumpAllConfigs();
static QString extensions();
@@ -127,7 +123,6 @@ public:
private:
QEgl::API apiType;
- EGLDisplay dpy;
EGLContext ctx;
EGLConfig cfg;
EGLSurface currentSurface;
@@ -135,7 +130,8 @@ private:
bool ownsContext;
bool sharing;
- static EGLDisplay getDisplay(QPaintDevice *device);
+ static EGLDisplay dpy;
+ static EGLNativeDisplayType nativeDisplay();
static QEglContext *currentContext(QEgl::API api);
static void setCurrentContext(QEgl::API api, QEglContext *context);
diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp
index e999e0b..2a61beb 100644
--- a/src/gui/egl/qegl_qws.cpp
+++ b/src/gui/egl/qegl_qws.cpp
@@ -64,12 +64,6 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties
return EGL_NO_SURFACE;
}
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
-{
- Q_UNUSED(device);
- return eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY));
-}
-
static QScreen *screenForDevice(QPaintDevice *device)
{
QScreen *screen = qt_screen;
diff --git a/src/gui/egl/qegl_symbian.cpp b/src/gui/egl/qegl_symbian.cpp
index 44ecd19..b1c9408 100644
--- a/src/gui/egl/qegl_symbian.cpp
+++ b/src/gui/egl/qegl_symbian.cpp
@@ -86,14 +86,6 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties
return surf;
}
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
-{
- EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (dpy == EGL_NO_DISPLAY)
- qWarning("QEglContext::defaultDisplay(): Falling back to EGL_DEFAULT_DISPLAY");
- return dpy;
-}
-
// Set pixel format and other properties based on a paint device.
void QEglProperties::setPaintDeviceFormat(QPaintDevice *dev)
{
diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp
index 026a7b1..c9c9773 100644
--- a/src/gui/egl/qegl_wince.cpp
+++ b/src/gui/egl/qegl_wince.cpp
@@ -87,20 +87,15 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties
return surf;
}
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
+EGLNativeDisplayType QEglContext::nativeDisplay()
{
- EGLDisplay dpy = 0;
HWND win = (static_cast<QWidget*>(device))->winId();
HDC myDc = GetDC(win);
if (!myDc) {
- qWarning("QEglContext::defaultDisplay(): WinCE display is not open");
+ qWarning("QEglContext::nativeDisplay(): WinCE display is not open");
+ return EGL_DEFAULT_DISPLAY;
}
- dpy = eglGetDisplay(EGLNativeDisplayType(myDc));
- if (dpy == EGL_NO_DISPLAY) {
- qWarning("QEglContext::defaultDisplay(): Falling back to EGL_DEFAULT_DISPLAY");
- dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- }
- return dpy;
+ return EGLNativeDisplayType(myDc);
}
// Set pixel format and other properties based on a paint device.
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 2cf4e33..ef9ff78 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -93,15 +93,14 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties
return surf;
}
-EGLDisplay QEglContext::getDisplay(QPaintDevice *device)
+EGLNativeDisplayType QEglContext::nativeDisplay()
{
- Q_UNUSED(device);
Display *xdpy = QX11Info::display();
if (!xdpy) {
qWarning("QEglContext::getDisplay(): X11 display is not open");
- return EGL_NO_DISPLAY;
+ return EGL_DEFAULT_DISPLAY;
}
- return eglGetDisplay(EGLNativeDisplayType(xdpy));
+ return EGLNativeDisplayType(xdpy);
}
static int countBits(unsigned long mask)
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 2915fb9..236ec37 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -60,7 +60,7 @@ QEglProperties::QEglProperties(EGLConfig cfg)
props.append(EGL_NONE);
for (int name = 0x3020; name <= 0x304F; ++name) {
EGLint value;
- if (name != EGL_NONE && eglGetConfigAttrib(QEglContext::defaultDisplay(0), cfg, name, &value))
+ if (name != EGL_NONE && eglGetConfigAttrib(QEglContext::display(), cfg, name, &value))
setValue(name, value);
}
eglGetError(); // Clear the error state.
@@ -273,12 +273,12 @@ static void addTag(QString& str, const QString& tag)
void QEglProperties::dumpAllConfigs()
{
EGLint count = 0;
- eglGetConfigs(QEglContext::defaultDisplay(0), 0, 0, &count);
+ eglGetConfigs(QEglContext::display(), 0, 0, &count);
if (count < 1)
return;
EGLConfig *configs = new EGLConfig [count];
- eglGetConfigs(QEglContext::defaultDisplay(0), configs, count, &count);
+ eglGetConfigs(QEglContext::display(), configs, count, &count);
for (EGLint index = 0; index < count; ++index)
qWarning() << QEglProperties(configs[index]).toString();
delete [] configs;
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index d4adc8b..fd17a27 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -198,11 +198,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp
index 00a125a..f81115c 100644
--- a/src/opengl/qgl_wince.cpp
+++ b/src/opengl/qgl_wince.cpp
@@ -155,11 +155,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
// Get the display and initialize it.
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 572834b..3d183ee 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -190,11 +190,6 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (d->eglContext == 0) {
d->eglContext = new QEglContext();
d->eglContext->setApi(QEgl::OpenGL);
- if (!d->eglContext->openDisplay(device())) {
- delete d->eglContext;
- d->eglContext = 0;
- return false;
- }
// Construct the configuration we need for this surface.
QEglProperties configProps;
@@ -614,7 +609,7 @@ EGLConfig Q_OPENGL_EXPORT qt_chooseEGLConfigForPixmap(bool hasAlpha, bool readOn
EGLint configCount = 0;
do {
- eglChooseConfig(QEglContext::defaultDisplay(0), configAttribs.properties(), targetConfig, 1, &configCount);
+ eglChooseConfig(QEglContext::display(), configAttribs.properties(), targetConfig, 1, &configCount);
if (configCount > 0) {
// Got one
qDebug() << "Found an" << (hasAlpha ? "ARGB" : "RGB") << (readOnly ? "readonly" : "target" )
@@ -653,7 +648,7 @@ bool Q_OPENGL_EXPORT qt_createEGLSurfaceForPixmap(QPixmapData* pmd, bool readOnl
pixmapAttribs.setValue(EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGB);
EGLSurface pixmapSurface;
- pixmapSurface = eglCreatePixmapSurface(QEglContext::defaultDisplay(0),
+ pixmapSurface = eglCreatePixmapSurface(QEglContext::display(),
pixmapConfig,
(EGLNativePixmapType) pixmapData->handle(),
pixmapAttribs.properties());
@@ -762,7 +757,7 @@ void QGLContextPrivate::destroyGlSurfaceForPixmap(QPixmapData* pmd)
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
if (pixmapData->gl_surface) {
EGLBoolean success;
- success = eglDestroySurface(QEglContext::defaultDisplay(0), (EGLSurface)pixmapData->gl_surface);
+ success = eglDestroySurface(QEglContext::display(), (EGLSurface)pixmapData->gl_surface);
if (success == EGL_FALSE) {
qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: "
<< QEglContext::errorString(eglGetError());
@@ -777,7 +772,7 @@ void QGLContextPrivate::unbindPixmapFromTexture(QPixmapData* pmd)
QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
if (pixmapData->gl_surface) {
EGLBoolean success;
- success = eglReleaseTexImage(QEglContext::defaultDisplay(0),
+ success = eglReleaseTexImage(QEglContext::display(),
(EGLSurface)pixmapData->gl_surface,
EGL_BACK_BUFFER);
if (success == EGL_FALSE) {
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index ca19011..dbe919d 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -65,13 +65,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
ctx = new QEglContext();
ctx->setApi(QEgl::OpenGL);
- // Open the EGL display.
- if (!ctx->openDisplay(0)) {
- delete ctx;
- ctx = 0;
- return false;
- }
-
// Find the shared context.
QEglContext *shareContext = 0;
if (shareWidget && shareWidget->d_func()->glcx)
@@ -215,7 +208,7 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const
bool QGLPixelBuffer::hasOpenGLPbuffers()
{
// See if we have at least 1 configuration that matches the default format.
- EGLDisplay dpy = QEglContext::defaultDisplay(0);
+ EGLDisplay dpy = QEglContext::display();
if (dpy == EGL_NO_DISPLAY)
return false;
QEglProperties configProps;
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index 55aa1d0..229f75a 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -96,14 +96,14 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
#endif
EGL_NONE
};
- qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
+ qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::display(),
argbConfig, 0, contextAttribs);
if (argbConfig == rgbConfig) {
// If the configs are the same, we can re-use the same context.
qPixmapRGBSharedEglContext = qPixmapARGBSharedEglContext;
} else {
- qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
+ qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::display(),
rgbConfig, 0, contextAttribs);
}
@@ -114,7 +114,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!qt_createEGLSurfaceForPixmap(argbPixmapData, false))
break;
- haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
+ haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
(EGLSurface)argbPixmapData->gl_surface,
(EGLSurface)argbPixmapData->gl_surface,
qPixmapARGBSharedEglContext);
@@ -134,7 +134,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!qt_createEGLSurfaceForPixmap(rgbPixmapData, false))
break;
- haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
+ haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
(EGLSurface)rgbPixmapData->gl_surface,
(EGLSurface)rgbPixmapData->gl_surface,
qPixmapRGBSharedEglContext);
@@ -147,7 +147,7 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
} while (0);
if (qPixmapARGBSharedEglContext || qPixmapRGBSharedEglContext) {
- eglMakeCurrent(QEglContext::defaultDisplay(0),
+ eglMakeCurrent(QEglContext::display(),
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
@@ -167,12 +167,12 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (!haveX11Pixmaps) {
// Clean up the context(s) if we can't use X11GL pixmaps
if (qPixmapARGBSharedEglContext != EGL_NO_CONTEXT)
- eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapARGBSharedEglContext);
+ eglDestroyContext(QEglContext::display(), qPixmapARGBSharedEglContext);
if (qPixmapRGBSharedEglContext != qPixmapARGBSharedEglContext &&
qPixmapRGBSharedEglContext != EGL_NO_CONTEXT)
{
- eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapRGBSharedEglContext);
+ eglDestroyContext(QEglContext::display(), qPixmapRGBSharedEglContext);
}
qPixmapRGBSharedEglContext = EGL_NO_CONTEXT;
qPixmapARGBSharedEglContext = EGL_NO_CONTEXT;
@@ -212,7 +212,6 @@ QPaintEngine* QX11GLPixmapData::paintEngine() const
ctx = new QGLContext(glFormat());
if (ctx->d_func()->eglContext == 0)
ctx->d_func()->eglContext = new QEglContext();
- ctx->d_func()->eglContext->openDisplay(0); // ;-)
ctx->d_func()->eglContext->setApi(QEgl::OpenGL);
ctx->d_func()->eglContext->setContext(hasAlphaChannel() ? qPixmapARGBSharedEglContext
: qPixmapRGBSharedEglContext);
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index d92870f..9c44545 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -225,10 +225,6 @@ static QEglContext *createContext(QPaintDevice *device)
// Create the context object and open the display.
context = new QEglContext();
context->setApi(QEgl::OpenVG);
- if (!context->openDisplay(device)) {
- delete context;
- return 0;
- }
// Set the swap interval for the display.
QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL");