diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager.cpp | 2 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadersource_p.h | 18 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 39 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 7 | ||||
-rw-r--r-- | src/opengl/qgl.h | 2 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 3 | ||||
-rw-r--r-- | src/opengl/qgl_symbian.cpp | 30 | ||||
-rw-r--r-- | src/opengl/qgl_x11egl.cpp | 14 | ||||
-rw-r--r-- | src/opengl/qglextensions_p.h | 8 | ||||
-rw-r--r-- | src/opengl/qglfunctions.cpp | 33 | ||||
-rw-r--r-- | src/opengl/qgraphicssystem_gl.cpp | 10 | ||||
-rw-r--r-- | src/opengl/qgraphicssystem_gl_p.h | 13 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 60 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 23 |
15 files changed, 176 insertions, 88 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp index 8068aa8..207ab3d 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp +++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp @@ -495,6 +495,8 @@ GLuint QGLEngineShaderManager::getUniformLocation(Uniform id) "fmp", "fmp2_m_radius2", "inverse_2_fmp2_m_radius2", + "sqrfr", + "bradius", "invertedTextureSize", "brushTransform", "brushTexture", diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 7cc9dc3..bf2fe42 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -442,6 +442,8 @@ public: Fmp, Fmp2MRadius2, Inverse2Fmp2MRadius2, + SqrFr, + BRadius, InvertedTextureSize, BrushTransform, BrushTexture, diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index fc8b9ef..9362c58 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -241,6 +241,7 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\n\ uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ + uniform highp vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -253,7 +254,7 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\n\ mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \n\ gl_Position = vec4(gl_Position.xy * invertedHTexCoordsZ, 0.0, invertedHTexCoordsZ); \n\ A = hTexCoords.xy * invertedHTexCoordsZ; \n\ - b = 2.0 * dot(A, fmp); \n\ + b = bradius.x + 2.0 * dot(A, fmp); \n\ }\n"; static const char* const qglslAffinePositionWithRadialGradientBrushVertexShader @@ -263,13 +264,22 @@ static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ uniform sampler2D brushTexture; \n\ uniform highp float fmp2_m_radius2; \n\ uniform highp float inverse_2_fmp2_m_radius2; \n\ + uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ + uniform highp vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ - highp float c = -dot(A, A); \n\ - highp vec2 val = vec2((-b + sqrt(b*b - 4.0*fmp2_m_radius2*c)) * inverse_2_fmp2_m_radius2, 0.5); \n\ - return texture2D(brushTexture, val); \n\ + highp float c = sqrfr-dot(A, A); \n\ + highp float det = b*b - 4.0*fmp2_m_radius2*c; \n\ + lowp vec4 result = vec4(0.0); \n\ + if (det >= 0.0) { \n\ + highp float detSqrt = sqrt(det); \n\ + highp float w = max((-b - detSqrt) * inverse_2_fmp2_m_radius2, (-b + detSqrt) * inverse_2_fmp2_m_radius2); \n\ + if (bradius.y + w * bradius.z >= 0.0) \n\ + result = texture2D(brushTexture, vec2(w, 0.5)); \n\ + } \n\ + return result; \n\ }\n"; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 18c684f..38bd58d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -301,7 +301,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() const QRadialGradient *g = static_cast<const QRadialGradient *>(currentBrush.gradient()); QPointF realCenter = g->center(); QPointF realFocal = g->focalPoint(); - qreal realRadius = g->radius(); + qreal realRadius = g->centerRadius() - g->focalRadius(); translationPoint = realFocal; QPointF fmp = realCenter - realFocal; @@ -311,6 +311,12 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Fmp2MRadius2), fmp2_m_radius2); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::Inverse2Fmp2MRadius2), GLfloat(1.0 / (2.0*fmp2_m_radius2))); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::SqrFr), + GLfloat(g->focalRadius() * g->focalRadius())); + shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::BRadius), + GLfloat(2 * (g->centerRadius() - g->focalRadius()) * g->focalRadius()), + g->focalRadius(), + g->centerRadius() - g->focalRadius()); QVector2D halfViewportSize(width*0.5, height*0.5); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::HalfViewportSize), halfViewportSize); @@ -1548,6 +1554,14 @@ namespace { } +#if defined(Q_WS_WIN) +static bool fontSmoothingApproximately(qreal target) +{ + extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp + return (qAbs(qt_fontsmoothing_gamma - target) < 0.2); +} +#endif + // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, @@ -1786,7 +1800,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); prepareForDraw(false); // Text always causes src pixels to be transparent } - //### TODO: Gamma correction QGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QGLTextureGlyphCache::Linear:QGLTextureGlyphCache::Nearest; if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) { @@ -1809,12 +1822,31 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } } + bool srgbFrameBufferEnabled = false; + if (ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer) { +#if defined(Q_WS_MAC) + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) +#elif defined(Q_WS_WIN) + if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1)) +#else + if (false) +#endif + { + glEnable(FRAMEBUFFER_SRGB_EXT); + srgbFrameBufferEnabled = true; + } + } + #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #else glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif + + if (srgbFrameBufferEnabled) + glDisable(FRAMEBUFFER_SRGB_EXT); + } void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, @@ -1986,7 +2018,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) #if !defined(QT_OPENGL_ES_2) #if defined(Q_WS_WIN) - if (qt_cleartype_enabled) + if (qt_cleartype_enabled + && (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1))) #endif #if defined(Q_WS_MAC) if (qt_applefontsmoothing_enabled) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 057fb55..099cc00 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5490,6 +5490,13 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() if (extensions.match("GL_EXT_bgra")) glExtensions |= BGRATextureFormat; + { + GLboolean srgbCapableFramebuffers; + glGetBooleanv(FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers); + if (srgbCapableFramebuffers) + glExtensions |= SRGBFrameBuffer; + } + return glExtensions; } diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index c57995d..ab88d9c 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -401,7 +401,7 @@ protected: #if defined(Q_WS_WIN) virtual int choosePixelFormat(void* pfd, HDC pdc); #endif -#if defined(Q_WS_X11) && defined(QT_NO_EGL) +#if defined(Q_WS_X11) virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1); virtual void* chooseVisual(); #endif diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 50d13c9..ac54e2f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -288,7 +288,8 @@ public: PVRTCTextureCompression = 0x00020000, FragmentShader = 0x00040000, ElementIndexUint = 0x00080000, - Depth24 = 0x00100000 + Depth24 = 0x00100000, + SRGBFrameBuffer = 0x00200000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index 1b41db4..ab37977 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -49,6 +49,9 @@ #include <private/qpaintengine_opengl_p.h> #include <private/qwidget_p.h> // to access QWExtra #include <private/qnativeimagehandleprovider_p.h> +#include <private/qapplication_p.h> +#include <private/qgraphicssystem_p.h> +#include <private/qgraphicssystemex_symbian_p.h> #include "qgl_egl_p.h" #include "qpixmapdata_gl_p.h" #include "qgltexturepool_p.h" @@ -180,6 +183,15 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); + QGraphicsSystemEx *ex = QApplicationPrivate::graphicsSystem()->platformExtension(); + QSymbianGraphicsSystemEx *symex = static_cast<QSymbianGraphicsSystemEx*>(ex); + if (symex && !symex->hasBCM2727()) { + // Most likely we have hw support for multisampling + // so let's enable it. + d->glFormat.setSampleBuffers(1); + d->glFormat.setSamples(4); + } + // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat // has the alpha channel option set: if (devType == QInternal::Widget) { @@ -229,20 +241,20 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->eglSurface = QEgl::createSurface(device(), d->eglContext->config()); - eglGetError(); // Clear error state first. + eglGetError(); // Clear error state first. #ifdef QGL_NO_PRESERVED_SWAP - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); + eglSurfaceAttrib(QEgl::display(), d->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable destroyed swap behaviour"); + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLContext: could not enable destroyed swap behaviour"); #else - eglSurfaceAttrib(QEgl::display(), d->eglSurface, - EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + eglSurfaceAttrib(QEgl::display(), d->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); - if (eglGetError() != EGL_SUCCESS) - qWarning("QGLContext: could not enable preserved swap behaviour"); + if (eglGetError() != EGL_SUCCESS) + qWarning("QGLContext: could not enable preserved swap behaviour"); #endif setWindowCreated(true); diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 2ddfd35..34ca97d 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -257,6 +257,20 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) return true; } +void *QGLContext::chooseVisual() +{ + qFatal("QGLContext::chooseVisual - this method must not be called as Qt is built with EGL support"); + return 0; +} + +void *QGLContext::tryVisual(const QGLFormat& f, int bufDepth) +{ + Q_UNUSED(f); + Q_UNUSED(bufDepth); + qFatal("QGLContext::tryVisual - this method must not be called as Qt is built with EGL support"); + return 0; +} + void QGLWidget::resizeEvent(QResizeEvent *) { Q_D(QGLWidget); diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 529c7a1..ac80ce8 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -477,6 +477,14 @@ struct QGLExtensionFuncs // OpenGL constants +#ifndef FRAMEBUFFER_SRGB_CAPABLE_EXT +#define FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif + +#ifndef FRAMEBUFFER_SRGB_EXT +#define FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif + #ifndef GL_ARRAY_BUFFER #define GL_ARRAY_BUFFER 0x8892 #endif diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index be8219a..9137e0f 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -211,19 +211,24 @@ QGLFunctions::QGLFunctions(const QGLContext *context) static int qt_gl_resolve_features() { #if defined(QT_OPENGL_ES_2) - return QGLFunctions::Multitexture | - QGLFunctions::Shaders | - QGLFunctions::Buffers | - QGLFunctions::Framebuffers | - QGLFunctions::BlendColor | - QGLFunctions::BlendEquation | - QGLFunctions::BlendEquationSeparate | - QGLFunctions::BlendFuncSeparate | - QGLFunctions::BlendSubtract | - QGLFunctions::CompressedTextures | - QGLFunctions::Multisample | - QGLFunctions::StencilSeparate | - QGLFunctions::NPOTTextures; + int features = QGLFunctions::Multitexture | + QGLFunctions::Shaders | + QGLFunctions::Buffers | + QGLFunctions::Framebuffers | + QGLFunctions::BlendColor | + QGLFunctions::BlendEquation | + QGLFunctions::BlendEquationSeparate | + QGLFunctions::BlendFuncSeparate | + QGLFunctions::BlendSubtract | + QGLFunctions::CompressedTextures | + QGLFunctions::Multisample | + QGLFunctions::StencilSeparate; + QGLExtensionMatcher extensions; + if (extensions.match("GL_OES_texture_npot")) + features |= QGLFunctions::NPOTTextures; + if (extensions.match("GL_IMG_texture_npot")) + features |= QGLFunctions::NPOTTextures; + return features; #elif defined(QT_OPENGL_ES) int features = QGLFunctions::Multitexture | QGLFunctions::Buffers | @@ -240,6 +245,8 @@ static int qt_gl_resolve_features() features |= QGLFunctions::BlendSubtract; if (extensions.match("GL_OES_texture_npot")) features |= QGLFunctions::NPOTTextures; + if (extensions.match("GL_IMG_texture_npot")) + features |= QGLFunctions::NPOTTextures; return features; #else int features = 0; diff --git a/src/opengl/qgraphicssystem_gl.cpp b/src/opengl/qgraphicssystem_gl.cpp index 0aa3c2e..5a01d8c 100644 --- a/src/opengl/qgraphicssystem_gl.cpp +++ b/src/opengl/qgraphicssystem_gl.cpp @@ -104,11 +104,17 @@ QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const return new QGLWindowSurface(widget); } -#ifdef QGL_USE_TEXTURE_POOL -void QGLGraphicsSystem::releaseCachedResources() +#ifdef Q_OS_SYMBIAN +void QGLGraphicsSystem::releaseCachedGpuResources() { QGLTexturePool::instance()->hibernate(); } + +QGraphicsSystemEx* QGLGraphicsSystem::platformExtension() +{ + return this; +} #endif + QT_END_NAMESPACE diff --git a/src/opengl/qgraphicssystem_gl_p.h b/src/opengl/qgraphicssystem_gl_p.h index 5829dcc..5372443 100644 --- a/src/opengl/qgraphicssystem_gl_p.h +++ b/src/opengl/qgraphicssystem_gl_p.h @@ -55,11 +55,19 @@ #include "private/qgraphicssystem_p.h" +#ifdef Q_OS_SYMBIAN +#include "private/qgraphicssystemex_symbian_p.h" +#endif + #include <QMap> QT_BEGIN_NAMESPACE class Q_OPENGL_EXPORT QGLGraphicsSystem : public QGraphicsSystem +#ifdef Q_OS_SYMBIAN + , public QSymbianGraphicsSystemEx +#endif + { public: QGLGraphicsSystem(bool useX11GL); @@ -67,8 +75,9 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; -#ifdef QGL_USE_TEXTURE_POOL - void releaseCachedResources(); +#ifdef Q_OS_SYMBIAN + void releaseCachedGpuResources(); + QGraphicsSystemEx* platformExtension(); #endif private: bool m_useX11GL; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 9da811a..58ce6f8 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2119,6 +2119,7 @@ void QOpenGLPaintEnginePrivate::fillPath(const QPainterPath &path) updateGLMatrix(); } +Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush); static inline bool needsEmulation(Qt::BrushStyle style) { @@ -2129,9 +2130,11 @@ static inline bool needsEmulation(Qt::BrushStyle style) void QOpenGLPaintEnginePrivate::updateUseEmulation() { - use_emulation = !use_fragment_programs - && ((has_pen && needsEmulation(pen_brush_style)) - || (has_brush && needsEmulation(brush_style))); + use_emulation = (!use_fragment_programs + && ((has_pen && needsEmulation(pen_brush_style)) + || (has_brush && needsEmulation(brush_style)))) + || (has_pen && qt_isExtendedRadialGradient(cpen.brush())) + || (has_brush && qt_isExtendedRadialGradient(cbrush)); } void QOpenGLPaintEngine::updatePen(const QPen &pen) @@ -5447,50 +5450,7 @@ void QOpenGLPaintEngine::transformChanged() updateMatrix(state()->matrix); } -static QPainterPath painterPathFromVectorPath(const QVectorPath &path) -{ - const qreal *points = path.points(); - const QPainterPath::ElementType *types = path.elements(); - - QPainterPath p; - if (types) { - int id = 0; - for (int i=0; i<path.elementCount(); ++i) { - switch(types[i]) { - case QPainterPath::MoveToElement: - p.moveTo(QPointF(points[id], points[id+1])); - id+=2; - break; - case QPainterPath::LineToElement: - p.lineTo(QPointF(points[id], points[id+1])); - id+=2; - break; - case QPainterPath::CurveToElement: { - QPointF p1(points[id], points[id+1]); - QPointF p2(points[id+2], points[id+3]); - QPointF p3(points[id+4], points[id+5]); - p.cubicTo(p1, p2, p3); - id+=6; - break; - } - case QPainterPath::CurveToDataElement: - ; - break; - } - } - } else { - p.moveTo(QPointF(points[0], points[1])); - int id = 2; - for (int i=1; i<path.elementCount(); ++i) { - p.lineTo(QPointF(points[id], points[id+1])); - id+=2; - } - } - if (path.hints() & QVectorPath::WindingFill) - p.setFillRule(Qt::WindingFill); - - return p; -} +Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path); void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { @@ -5499,11 +5459,11 @@ void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush) if (brush.style() == Qt::NoBrush) return; - if (!d->use_fragment_programs && needsEmulation(brush.style())) { + if ((!d->use_fragment_programs && needsEmulation(brush.style())) || qt_isExtendedRadialGradient(brush)) { QPainter *p = painter(); QBrush oldBrush = p->brush(); p->setBrush(brush); - qt_draw_helper(p->d_ptr.data(), painterPathFromVectorPath(path), QPainterPrivate::FillDraw); + qt_draw_helper(p->d_ptr.data(), qt_painterPathFromVectorPath(path), QPainterPrivate::FillDraw); p->setBrush(oldBrush); return; } @@ -5520,7 +5480,7 @@ void QOpenGLPaintEngine::fill(const QVectorPath &path, const QBrush &brush) drawRects(&r, 1); updatePen(old_pen); } else { - d->fillPath(painterPathFromVectorPath(path)); + d->fillPath(qt_painterPathFromVectorPath(path)); } updateBrush(old_brush, state()->brushOrigin); diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 56e2c3b..49b3dc2 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -184,7 +184,9 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) class QGLGlobalShareWidget { public: - QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {} + QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) { + created = true; + } QGLWidget *shareWidget() { if (!initializing && !widget && !cleanedUp) { @@ -223,6 +225,7 @@ public: } static bool cleanedUp; + static bool created; QGLPixmapData *firstPixmap; int widgetRefCount; @@ -233,6 +236,7 @@ private: }; bool QGLGlobalShareWidget::cleanedUp = false; +bool QGLGlobalShareWidget::created = false; static void qt_cleanup_gl_share_widget(); Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget, @@ -242,7 +246,8 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget, static void qt_cleanup_gl_share_widget() { - _qt_gl_share_widget()->cleanup(); + if (QGLGlobalShareWidget::created) + _qt_gl_share_widget()->cleanup(); } QGLWidget* qt_gl_share_widget() @@ -254,7 +259,8 @@ QGLWidget* qt_gl_share_widget() void qt_destroy_gl_share_widget() { - _qt_gl_share_widget()->destroy(); + if (QGLGlobalShareWidget::created) + _qt_gl_share_widget()->destroy(); } const QGLContext *qt_gl_share_context() @@ -610,6 +616,17 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & if (!d_ptr->destructive_swap_buffers && !d_ptr->did_paint) return; +#ifdef Q_OS_SYMBIAN + if (window() != widget) { + // For performance reasons we don't support + // flushing native child widgets on Symbian. + // It breaks overlapping native child widget + // rendering in some cases but we prefer performance. + return; + } +#endif + + QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); |