From 1acc9bcf4c43851af2096539eda88da9ef58bce3 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Mar 2010 10:05:10 +0200 Subject: Avoid taking sqrt of negative number in FT font engine When using a reflecting matrix, the determinant will be -1, thus the call to sqrt() will return NaN. Same fix as in 0fa878c4d2. Task-number: QTBUG-9442 Reviewed-by: Trond --- src/gui/text/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index a9def8e..449dffd 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1368,7 +1368,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadTransformedGlyphSet(const QTransfor if (!gs) { // don't try to load huge fonts - bool draw_as_outline = fontDef.pixelSize * qSqrt(matrix.det()) >= 64; + bool draw_as_outline = fontDef.pixelSize * qSqrt(qAbs(matrix.det())) >= 64; if (draw_as_outline) return 0; -- cgit v0.12 From 68037d915cb5f8070c89c70fe741982340def79e Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 14 Apr 2010 14:04:48 +0200 Subject: Fix gcc compile warning in qstatictext.cpp Synchronize order of initialization with order of declaration. Reviewed-by: TrustMe --- src/gui/text/qstatictext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 6c504a7..06b0d3b 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -363,7 +363,7 @@ QSizeF QStaticText::size() const } QStaticTextPrivate::QStaticTextPrivate() - : items(0), itemCount(0), glyphPool(0), positionPool(0), textWidth(-1.0), + : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText) { } -- cgit v0.12 From 9ad274406a0f893f9a595aac7031deac2b25afbd Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 13 Apr 2010 12:40:35 +0200 Subject: Print more information when debugging X11 Visual selection Reviewed-By: TrustMe --- src/gui/egl/qegl_x11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 5341ea1..cb8dcda 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -210,6 +210,11 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) } XFree(chosenVisualInfo); } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) @@ -263,6 +268,11 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) # endif // QT_DEBUG_X11_VISUAL_SELECTION return visualId; } +# ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("Failed to find an XVisual which matches EGL config %d using XRender", configId); +# endif // QT_DEBUG_X11_VISUAL_SELECTION + #endif //!defined(QT_NO_XRENDER) -- cgit v0.12 From b331a74b8fd71ba803e2cf2a9e0c49e1d3538f40 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 13 Apr 2010 14:51:51 +0200 Subject: Support building with desktop OpenGL managed via EGL This mostly replaces lots of QT_OPENGL_ES defines with QT_NO_EGL instead. It also switches off EGL auto-detection by default. This is to make sure we default to using GLX on systems with both EGL and desktop OpenGL. If -opengl es1|es2 or -openvg is specified, then EGL auto-detection is switched back on (as a requirement. If configure auto-detects OpenGL ES it also switches on EGL auto-detection, but failue then just disables both EGL & OpenGL. As a side effect, this patch also fixes building Qt when both EGL and glx are avaliable, as they are in Mesa >= 7.8.0. Reviewed-by: Trond Task-number: QTBUG-9691 --- configure | 138 +++++++++++++++++++++++++---------------- src/gui/egl/qegl.cpp | 9 ++- src/gui/egl/qeglproperties.cpp | 27 +++++--- src/opengl/opengl.pro | 2 +- src/opengl/qgl.cpp | 8 +-- src/opengl/qgl.h | 2 +- src/opengl/qgl_p.h | 10 +-- src/opengl/qglpixelbuffer.cpp | 6 +- src/opengl/qglpixelbuffer_p.h | 12 ++-- 9 files changed, 130 insertions(+), 84 deletions(-) diff --git a/configure b/configure index 5478d06..a78e9ac 100755 --- a/configure +++ b/configure @@ -937,7 +937,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-mediaservice|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-mediaservice|-audio-backend|-svg|-declarative|-webkit|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1246,6 +1246,9 @@ while [ "$#" -gt 0 ]; do [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then CFG_OPENGL="$VAL" + if [ "$VAL" = "es1" ] || [ "$VAL" = "es2" ]; then + CFG_EGL="yes" + fi else UNKNOWN_OPT=yes fi @@ -1253,6 +1256,7 @@ while [ "$#" -gt 0 ]; do openvg) if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_OPENVG="$VAL" + CFG_EGL="auto" else UNKNOWN_OPT=yes fi @@ -1569,6 +1573,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + egl) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_EGL="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; stl) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_STL="$VAL" @@ -3810,6 +3821,12 @@ Qt/X11 only: -system-nas-sound .. Use NAS libaudio from the operating system. See http://radscan.com/nas.html + -egl ............... Use EGL instead of GLX to manage contexts. + When building for desktop OpenGL, this option will + make Qt use EGL to manage contexts rather than the + GLX, which is the default. Note: For OpenGL ES, EGL + is always used. + -no-opengl ......... Do not support OpenGL. + -opengl ...... Enable OpenGL support. With no parameter, this will auto-detect the "best" @@ -3817,8 +3834,6 @@ Qt/X11 only: will be used. Use desktop, es1, or es2 for to force the use of the Desktop (OpenGL 1.x or 2.x), OpenGL ES 1.x Common profile, or 2.x APIs instead. - On X11, the EGL API will be used to manage GL - contexts in the case of OpenGL ES -no-openvg ........ Do not support OpenVG. + -openvg ........... Enable OpenVG support. @@ -5121,26 +5136,6 @@ fi if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then - # detect EGL support - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then - # EGL specified by QMAKE_*_EGL, included with - CFG_EGL=yes - CFG_EGL_GLES_INCLUDES=no - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then - # EGL specified by QMAKE_*_EGL, included with - CFG_EGL=yes - CFG_EGL_GLES_INCLUDES=yes - fi - if ( [ "$CFG_OPENGL" = "es1" ] || [ "$CFG_OPENGL" = "es2" ] ) && [ "$CFG_EGL" != "yes" ]; then - echo "The EGL functionality test failed!" - echo " EGL is required for OpenGL ES to manage contexts & surfaces." - echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in" - echo " ${XQMAKESPEC}." - exit 1 - fi - - # auto-detect Glib support if [ "$CFG_GLIB" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then @@ -5332,8 +5327,14 @@ if [ "$PLATFORM_X11" = "yes" ]; then CFG_OPENGL=desktop elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es2 - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + if [ "$CFG_EGL" = "no" ]; then + CFG_EGL=auto + fi + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es1 + if [ "$CFG_EGL" = "no" ]; then + CFG_EGL=auto + fi else if [ "$CFG_OPENGL" = "yes" ]; then echo "All the OpenGL functionality tests failed!" @@ -5344,24 +5345,24 @@ if [ "$PLATFORM_X11" = "yes" ]; then fi CFG_OPENGL=no fi - case "$PLATFORM" in - hpux*) - # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct. - if [ "$CFG_OPENGL" = "desktop" ]; then - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS - if [ $? != "0" ]; then - QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT - fi - fi - ;; - *) - ;; - esac + case "$PLATFORM" in + hpux*) + # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct. + if [ "$CFG_OPENGL" = "desktop" ]; then + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/glxfbconfig "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS + if [ $? != "0" ]; then + QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT + fi + fi + ;; + *) + ;; + esac elif [ "$CFG_OPENGL" = "es1" ]; then # OpenGL ES 1.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 1.x functionality test failed!" + echo "The OpenGL ES 1.x functionality test failed!" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL_ES1, QMAKE_LIBDIR_OPENGL_ES1 and QMAKE_LIBS_OPENGL_ES1 in" echo " ${XQMAKESPEC}." @@ -5369,9 +5370,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 2.0 functionality test failed!" + echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in" echo " ${XQMAKESPEC}." @@ -5381,7 +5382,7 @@ if [ "$PLATFORM_X11" = "yes" ]; then # Desktop OpenGL support "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/opengl "OpenGL" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS if [ $? != "0" ]; then - echo "The OpenGL functionality test failed!" + echo "The OpenGL functionality test failed!" echo " You might need to modify the include and library search paths by editing" echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" echo " ${XQMAKESPEC}." @@ -5394,7 +5395,7 @@ if [ "$PLATFORM_X11" = "yes" ]; then if [ $? != "0" ]; then QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT fi - ;; + ;; *) ;; esac @@ -5703,9 +5704,10 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi fi if [ "$CFG_OPENGL" = "yes" ]; then + CFG_EGL=auto if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es2 - elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS; then CFG_OPENGL=es1 else echo "All the OpenGL ES functionality tests failed!" @@ -5716,24 +5718,26 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es1" ]; then # OpenGL ES 1.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles1 "OpenGL ES 1.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 1.x functionality test failed!" + echo "The OpenGL ES 1.x functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi + CFG_EGL=yes elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS if [ $? != "0" ]; then - echo "The OpenGL ES 2.0 functionality test failed!" + echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" - echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" - echo " ${XQMAKESPEC}." + echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in" + echo " ${XQMAKESPEC}." exit 1 fi + CFG_EGL=yes elif [ "$CFG_OPENGL" = "desktop" ]; then # Desktop OpenGL support echo "Desktop OpenGL support is not avaliable on Qt for Embedded Linux" @@ -5820,6 +5824,36 @@ if [ "$PLATFORM_QWS" = "yes" ]; then fi # QWS +# EGL Support +if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then + if [ "$CFG_EGL" != "no" ]; then + # detect EGL support + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl" "EGL (EGL/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then + # EGL specified by QMAKE_*_EGL, included with + CFG_EGL=yes + CFG_EGL_GLES_INCLUDES=no + elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/egl4gles1" "EGL (GLES/egl.h)" $L_FLAGS $I_FLAGS $l_FLAGS; then + # EGL specified by QMAKE_*_EGL, included with + CFG_EGL=yes + CFG_EGL_GLES_INCLUDES=yes + else + if [ "$CFG_EGL" = "yes" ]; then + echo "The EGL functionality test failed!" + echo " EGL is required for OpenGL ES to manage contexts & surfaces." + echo " You might need to modify the include and library search paths by editing" + echo " QMAKE_INCDIR_EGL, QMAKE_LIBDIR_EGL and QMAKE_LIBS_EGL in" + echo " ${XQMAKESPEC}." + exit 1 + fi + CFG_EGL=no + # If QtOpenGL would be built against OpenGL ES, disable it as we can't to that if EGL is missing + if [ "$CFG_OPENGL" = "es1" || "$CFG_OPENGL" = "es2" ]; then + CFG_OPENGL=no + fi + fi + fi +fi + # freetype support [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE" [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 6f215cc..3b007d7 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -326,10 +326,17 @@ EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties *properties) { // We need to select the correct API before calling eglCreateContext(). +#ifdef QT_OPENGL_ES #ifdef EGL_OPENGL_ES_API if (apiType == QEgl::OpenGL) eglBindAPI(EGL_OPENGL_ES_API); #endif +#else +#ifdef EGL_OPENGL_API + if (apiType == QEgl::OpenGL) + eglBindAPI(EGL_OPENGL_API); +#endif +#endif //defined(QT_OPENGL_ES) #ifdef EGL_OPENVG_API if (apiType == QEgl::OpenVG) eglBindAPI(EGL_OPENVG_API); @@ -339,7 +346,7 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties QEglProperties contextProps; if (properties) contextProps = *properties; -#if defined(QT_OPENGL_ES_2) +#ifdef QT_OPENGL_ES_2 if (apiType == QEgl::OpenGL) contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2); #endif diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index b5d3103..b34d2c3 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -80,19 +80,19 @@ int QEglProperties::value(int name) const case EGL_GREEN_SIZE: return 0; case EGL_BLUE_SIZE: return 0; case EGL_ALPHA_SIZE: return 0; -#if defined(EGL_LUMINANCE_SIZE) +#ifdef EGL_LUMINANCE_SIZE case EGL_LUMINANCE_SIZE: return 0; #endif -#if defined(EGL_ALPHA_MASK_SIZE) +#ifdef EGL_ALPHA_MASK_SIZE case EGL_ALPHA_MASK_SIZE: return 0; #endif -#if defined(EGL_BIND_TO_TEXTURE_RGB) +#ifdef EGL_BIND_TO_TEXTURE_RGB case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE; #endif -#if defined(EGL_BIND_TO_TEXTURE_RGBA) +#ifdef EGL_BIND_TO_TEXTURE_RGBA case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE; #endif -#if defined(EGL_COLOR_BUFFER_TYPE) +#ifdef EGL_COLOR_BUFFER_TYPE case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER; #endif case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE; @@ -103,7 +103,7 @@ int QEglProperties::value(int name) const case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE; case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE; case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE; -#if defined(EGL_RENDERABLE_TYPE) +#ifdef EGL_RENDERABLE_TYPE case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT; #endif case EGL_SAMPLE_BUFFERS: return 0; @@ -115,7 +115,7 @@ int QEglProperties::value(int name) const case EGL_TRANSPARENT_GREEN_VALUE: return EGL_DONT_CARE; case EGL_TRANSPARENT_BLUE_VALUE: return EGL_DONT_CARE; -#if defined(EGL_VERSION_1_3) +#ifdef EGL_VERSION_1_3 case EGL_CONFORMANT: return 0; case EGL_MATCH_NATIVE_PIXMAP: return EGL_NONE; #endif @@ -215,15 +215,18 @@ void QEglProperties::setPixelFormat(QImage::Format pixelFormat) void QEglProperties::setRenderableType(QEgl::API api) { -#if defined(EGL_RENDERABLE_TYPE) +#ifdef EGL_RENDERABLE_TYPE #if defined(QT_OPENGL_ES_2) if (api == QEgl::OpenGL) setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT); #elif defined(QT_OPENGL_ES) if (api == QEgl::OpenGL) setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT); +#elif defined(EGL_OPENGL_BIT) + if (api == QEgl::OpenGL) + setValue(EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT); #endif -#if defined(EGL_OPENVG_BIT) +#ifdef EGL_OPENVG_BIT if (api == QEgl::OpenVG) setValue(EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT); #endif @@ -272,7 +275,7 @@ bool QEglProperties::reduceConfiguration() return true; if (removeValue(EGL_DEPTH_SIZE)) return true; -#if defined(EGL_BIND_TO_TEXTURE_RGB) +#ifdef EGL_BIND_TO_TEXTURE_RGB if (removeValue(EGL_BIND_TO_TEXTURE_RGB)) return true; #endif @@ -327,6 +330,10 @@ QString QEglProperties::toString() const if ((val & EGL_OPENGL_ES2_BIT) != 0) types += QLatin1String("es2"); #endif +#ifdef EGL_OPENGL_BIT + if ((val & EGL_OPENGL_BIT) != 0) + types += QLatin1String("gl"); +#endif if ((val & EGL_OPENVG_BIT) != 0) types += QLatin1String("vg"); if ((val & ~7) != 0) diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 9473343..15795d2 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -77,7 +77,7 @@ SOURCES += qgl.cpp \ } x11 { - contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2) { + contains(QT_CONFIG, egl) { SOURCES += qgl_x11egl.cpp \ qglpixelbuffer_egl.cpp \ qgl_egl.cpp \ diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5595e02..4e1a63c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -49,7 +49,7 @@ #include "private/qpixmap_x11_p.h" #define INT32 dummy_INT32 #define INT8 dummy_INT8 -#if !defined(QT_OPENGL_ES) +#ifdef QT_NO_EGL # include #endif #undef INT32 @@ -1582,7 +1582,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) # endif vi = 0; #endif -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL ownsEglContext = false; eglContext = 0; eglSurface = EGL_NO_SURFACE; @@ -3950,7 +3950,7 @@ bool QGLWidget::event(QEvent *e) } } -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL // A re-parent is likely to destroy the X11 window and re-create it. It is important // that we free the EGL surface _before_ the winID changes - otherwise we can leak. if (e->type() == QEvent::ParentAboutToChange) @@ -4909,7 +4909,7 @@ void QGLWidget::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QM } #endif -#if !defined(QT_OPENGL_ES_1) +#ifndef QT_OPENGL_ES_1 Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_2_engine) #endif diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 64f54a3..b1e2ede 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -376,7 +376,7 @@ protected: #if defined(Q_WS_WIN) virtual int choosePixelFormat(void* pfd, HDC pdc); #endif -#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) +#if defined(Q_WS_X11) && defined(QT_NO_EGL) 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 1f28b08..ee580a6 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -64,7 +64,7 @@ #include "qcache.h" #include "qglpaintdevice_p.h" -#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2) +#ifndef QT_NO_EGL #include #endif @@ -96,7 +96,7 @@ class QMacWindowChangeEvent; class QWSGLWindowSurface; #endif -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL class QEglContext; #endif @@ -164,7 +164,7 @@ public: #ifdef Q_WS_QWS , wsurf(0) #endif -#if defined(Q_WS_X11) && defined(QT_OPENGL_ES) +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) , eglSurfaceWindowId(0) #endif { @@ -194,7 +194,7 @@ public: QGLContext *olcx; #elif defined(Q_WS_X11) QGLOverlayWidget *olw; -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL void recreateEglSurface(bool force); WId eglSurfaceWindowId; #endif @@ -344,7 +344,7 @@ public: HBITMAP hbitmap; HDC hbitmap_hdc; #endif -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL bool ownsEglContext; QEglContext *eglContext; EGLSurface eglSurface; diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index eca9550..9a8b243 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -137,14 +137,14 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form #if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES) qctx->d_func()->dc = dc; qctx->d_func()->rc = ctx; -#elif (defined(Q_WS_X11) && !defined(QT_OPENGL_ES)) +#elif (defined(Q_WS_X11) && defined(QT_NO_EGL)) qctx->d_func()->cx = ctx; qctx->d_func()->pbuf = (void *) pbuf; qctx->d_func()->vi = 0; #elif defined(Q_WS_MAC) qctx->d_func()->cx = ctx; qctx->d_func()->vi = 0; -#elif defined(QT_OPENGL_ES) +#elif !defined(QT_NO_EGL) qctx->d_func()->eglContext = ctx; qctx->d_func()->eglSurface = pbuf; #endif @@ -254,7 +254,7 @@ bool QGLPixelBuffer::doneCurrent() \sa size() */ -#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && !defined(QT_OPENGL_ES) +#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && defined(QT_NO_EGL) GLuint QGLPixelBuffer::generateDynamicTexture() const { Q_D(const QGLPixelBuffer); diff --git a/src/opengl/qglpixelbuffer_p.h b/src/opengl/qglpixelbuffer_p.h index c85dc5a..2a1f671 100644 --- a/src/opengl/qglpixelbuffer_p.h +++ b/src/opengl/qglpixelbuffer_p.h @@ -60,7 +60,7 @@ QT_BEGIN_INCLUDE_NAMESPACE #include #include -#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) +#if defined(Q_WS_X11) && defined(QT_NO_EGL) #include // The below is needed to for compilation on HPUX, due to broken GLX @@ -127,10 +127,8 @@ struct GLXFBConfig { #elif defined(Q_WS_WIN) DECLARE_HANDLE(HPBUFFERARB); -#elif defined(QT_OPENGL_ES_2) -#include -#elif defined(QT_OPENGL_ES) -#include +#elif !defined(QT_NO_EGL) +#include #endif QT_END_INCLUDE_NAMESPACE @@ -174,7 +172,7 @@ public: QPointer req_shareWidget; QSize req_size; -#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) +#if defined(Q_WS_X11) && defined(QT_NO_EGL) GLXPbuffer pbuf; GLXContext ctx; #elif defined(Q_WS_WIN) @@ -195,7 +193,7 @@ public: AGLContext share_ctx; # endif #endif -#if defined(QT_OPENGL_ES) +#ifndef QT_NO_EGL EGLSurface pbuf; QEglContext *ctx; int textureFormat; -- cgit v0.12 From 91976b6bde42dd8c939591c01017208aaa670418 Mon Sep 17 00:00:00 2001 From: Carolina Gomes Date: Fri, 26 Mar 2010 12:10:36 -0300 Subject: QTBUG-6800 patch included, but only for OpenGL 2.0 Merge-request: 2344 Reviewed-by: Tom Cooksey --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 11 ++++++++- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 2 ++ src/opengl/qgl.cpp | 27 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0cc7430..0ef9204 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -510,12 +510,19 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } +bool QGL2PaintEngineEx::isNativePaintingActive() +{ + return nativePaintingActive; +} + void QGL2PaintEngineEx::beginNativePainting() { Q_D(QGL2PaintEngineEx); ensureActive(); d->transferMode(BrushDrawingMode); + nativePaintingActive = true; + QGLContext *ctx = d->ctx; glUseProgram(0); @@ -583,6 +590,7 @@ void QGL2PaintEngineEx::endNativePainting() { Q_D(QGL2PaintEngineEx); d->needsSync = true; + nativePaintingActive = false; } void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) @@ -1101,7 +1109,8 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i /////////////////////////////////// Public Methods ////////////////////////////////////////// QGL2PaintEngineEx::QGL2PaintEngineEx() - : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))) + : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))), + nativePaintingActive(false) { } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 34d72d1..e91d7ac 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -154,8 +154,10 @@ public: void setRenderTextActive(bool); + bool isNativePaintingActive(); private: Q_DISABLE_COPY(QGL2PaintEngineEx) + bool nativePaintingActive; }; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4e1a63c..848982d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2767,6 +2767,19 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text return; } #else + + if (d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { + QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); + //qDebug() << "Paint Engine is OpenGL2"; + if (eng->isNativePaintingActive() == false) { + //qDebug() << "No usage of begin/endNativePainting()"; + QRectF src = QRectF(0, 0, target.width(), target.height()); + QSize size = QSize(target.width(), target.height()); + eng->drawTexture(target, textureId, size, src); + return; + } + } + const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D); GLint oldTexture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture); @@ -2817,6 +2830,7 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text Q_UNUSED(textureTarget); qWarning("drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) not supported with OpenGL ES, use rect version instead"); #else + const bool wasEnabled = glIsEnabled(GL_TEXTURE_2D); GLint oldTexture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &oldTexture); @@ -2830,6 +2844,19 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth); glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight); + if (d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { + QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); + //qDebug() << "Paint Engine is OpenGL2"; + if (eng->isNativePaintingActive() == false) { + //qDebug() << "No usage of begin/endNativePainting()"; + QRectF dest = QRectF(point, QSizeF(textureWidth, textureHeight)); + QRectF src = QRectF(0, 0, textureWidth, textureHeight); + QSize size = QSize(textureWidth, textureHeight); + eng->drawTexture(dest, textureId, size, src); + return; + } + } + qDrawTextureRect(QRectF(point, QSizeF(textureWidth, textureHeight)), textureWidth, textureHeight, textureTarget); if (!wasEnabled) -- cgit v0.12 From 65536764c06200762ea6308703eae7ee3df17b15 Mon Sep 17 00:00:00 2001 From: Carolina Gomes Date: Sat, 27 Mar 2010 01:06:41 -0300 Subject: Adjustments to QTBUG-6800 patch. Merge-request: 2344 Reviewed-by: Tom Cooksey --- src/opengl/qgl.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 848982d..c20c058 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2768,11 +2768,10 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text } #else - if (d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { - QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); - //qDebug() << "Paint Engine is OpenGL2"; - if (eng->isNativePaintingActive() == false) { - //qDebug() << "No usage of begin/endNativePainting()"; + if (d_ptr->active_engine && + d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { + QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); + if (eng->isNativePaintingActive() == false) { QRectF src = QRectF(0, 0, target.width(), target.height()); QSize size = QSize(target.width(), target.height()); eng->drawTexture(target, textureId, size, src); @@ -2844,11 +2843,10 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_WIDTH, &textureWidth); glGetTexLevelParameteriv(textureTarget, 0, GL_TEXTURE_HEIGHT, &textureHeight); - if (d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { + if (d_ptr->active_engine && + d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); - //qDebug() << "Paint Engine is OpenGL2"; if (eng->isNativePaintingActive() == false) { - //qDebug() << "No usage of begin/endNativePainting()"; QRectF dest = QRectF(point, QSizeF(textureWidth, textureHeight)); QRectF src = QRectF(0, 0, textureWidth, textureHeight); QSize size = QSize(textureWidth, textureHeight); -- cgit v0.12 From 131f634a2595ca7910c34bd07c311aea9de2bb62 Mon Sep 17 00:00:00 2001 From: Carolina Gomes Date: Mon, 29 Mar 2010 00:34:12 -0300 Subject: More adjustments to QTBUG-6800 Merge-request: 2344 Reviewed-by: Tom Cooksey --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 ----- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 5 ++++- src/opengl/qgl.cpp | 14 +++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0ef9204..0534233 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -510,11 +510,6 @@ void QGL2PaintEngineExPrivate::drawTexture(const QGLRect& dest, const QGLRect& s glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } -bool QGL2PaintEngineEx::isNativePaintingActive() -{ - return nativePaintingActive; -} - void QGL2PaintEngineEx::beginNativePainting() { Q_D(QGL2PaintEngineEx); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index e91d7ac..0538107 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -154,12 +154,15 @@ public: void setRenderTextActive(bool); - bool isNativePaintingActive(); + bool isNativePaintingActive() const; private: Q_DISABLE_COPY(QGL2PaintEngineEx) bool nativePaintingActive; }; +inline bool QGL2PaintEngineEx::isNativePaintingActive() const { + return nativePaintingActive; +} class QGL2PaintEngineExPrivate : public QPaintEngineExPrivate { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index c20c058..394bcbc 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2771,9 +2771,9 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text if (d_ptr->active_engine && d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); - if (eng->isNativePaintingActive() == false) { - QRectF src = QRectF(0, 0, target.width(), target.height()); - QSize size = QSize(target.width(), target.height()); + if (!eng->isNativePaintingActive()) { + QRectF src(0, 0, target.width(), target.height()); + QSize size(target.width(), target.height()); eng->drawTexture(target, textureId, size, src); return; } @@ -2846,10 +2846,10 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text if (d_ptr->active_engine && d_ptr->active_engine->type() == QPaintEngine::OpenGL2) { QGL2PaintEngineEx *eng = static_cast(d_ptr->active_engine); - if (eng->isNativePaintingActive() == false) { - QRectF dest = QRectF(point, QSizeF(textureWidth, textureHeight)); - QRectF src = QRectF(0, 0, textureWidth, textureHeight); - QSize size = QSize(textureWidth, textureHeight); + if (!eng->isNativePaintingActive()) { + QRectF dest(point, QSizeF(textureWidth, textureHeight)); + QRectF src(0, 0, textureWidth, textureHeight); + QSize size(textureWidth, textureHeight); eng->drawTexture(dest, textureId, size, src); return; } -- cgit v0.12 From 78dd32bce0cab27474faafd149bac99b4197f124 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Wed, 14 Apr 2010 15:29:03 +0200 Subject: Move nativePaintingActive flag to GL2 engine's private Reviewed-By: Samuel --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 12 ++++++++---- src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 7 ++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0534233..c89d34f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -516,7 +516,7 @@ void QGL2PaintEngineEx::beginNativePainting() ensureActive(); d->transferMode(BrushDrawingMode); - nativePaintingActive = true; + d->nativePaintingActive = true; QGLContext *ctx = d->ctx; glUseProgram(0); @@ -585,7 +585,12 @@ void QGL2PaintEngineEx::endNativePainting() { Q_D(QGL2PaintEngineEx); d->needsSync = true; - nativePaintingActive = false; + d->nativePaintingActive = false; +} + +bool QGL2PaintEngineEx::isNativePaintingActive() const { + Q_D(const QGL2PaintEngineEx); + return d->nativePaintingActive; } void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) @@ -1104,8 +1109,7 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i /////////////////////////////////// Public Methods ////////////////////////////////////////// QGL2PaintEngineEx::QGL2PaintEngineEx() - : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))), - nativePaintingActive(false) + : QPaintEngineEx(*(new QGL2PaintEngineExPrivate(this))) { } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 0538107..2ac2ca4 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -157,13 +157,8 @@ public: bool isNativePaintingActive() const; private: Q_DISABLE_COPY(QGL2PaintEngineEx) - bool nativePaintingActive; }; -inline bool QGL2PaintEngineEx::isNativePaintingActive() const { - return nativePaintingActive; -} - class QGL2PaintEngineExPrivate : public QPaintEngineExPrivate { Q_DECLARE_PUBLIC(QGL2PaintEngineEx) @@ -183,6 +178,7 @@ public: elementIndicesVBOId(0), snapToPixelGrid(false), addOffset(false), + nativePaintingActive(false), inverseScale(1), lastMaskTextureUsed(0) { } @@ -285,6 +281,7 @@ public: bool snapToPixelGrid; bool addOffset; // When enabled, adds a 0.49,0.49 offset to matrix in updateMatrix + bool nativePaintingActive; GLfloat pmvMatrix[3][3]; GLfloat inverseScale; -- cgit v0.12 From d20bf43e3f7b3d39fddd28eee5a5594de6930873 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 15 Apr 2010 13:40:12 +1000 Subject: Fix compilation of ShivaVG, which does not have EGL. Task-number: QTBUG-9809 Reviewed-by: Sarah Smith --- src/openvg/qpixmapdata_vg.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 5c4f41b..168f06a 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -42,7 +42,9 @@ #include "qpixmapdata_vg_p.h" #include "qpaintengine_vg_p.h" #include +#if !defined(QT_NO_EGL) #include +#endif #include "qvg_p.h" #include "qvgimagepool_p.h" -- cgit v0.12 From 794cbd5800a4428babc100528fd4fdba49557b6f Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 15 Apr 2010 12:48:56 +0200 Subject: Wrap EGL image function pointers and move into QEgl namespace QtGui exporting a symbol called eglCreateImageKHR seems a pretty silly idea. Much better to have them in the QEgl namespace. Reviewed-By: Iain --- src/gui/egl/qegl.cpp | 43 +++++++++++++++++++++++++++++++++++++------ src/gui/egl/qegl_p.h | 18 ++++-------------- src/opengl/qgl_x11egl.cpp | 8 ++------ src/openvg/qpixmapdata_vg.cpp | 12 ++++++------ 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 3b007d7..0fe5cbe 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -535,10 +535,14 @@ QEglProperties QEglContext::configProperties() const return QEglProperties(config()); } -#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) -_eglCreateImageKHR eglCreateImageKHR = 0; -_eglDestroyImageKHR eglDestroyImageKHR = 0; -#endif + +typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*); +typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); + +// Defined in qegl.cpp: +static _eglCreateImageKHR qt_eglCreateImageKHR = 0; +static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0; + EGLDisplay QEgl::display() { @@ -565,8 +569,8 @@ EGLDisplay QEgl::display() // Resolve the egl extension function pointers: #if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) { - eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); - eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); + qt_eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR"); + qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR"); } #endif } @@ -574,6 +578,33 @@ EGLDisplay QEgl::display() return dpy; } +EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) +{ + if (qt_eglCreateImageKHR) + return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list); + + QEgl::display(); // Initialises function pointers + if (qt_eglCreateImageKHR) + return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list); + + qWarning("QEgl::eglCreateImageKHR() called but EGL_KHR_image(_base) extension not present"); + return 0; +} + +EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img) +{ + if (qt_eglDestroyImageKHR) + return qt_eglDestroyImageKHR(dpy, img); + + QEgl::display(); // Initialises function pointers + if (qt_eglDestroyImageKHR) + return qt_eglDestroyImageKHR(dpy, img); + + qWarning("QEgl::eglDestroyImageKHR() called but EGL_KHR_image(_base) extension not present"); + return 0; +} + + #ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index f81add6..6345d5d 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -147,20 +147,6 @@ typedef void *EGLImageKHR; #define EGL_KHR_image_pixmap #endif -// It is possible that something has included eglext.h (like Symbian 10.1's broken egl.h), in -// which case, EGL_KHR_image/EGL_KHR_image_base will be defined. They may have also defined -// the actual function prototypes, but generally EGL_EGLEXT_PROTOTYPES will be defined in that -// case and we shouldn't re-define them here. -#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) -typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, EGLint*); -typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR); - -// Defined in qegl.cpp: -extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR; -extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR; -#endif // (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) - - class QEglProperties; @@ -210,6 +196,10 @@ namespace QEgl { Q_GUI_EXPORT EGLNativeWindowType nativeWindow(QWidget*); Q_GUI_EXPORT EGLNativePixmapType nativePixmap(QPixmap*); + // Extension functions + Q_GUI_EXPORT EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); + Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img); + #ifdef Q_WS_X11 Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config); #endif diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index af0100b..6f210ce 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -378,8 +378,6 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // eglCreateImageKHR & eglDestroyImageKHR without support for pixmaps, so we must // check we have the EGLImage from pixmap functionality. if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_pixmap")) { - Q_ASSERT(eglCreateImageKHR); - Q_ASSERT(eglDestroyImageKHR); // Being able to create an EGLImage from a native pixmap is also pretty useless // without the ability to bind that EGLImage as a texture, which is provided by @@ -436,15 +434,13 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // If the pixmap doesn't already have a valid surface, try binding it via EGLImage // first, as going through EGLImage should be faster and better supported: if (!textureIsBound && haveEglImageTFP) { - Q_ASSERT(eglCreateImageKHR); - EGLImageKHR eglImage; EGLint attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE }; - eglImage = eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, + eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)QEgl::nativePixmap(pixmap), attribs); QGLContext* ctx = q; @@ -457,7 +453,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons // Once the egl image is bound, the texture becomes a new sibling image and we can safely // destroy the EGLImage we created for the pixmap: if (eglImage != EGL_NO_IMAGE_KHR) - eglDestroyImageKHR(QEgl::display(), eglImage); + QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); } if (!textureIsBound && haveTFP) { diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp index 168f06a..6258e0c 100644 --- a/src/openvg/qpixmapdata_vg.cpp +++ b/src/openvg/qpixmapdata_vg.cpp @@ -498,7 +498,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(QEgl::display(), + EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, @@ -513,7 +513,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) vgImage = vgCreateEGLImageTargetKHR(eglImage); if (vgGetError() != VG_NO_ERROR) { cleanup(); - eglDestroyImageKHR(QEgl::display(), eglImage); + QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); driver.Close(); return; } @@ -527,7 +527,7 @@ void QVGPixmapData::fromNativeType(void* pixmap, NativeType type) prevSize = QSize(w, h); setSerialNumber(++qt_vg_pixmap_serial); // release stuff - eglDestroyImageKHR(QEgl::display(), eglImage); + QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); driver.Close(); #endif } else if (type == QPixmapData::FbsBitmap) { @@ -613,7 +613,7 @@ void* QVGPixmapData::toNativeType(NativeType type) } const EGLint KEglImageAttribs[] = {EGL_IMAGE_PRESERVED_SYMBIAN, EGL_TRUE, EGL_NONE}; - EGLImageKHR eglImage = eglCreateImageKHR(QEgl::display(), + EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer)sgImage, @@ -626,7 +626,7 @@ void* QVGPixmapData::toNativeType(NativeType type) VGImage dstVgImage = vgCreateEGLImageTargetKHR(eglImage); if (vgGetError() != VG_NO_ERROR) { - eglDestroyImageKHR(QEgl::display(), eglImage); + QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); sgImage->Close(); driver.Close(); return 0; @@ -642,7 +642,7 @@ void* QVGPixmapData::toNativeType(NativeType type) } // release stuff vgDestroyImage(dstVgImage); - eglDestroyImageKHR(QEgl::display(), eglImage); + QEgl::eglDestroyImageKHR(QEgl::display(), eglImage); driver.Close(); return reinterpret_cast(sgImage); #endif -- cgit v0.12 From 63224660526b199eabd08e1dfbd8956e764d768e Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 13 Apr 2010 13:21:15 +0200 Subject: Fix compile error with QT_NO_IMAGEFORMAT_XPM in QtGui Merge-request: 2327 Reviewed-by: Thierry Bastian --- src/gui/kernel/qapplication.cpp | 2 ++ src/gui/kernel/qapplication_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b0a23d4..62e99e9 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5936,6 +5936,7 @@ static const char * const link_xpm[] = { QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) { +#if defined(Q_WS_X11) || defined(Q_WS_WIN) if (!move_cursor) { move_cursor = new QPixmap((const char **)move_xpm); copy_cursor = new QPixmap((const char **)copy_xpm); @@ -5959,6 +5960,7 @@ QPixmap QApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) default: break; } +#endif return QPixmap(); } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 6d71cfe..01abe54 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -520,9 +520,11 @@ public: QGestureManager *gestureManager; QWidget *gestureWidget; +#if defined(Q_WS_X11) || defined(Q_WS_WIN) QPixmap *move_cursor; QPixmap *copy_cursor; QPixmap *link_cursor; +#endif #if defined(Q_WS_WIN) QPixmap *ignore_cursor; #endif -- cgit v0.12 From 97caf6916a830b70f6a40a99a55fd4500b163c37 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 13 Apr 2010 13:22:01 +0200 Subject: Fix compile error with QT_NO_GRAPHICSVIEW in QtMultimedia Merge-request: 2333 Reviewed-by: Thierry Bastian --- src/multimedia/base/qgraphicsvideoitem.cpp | 5 +++++ src/multimedia/base/qgraphicsvideoitem.h | 3 +++ src/multimedia/playback/qmediaplayer.cpp | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/multimedia/base/qgraphicsvideoitem.cpp b/src/multimedia/base/qgraphicsvideoitem.cpp index f903eb7..c50d3ff 100644 --- a/src/multimedia/base/qgraphicsvideoitem.cpp +++ b/src/multimedia/base/qgraphicsvideoitem.cpp @@ -52,6 +52,8 @@ #include #endif +#ifndef QT_NO_GRAPHICSVIEW + QT_BEGIN_NAMESPACE @@ -434,4 +436,7 @@ bool QGraphicsVideoItem::sceneEvent(QEvent *event) } QT_END_NAMESPACE + +#endif // QT_NO_GRAPHICSVIEW + #include "moc_qgraphicsvideoitem.cpp" diff --git a/src/multimedia/base/qgraphicsvideoitem.h b/src/multimedia/base/qgraphicsvideoitem.h index e6f0d81..a20caf3 100644 --- a/src/multimedia/base/qgraphicsvideoitem.h +++ b/src/multimedia/base/qgraphicsvideoitem.h @@ -46,6 +46,7 @@ #include +#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW QT_BEGIN_HEADER @@ -109,4 +110,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_GRAPHICSVIEW + #endif diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 9466cad..6b2e0f9 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -145,7 +145,9 @@ public: QMediaPlaylist *playlist; QPointer videoWidget; +#ifndef QT_NO_GRAPHICSVIEW QPointer videoItem; +#endif void _q_stateChanged(QMediaPlayer::State state); void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status); @@ -618,26 +620,36 @@ void QMediaPlayer::bind(QObject *obj) } QVideoWidget *videoWidget = qobject_cast(obj); +#ifndef QT_NO_GRAPHICSVIEW QGraphicsVideoItem *videoItem = qobject_cast(obj); +#endif - if (videoWidget || videoItem) { + if (videoWidget +#ifndef QT_NO_GRAPHICSVIEW + || videoItem +#endif + ) { //detach the current video output if (d->videoWidget) { d->videoWidget->setMediaObject(0); d->videoWidget = 0; } +#ifndef QT_NO_GRAPHICSVIEW if (d->videoItem) { d->videoItem->setMediaObject(0); d->videoItem = 0; } +#endif } if (videoWidget) d->videoWidget = videoWidget; +#ifndef QT_NO_GRAPHICSVIEW if (videoItem) d->videoItem = videoItem; +#endif } } @@ -651,8 +663,10 @@ void QMediaPlayer::unbind(QObject *obj) if (obj == d->videoWidget) { d->videoWidget = 0; +#ifndef QT_NO_GRAPHICSVIEW } else if (obj == d->videoItem) { d->videoItem = 0; +#endif } else if (obj == d->playlist) { disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)), this, SLOT(_q_updateMedia(QMediaContent))); -- cgit v0.12 From b53f7d4ce3d5d9af47daf78c9f831acc532e688b Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 15 Apr 2010 11:05:05 +0200 Subject: QListView: Re-fix scrollbar ranges Commit 11dea4a8b227801c110f791f350632bf6f0c958d fixing QTBUG-2678 was the wrong solution and introduced some regressions. Auto-test included. Reviewed-by: Thierry Task-number: QTBUG-2678 Task-number: QTBUG-9455 --- src/gui/itemviews/qlistview.cpp | 14 ++++++++++---- tests/auto/qlistview/tst_qlistview.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 39ca75a..1869093 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1853,14 +1853,14 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { horizontalScrollBar()->setSingleStep(step.width() + spacing()); horizontalScrollBar()->setPageStep(viewport()->width()); - horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width() - 2 * spacing()); + horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); } void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) { verticalScrollBar()->setSingleStep(step.height() + spacing()); verticalScrollBar()->setPageStep(viewport()->height()); - verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height() - 2 * spacing()); + verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); } void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) @@ -2276,6 +2276,7 @@ void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) const QPoint topLeft = initStaticLayout(info); QStyleOptionViewItemV4 option = viewOptions(); option.rect = info.bounds; + option.rect.adjust(info.spacing, info.spacing, -info.spacing, -info.spacing); // The static layout data structures are as follows: // One vector contains the coordinate in the direction of layout flow. @@ -2905,8 +2906,13 @@ void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) batchStartRow = info.last + 1; bool done = (info.last >= rowCount() - 1); // resize the content area - if (done || !info.bounds.contains(item->rect())) - contentsSize = QSize(rect.width(), rect.height()); + if (done || !info.bounds.contains(item->rect())) { + contentsSize = rect.size(); + if (info.flow == QListView::LeftToRight) + contentsSize.rheight() += info.spacing; + else + contentsSize.rwidth() += info.spacing; + } // resize tree int insertFrom = info.first; if (done || info.first == 0) { diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index d2181f8..f5c32cd 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -123,6 +123,7 @@ private slots: void taskQTBUG_435_deselectOnViewportClick(); void taskQTBUG_2678_spacingAndWrappedText(); void taskQTBUG_5877_skippingItemInPageDownUp(); + void taskQTBUG_9455_wrongScrollbarRanges(); }; // Testing get/set functions @@ -1941,5 +1942,34 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp() } } +class ListView_9455 : public QListView +{ +public: + QSize contentsSize() const + { + return QListView::contentsSize(); + } +}; + +void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges() +{ + QStringList list; + const int nrItems = 8; + for (int i = 0; i < nrItems; i++) + list << QString().sprintf("item %d", i); + + QStringListModel model(list); + ListView_9455 w; + w.setModel(&model); + w.setViewMode(QListView::IconMode); + w.resize(116, 132); + w.setMovement(QListView::Static); + const int spacing = 40; + w.setSpacing(spacing); + w.show(); + QTest::qWaitForWindowShown(&w); + QCOMPARE(w.verticalScrollBar()->maximum(), w.contentsSize().height() - w.viewport()->geometry().height()); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" -- cgit v0.12