diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-10-16 14:01:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-10-16 14:18:58 +0200 |
commit | ec1b382255b635889828c03c0806fa9089a6cd7c (patch) | |
tree | 8271002141472006a0c0c884a5e25fd49719ad43 | |
parent | a018bd8f103707b5762b262ceaeec66d50f56cc0 (diff) | |
download | qtwebkit-ec1b382255b635889828c03c0806fa9089a6cd7c.tar.gz |
Fix Qt 5.3 backward compatible build
The accelerated canvas and dynamic GL support used Qt 5.4 specific
features. These can be avoided by disabling one webgl extension and
being less efficient in accelerated canvas, thereby making it possible
to still build QtWebKit with Qt 5.3.
Change-Id: Ic64f7f5ac6b836b314331c4d509e4d64cb0dcb7c
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
4 files changed, 29 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp index 7c326f593..f7ab46b64 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp @@ -38,8 +38,10 @@ #include <OpenGL/gl.h> #elif PLATFORM(QT) #include <private/qopenglextensions_p.h> +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) #include <private/qopenglvertexarrayobject_p.h> -#elif PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(QT) || PLATFORM(WIN) +#endif +#elif PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN) #include "OpenGLShims.h" #endif @@ -50,7 +52,7 @@ namespace WebCore { Extensions3DOpenGL::Extensions3DOpenGL(GraphicsContext3D* context) : Extensions3DOpenGLCommon(context) { -#if PLATFORM(QT) +#if PLATFORM(QT) && QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) context->makeContextCurrent(); m_vaoFunctions = new QOpenGLVertexArrayObjectHelper(context->platformGraphicsContext3D()); #endif @@ -58,7 +60,7 @@ Extensions3DOpenGL::Extensions3DOpenGL(GraphicsContext3D* context) Extensions3DOpenGL::~Extensions3DOpenGL() { -#if PLATFORM(QT) +#if PLATFORM(QT) && QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) delete m_vaoFunctions; m_vaoFunctions = 0; #endif @@ -90,8 +92,10 @@ Platform3DObject Extensions3DOpenGL::createVertexArrayOES() if (isVertexArrayObjectSupported()) glGenVertexArrays(1, &array); #elif PLATFORM(QT) +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) if (isVertexArrayObjectSupported()) m_vaoFunctions->glGenVertexArrays(1, &array); +#endif #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object glGenVertexArraysAPPLE(1, &array); #endif @@ -108,8 +112,10 @@ void Extensions3DOpenGL::deleteVertexArrayOES(Platform3DObject array) if (isVertexArrayObjectSupported()) glDeleteVertexArrays(1, &array); #elif PLATFORM(QT) +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) if (isVertexArrayObjectSupported()) m_vaoFunctions->glDeleteVertexArrays(1, &array); +#endif #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object glDeleteVertexArraysAPPLE(1, &array); #endif @@ -124,9 +130,11 @@ GC3Dboolean Extensions3DOpenGL::isVertexArrayOES(Platform3DObject array) #if (PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN)) if (isVertexArrayObjectSupported()) return glIsVertexArray(array); -#elif PLATFORM(QT) && QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) +#elif PLATFORM(QT) +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) if (isVertexArrayObjectSupported()) return m_vaoFunctions->glIsVertexArray(array); +#endif #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object return glIsVertexArrayAPPLE(array); #endif @@ -142,8 +150,10 @@ void Extensions3DOpenGL::bindVertexArrayOES(Platform3DObject array) if (isVertexArrayObjectSupported()) glBindVertexArray(array); #elif PLATFORM(QT) +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) if (isVertexArrayObjectSupported()) m_vaoFunctions->glBindVertexArray(array); +#endif #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object glBindVertexArrayAPPLE(array); #else @@ -270,7 +280,11 @@ bool Extensions3DOpenGL::isVertexArrayObjectSupported() #elif PLATFORM(QT) bool Extensions3DOpenGL::isVertexArrayObjectSupported() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) return m_vaoFunctions && m_vaoFunctions->isValid(); +#else + return false; +#endif } #endif diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h index 45eacea6a..cf68fcbd9 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h @@ -71,7 +71,7 @@ private: bool isVertexArrayObjectSupported(); #endif -#if PLATFORM(QT) +#if PLATFORM(QT) && QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) QOpenGLVertexArrayObjectHelper *m_vaoFunctions; #endif }; diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp index 827f436c8..ca404869a 100644 --- a/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageBufferDataQt.cpp @@ -274,8 +274,11 @@ void ImageBufferDataPrivateAccelerated::paintToTextureMapper(TextureMapper* text } invalidateState(); - +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) static_cast<TextureMapperGL*>(textureMapper)->drawTexture(m_paintDevice->texture(), TextureMapperGL::ShouldBlend, m_paintDevice->size(), targetRect, matrix, opacity); +#else + static_cast<TextureMapperGL*>(textureMapper)->drawTexture(m_paintDevice->texture(), TextureMapperGL::ShouldBlend | TextureMapperGL::ShouldFlipTexture, m_paintDevice->size(), targetRect, matrix, opacity); +#endif } #if USE(GRAPHICS_SURFACE) diff --git a/Source/WebCore/platform/graphics/qt/QFramebufferPaintDevice.cpp b/Source/WebCore/platform/graphics/qt/QFramebufferPaintDevice.cpp index a4c088cbf..6d5936956 100644 --- a/Source/WebCore/platform/graphics/qt/QFramebufferPaintDevice.cpp +++ b/Source/WebCore/platform/graphics/qt/QFramebufferPaintDevice.cpp @@ -26,7 +26,9 @@ QFramebufferPaintDevice::QFramebufferPaintDevice(const QSize& size) , m_framebufferObject(size, QOpenGLFramebufferObject::CombinedDepthStencil) { m_surface = QOpenGLContext::currentContext()->surface(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) setPaintFlipped(true); +#endif m_framebufferObject.bind(); context()->functions()->glClearColor(0, 0, 0, 0); context()->functions()->glClear(GL_COLOR_BUFFER_BIT); @@ -47,7 +49,11 @@ QImage QFramebufferPaintDevice::toImage() const context()->makeCurrent(m_surface); +#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) QImage image = m_framebufferObject.toImage(false); +#else + QImage image = m_framebufferObject.toImage(); +#endif if (currentContext) currentContext->makeCurrent(currentSurface); |