diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-05 13:01:42 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-05-05 13:01:42 (GMT) |
commit | 0ca404def7262ad7293592bbb7888a6df5ea27b7 (patch) | |
tree | bdb81cd468bfcc1bb957c2ab9768b89c51c01525 /src/opengl | |
parent | d1ac6af4f30e822e161fd8772104aa2e30e55a2f (diff) | |
parent | 2d8852d51b15ed48e8e665882b5d70c298201299 (diff) | |
download | Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.zip Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.gz Qt-0ca404def7262ad7293592bbb7888a6df5ea27b7.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging:
Compile on Windows
Support gamma correction of text on GL
Remove QFontEngineFT::loadGlyphMetrics
Make autotest more resilient against network timeout
Do not filter adhoc clients
Lancelot: Add configurable client filtering to baseline server
Improve error reporting on failure to connect to baseline server
Fixed bug in X11 backend when creating translucent windows.
Only cleanup share widget if it has been created.
Add required font metrics functions to QRawFont
Fixed bug in QPdfEngine::addImage causing mono images to be made 32 bit
Make pixel size a qreal in QRawFont
Make sure removed QTextBlock is invalid
Make sure QFont's resolve mask is copied on compilers with C++0x support
Fix glyph position issue with fallback fonts
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 31 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 7 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 3 | ||||
-rw-r--r-- | src/opengl/qglextensions_p.h | 8 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 12 |
5 files changed, 55 insertions, 6 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a2707e0..38bd58d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1554,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, @@ -1792,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) { @@ -1815,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, @@ -1992,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_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/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/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 8494283..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() |