summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp')
-rw-r--r--Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
index 1bbeb73b9..2fd6cba46 100644
--- a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
+++ b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp
@@ -107,8 +107,18 @@ struct GraphicsSurfacePrivate {
, m_textureIsYInverted(false)
, m_hasAlpha(false)
{
+ QSurface* currentSurface = 0;
+ QOpenGLContext* currentContext = QOpenGLContext::currentContext();
+ if (currentContext)
+ currentSurface = currentContext->surface();
+
m_display = XOpenDisplay(0);
m_glContext->create();
+
+ // The GLX implementation of QOpenGLContext will reset the current context when create is being called.
+ // Therefore we have to make the previous context current again.
+ if (currentContext)
+ currentContext->makeCurrent(currentSurface);
}
~GraphicsSurfacePrivate()
@@ -237,9 +247,9 @@ static bool resolveGLMethods(GraphicsSurfacePrivate* p)
return resolved;
}
-uint64_t GraphicsSurface::platformExport()
+GraphicsSurfaceToken GraphicsSurface::platformExport()
{
- return m_platformSurface;
+ return GraphicsSurfaceToken(m_platformSurface);
}
uint32_t GraphicsSurface::platformGetTextureID()
@@ -316,7 +326,7 @@ PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size,
return surface;
}
-PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint64_t token)
+PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, const GraphicsSurfaceToken& token)
{
// X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested.
// GraphicsSurfaceGLX uses an XWindow as native surface. This one always has a front and a back buffer.
@@ -330,7 +340,7 @@ PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size,
if (!resolveGLMethods(surface->m_private))
return PassRefPtr<GraphicsSurface>();
- surface->m_platformSurface = token;
+ surface->m_platformSurface = token.frontBufferHandle;
surface->m_private->createPixmap(surface->m_platformSurface);
surface->m_size = surface->m_private->size();