summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp9
-rw-r--r--src/opengl/qgl_mac.mm2
-rw-r--r--src/opengl/qgl_p.h4
-rw-r--r--src/opengl/qglpixelbuffer_x11.cpp6
-rw-r--r--src/opengl/qglpixmapfilter.cpp1
5 files changed, 17 insertions, 5 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 3e5c4fc..cfcbbf8 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -99,6 +99,10 @@ QT_BEGIN_NAMESPACE
QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs;
#endif
+#ifdef Q_WS_X11
+extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
+#endif
+
struct QGLThreadContext {
QGLContext *context;
};
@@ -2448,7 +2452,10 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
#if defined(Q_WS_X11)
// Try to use texture_from_pixmap
- if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType) {
+ const QX11Info *xinfo = qt_x11Info(paintDevice);
+ if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType
+ && xinfo && xinfo->screen() == pixmap.x11Info().screen())
+ {
texture = bindTextureFromNativePixmap(pd, key, options);
if (texture) {
texture->options |= QGLContext::MemoryManagedBindOption;
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index c01575b..4d7532e 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -951,8 +951,6 @@ void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget *shareWidget)
break;
current = current->parentWidget();
}
-
- isGLWidget = 1;
}
bool QGLWidgetPrivate::renderCxPm(QPixmap*)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 18fc9c2..efd2090 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -173,7 +173,9 @@ public:
#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
, eglSurfaceWindowId(0)
#endif
- {}
+ {
+ isGLWidget = 1;
+ }
~QGLWidgetPrivate() {}
diff --git a/src/opengl/qglpixelbuffer_x11.cpp b/src/opengl/qglpixelbuffer_x11.cpp
index 5b34cbb..32a42a2 100644
--- a/src/opengl/qglpixelbuffer_x11.cpp
+++ b/src/opengl/qglpixelbuffer_x11.cpp
@@ -181,7 +181,11 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
qt_format_to_attrib_list(f, attribs);
- GLXFBConfig *configs = glXChooseFBConfig(X11->display, X11->defaultScreen, attribs, &num_configs);
+ int screen = X11->defaultScreen;
+ if (shareWidget)
+ screen = shareWidget->x11Info().screen();
+
+ GLXFBConfig *configs = glXChooseFBConfig(X11->display, screen, attribs, &num_configs);
if (configs && num_configs) {
int res;
glXGetFBConfigAttrib(X11->display, configs[0], GLX_LEVEL, &res);
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 37bb7c0..d5a11d9 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -394,6 +394,7 @@ void QGLBlurTextureCache::insertBlurTextureInfo(const QPixmap &pixmap, QGLBlurTe
static bool hookAdded = false;
if (!hookAdded) {
QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed);
+ QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed);
hookAdded = true;
}