summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex
Commit message (Collapse)AuthorAgeFilesLines
* Guard QGL2PaintEngineEx/QGLPaintDevice against using unset contextTor Arne Vestbø2018-08-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | QGL2PaintEngineEx::end() calls endPaint() on the device, which may end up calling QGLContext::swapBuffers() on the context, a call which we have documented to require makeCurrent() for any further GL commands: Call this to finish a frame of OpenGL rendering, and make sure to call makeCurrent() again before issuing any further OpenGL commands, for example as part of a new frame. QOpenGLContext also documents that: To be able to support certain platforms, QOpenGLContext requires that you call makeCurrent() again before starting rendering a new frame, after calling swapBuffers(). As a consequence, we need to guard the GL usage in QGLPaintDevice::endPaint(), as well as the GL reset in QGL2PaintEngineEx::end(). Change-Id: Ib66e91cce12fbaea32ed3c30141150fa15907187 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * Change almost all other uses of qrand() to QRandomGeneratorThiago Macieira2017-11-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Replace Q_DECL_OVERRIDE with override where possibleKevin Funk2017-09-193-38/+38
|/ | | | | | | | | | | | | | | | Remaining uses of Q_DECL_OVERRIDE are in: src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.cpp doc/global/qt-cpp-defines.qdocconf (definition and documentation of Q_DECL_OVERRIDE) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Use static initialization for QBasicAtomicsMarc Mutz2017-02-161-1/+1
| | | | | | | | | | | | | A default-constructed static QBasicAtomicInt at function scope will be dynamically initialized. It will still be zero-initialized, but at least GCC adds guard variables for such objects. When using aggregate initialization, the guard disappears. Amends 04d6495bf773a6bb0d4fa6980df22d3b81a605b0. Change-Id: Id9335cffdd43094cafb231fdde2523d013abe1d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make some atomic counters zero-basedMarc Mutz2017-02-151-2/+6
| | | | | | | | | | | | | | A variable of static storage duration that is not zero-initialized takes up space in the DATA segment of the executable. By making the counters start at zero and adding the initial value afterwards, we move them over to the BSS segment, which does not take up space in the executable. Wrap atomics used across function boundaries into small functions, to avoid code duplication and to increase readability. Change-Id: Ida6ed316ecb8fe20da62a9577161349e14de5aed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add missing override into Qt modulesAlexander Volkov2016-12-011-2/+2
| | | | | Change-Id: I014ac8c7b590c77b054fbb01f0ab5601c44ca88e Reviewed-by: hjk <hjk@qt.io>
* Remove last traces of MeeGoLars Knoll2016-11-232-455/+0
| | | | | | Change-Id: I5242f1dfcfccf9811398e717b90196e6228d1dc5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Standardize some "We mean it" commentsFriedemann Kleint2016-08-171-3/+3
| | | | | | | Fix the occurrences where the wrong classes are mentioned. Change-Id: Ia291af77f0f454a39cab93e7376a110c19a07771 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-122-12/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure src/corelib/io/qprocess_wince.cpp src/plugins/platforms/windows/qwindowstheme.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qtimezone/BLACKLIST tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
| * OpenGL: use const (and const APIs) moreAnton Kudryavtsev2016-04-202-12/+9
| | | | | | | | | | | | | | | | For CoW types, prefer const methods to avoid needless detach()ing. Change-Id: I211ae74434bf3705914764e1e9d02ae823a1be3a Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-111-6/+9
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
| * QtBase: use erase and std::remove_if with QList and QVectorAnton Kudryavtsev2016-04-081-6/+9
| | | | | | | | | | | | | | ... instead of using removeAt in a loop, with quadratic complexity. Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QtOpenGL/plugins/platformsupport: use new QRegion::begin()/end() instead of ↵Marc Mutz2016-03-021-3/+3
|/ | | | | | | | | | rect() Saves e.g. ~900b and ~2900b in text size in QtOpenGL and XcbQpa libs, resp., on optimized GCC 5.3 Linux AMD64 builds. Change-Id: Id904689164ca32df41118a23747c70048d8e6604 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-1515-210/+300
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Use Q_UNLIKELY for every qFatal()/qCritical()Marc Mutz2015-11-291-7/+7
| | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qFatal() or a qCritical(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In some cases, simplified the expressions newly wrapped in Q_UNLIKELY as a drive-by. Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.5' into devFrederik Gladhorn2015-08-061-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/global/qt-cpp-defines.qdocconf src/3rdparty/forkfd/forkfd.c src/corelib/codecs/qtextcodec.cpp src/corelib/kernel/qmetatype.cpp src/corelib/tools/qset.qdoc src/gui/accessible/qaccessible.cpp src/gui/image/qpixmapcache.cpp src/opengl/qgl.cpp src/tools/qdoc/generator.cpp src/widgets/kernel/qwidget.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
| * Fix warnings about unused variablesThiago Macieira2015-08-061-2/+1
| | | | | | | | | | | | | | | | Found by ICC qglengineshadermanager.cpp(427): warning #177: variable "none" was declared but never referenced Change-Id: Id3d5c7bf4d4c45069621ffff13f758ffaf1744d7 Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
* | Delete the d_ptr in the destructorHolger Hans Peter Freyther2015-06-121-0/+1
|/ | | | | | | | | | The d_ptr variable is introduced by QGLCustomShaderStage and needs to be fully handled by it. Delete the d_ptr in the dtor Fixes Coverity CID #10995. Change-Id: I76bf05206acf23363419afc95094f5593e808a2e Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fix subpixel rendered text in QGLWidgetAllan Sandfeld Jensen2015-05-301-7/+11
| | | | | | | | | | | Subpixel rendered text doesn't work in the old OpenGL paint engine because it assumes the glyphs are returned in RGB32 format, when they may be in ARGB32. This patch changes the test of the returned format to just check for 32bit matching the logic in the new OpenGL paint engine. Change-Id: Ib5b784dedba51cf22f216e2f035361518610b96b Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Make data tables const.Volker Krause2015-05-051-1/+1
| | | | | | | | | | Moves some of them to the .rodata section, the rest at least to .data.rel.ro[.local]. Change-Id: I85676ddf22b0c0097f3f0dce4c3dc018dc29d045 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtOpenGL: Fix const correctness in old style castsThiago Macieira2015-03-261-1/+1
| | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c946886247a98a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Remove some uses of the private Q_PI constantAllan Sandfeld Jensen2015-02-261-4/+3
| | | | | | | | | The patch removes several uses of the private Q_PI constant and removes the qmath_p.h from the includes. A few places are optimized to multiply with reciprocals instead of dividing by Q_PI. Change-Id: I097af6a929e0609d6935563064e81c856005f4bc Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-161-2/+2
| | | | | | | | | | | | | | Including math.h can pollute the default namespace, and break some compilers if cmath versions of the method are declared as using. Switching to C++ math functions also greatly simplifies handling of float qreal as C++ automatically chooses the right method. [ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any sources depending on that indirect inclusion may fail to build. Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* Update copyright headersJani Heikkinen2015-02-1115-105/+105
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* [QStaticTextItem] Drop unused membersKonstantin Ritt2014-12-141-2/+0
| | | | | | | | | The QStaticTextItem's `chars` and `numChars` members are never used, even when set. In fact, there is nothing useful we can do with the input string in the absence of clusters mapping. Change-Id: I81fcbce3e575f4d0dcfc2515286d512b858f592b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-033-38/+38
| | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed QtGui's GL paint engine getting out of sync when using QtOpenGLSamuel Rødal2014-11-112-1/+21
| | | | | | | | | | We need to reset the active_engine belonging to QOpenGLContext whenever we make the QtOpenGL paint engine active, to give the OpenGL paint engine in QtGui a chance to sync its state if we've used the QtOpenGL paint engine inbetween. Change-Id: I445ce2f99bfbacf55650c881c4fdf07f2ff85069 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix for current_fbo getting out of sync in QtOpenGLSamuel Rødal2014-11-111-0/+2
| | | | | | | | | | | | | | | When using QGLWidget in combination with QOpenGLFramebufferObject from QtGui, instead of QGLFramebufferObject from QtOpenGL, the current_fbo variable doesn't get updated when framebuffer object bindings change. To ensure that the QGLWidget correctly releases the currently bound framebuffer object when using a QPainter, we keep track of whether QOpenGLFramebufferObject has modified the current FBO binding, and if that's the case we need to read the OpenGL state directly instead of relying on a cached value. Change-Id: If7e0bd936e202cad07365b5ce641ee01d2251930 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-2415-285/+165
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Use NAmE spelling of grey (gray)Marc Mutz2014-08-091-1/+1
| | | | | | | These occurrences are only in docs or code comments. Change-Id: Ia114466a85c01e2b978396c329153044921fb20b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-063-9/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-x86-qcc/qplatformdefs.h src/corelib/global/qglobal.h src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp src/opengl/qglpixelbuffer.cpp src/opengl/qglshaderprogram.cpp tests/auto/opengl/qglthreads/tst_qglthreads.cpp Change-Id: Iaba137884d3526a139000ca26fee02bb27b5cdb5
| * Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-013-8/+8
| |\ | | | | | | | | | | | | | | | This merge adds the opengl rename. Change-Id: I84ea0b6abee9780ebb2cf3f64ab9e3fdf2acab3e
| | * Rename new QOpenGLContext APIsLaszlo Agocs2014-04-253-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isES() becomes isOpenGLES(). The library type enums are changed DesktopGL -> LibGL and GLES2 -> LibGLES. This removes the now unnecessary version number, the confusing "desktop" term and provides better readability. The old function/values are kept until the related qtdeclarative changes are integrated. Task-number: QTBUG-38564 Change-Id: Ibb0a1209985f1ce4bb9451f9b7b093c2b68a6505 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
| * | Don't use GL_REPEAT for image-brush drawing on OpenGL ES2Allan Sandfeld Jensen2014-04-251-1/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of commit 8dfeb1c374972f06759a92b4edc5d6a18b96ccec in QtGui to the same class in the QtOpenGL module. OpenGL ES2 doesn't support NPOT textures in combination with GL_REPEAT, so for OpenGL ES2 we use a custom program that emulates repeat by taking the fractional part of the texture coordinates. This is not enough though, as merely setting GL_TEXTURE_WRAP_x to GL_REPEAT with a NPOT texture is an error in some implementations, so we have to guard the call to updateTextureFilter() in updateBrushTexture() with a check for OpenGL ES2 and use GL_CLAMP_TO_EDGE instead. Change-Id: Icbdd784c2c6d562849679f87da18b20d5441f389 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* / Remove direct OpenGL calls from QtOpenGLLaszlo Agocs2014-04-285-96/+104
|/ | | | | | Task-number: QTBUG-36483 Change-Id: I96dea5649c0a49a11cd2ff31da659cd2067e769d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Resurrect QGLWidget::renderText()Laszlo Agocs2014-03-155-3/+32
| | | | | | | | | | The variant taking x, y, z has been broken in all Qt 5.x releases. This is now corrected by making the GL2 paint engine capable of applying a Z translation. Task-number: QTBUG-31156 Change-Id: I119566e9e9577f6cdf7e8bae56cac1e34995e622 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-043-9/+9
| | | | | | | | | | | | | | | | | | | | | Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix some typosSergio Ahumada2014-03-031-1/+1
| | | | | | Change-Id: I7dbe938bff5ac3ab50a0197f94bdb2f6c22fbd16 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* Fix texture glyph cache setup in old OpenGL paint engineTor Arne Vestbø2014-02-241-7/+6
| | | | | | | | Caused assert-crash reported on Windows. Task-number: QTBUG-37027 Change-Id: If84b970a153570115afb344797728a0b1a04db5b Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Unify glyph format between QFontEngine and QFontEngineGlyphCacheTor Arne Vestbø2014-02-194-29/+29
| | | | | | | | | | | | Instead of the glyph cache having its own cache type that always mapped one to one to a font engine glyph format, causing confusion and needless conversions, the glyph caches now use QFontEngine's glyph format enum. This also removes the iffy use of an int for the glyphFormat in the font engines. Change-Id: I529bad5c179e004f63e152f7dcc311d298c3db98 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Dynamic GL switch on WindowsLaszlo Agocs2014-02-144-56/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch introduces a new build configuration on Windows which can be requested by passing -opengl dynamic to configure. Platforms other than Windows (including WinRT) are not affected. The existing Angle and desktop configurations are not affected. These continue to function as before and Angle remains the default. In the future, when all modules have added support for the dynamic path, as described below, the default configuration could be changed to be the dynamic one. This would allow providing a single set of binaries in the official builds instead of the current two. When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are never defined. Instead, the code path that has traditionally been desktop GL only becomes the dynamic path that has to do runtime checks. Qt modules and applications are not linked to opengl32.dll or libegl/glesv2.dll in this case. Instead, QtGui exports all necessary egl/egl/gl functions which will, under the hood, forward all requests to a dynamically loaded EGL/WGL/GL implementation. Porting guide (better said, changes needed to prepare your code to work with dynamic GL builds when the fallback to Angle is utilized): 1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to differentiate between desktop and ES where needed. Keep in mind that it is the desktop GL header (plus qopenglext.h) that is included, not the GLES one. QtGui's proxy will handle some differences, for example calling glClearDepth will route to glClearDepthf when needed. The built-in eglGetProcAddress is able to retrieve pointers for standard GLES2 functions too so code resolving OpenGL 2 functions will function in any case. 2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds, but never "angle" or "opengles2". 3. The preprocessor define QT_OPENGL_DYNAMIC is also available in dynamic builds. The usage of this is strongly discouraged and should not be needed anywhere except for QtGui and the platform plugin. 4. Code in need of the library handle can use QOpenGLFunctions::platformGLHandle(). The decision on which library to load is currently based on a simple test that creates a dummy window/context and tries to resolve an OpenGL 2 function. If this fails, it goes for Angle. This seems to work well on Win7 PCs for example that do not have proper graphics drivers providing OpenGL installed but are D3D9 capable using the default drivers. Setting QT_OPENGL to desktop or angle skips the test and forces usage of the given GL. There are also two new application attributes that could be used for the same purpose. If Angle is requested but the libraries are not present, desktop is tried. If desktop is requested, or if angle is requested but nothing works, the EGL/WGL functions will still be callable but will return 0. This conveniently means that eglInitialize() and such will report a failure. Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will tell which implementation is chosen. The textures example application is ported to OpenGL 2, the GL 1 code path is removed. [ChangeLog][QtGui] Qt builds on Windows can now be configured for dynamic loading of the OpenGL implementation. This can be requested by passing -opengl dynamic to configure. In this mode no modules will link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will dynamically choose between desktop and Angle during the first GL/EGL/WGL call. This allows deploying applications with a single set of Qt libraries with the ability of transparently falling back to Angle in case the opengl32.dll is not suitable, due to missing graphics drivers for example. Task-number: QTBUG-36483 Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Export optimized premultiply and unpremultiply methodsAllan Sandfeld Jensen2014-02-101-5/+5
| | | | | | | | | | | | | | | | This patch optimizes the unpremultiply method further by using a lookup table to avoid any divisions at all. The opportunity is taken to export both premultiply and unpremultiply since they are commonly used methods relevant to the exported QRgb type that can be both premultiplied and unpremultipled ARGB. [ChangeLog][QtGui][QColor] Exported highly optimized methods for premultiply and unpremultiply of QRgb values. Change-Id: I658bcf57b0bc73c34c1765b64617d43b63ae820b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Fix radial gradient shader compilation for OpenGL ES 2.0.Carsten Munk2013-12-051-2/+2
| | | | | | | | | Change highp to mediump. This qualifier is ignored on desktop, and mediump should be sufficient elsewhere. Task-number: QTBUG-35353 Change-Id: I79f0ed88717d45dada5dcb781e75b10e72db4bd0 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-1/+1
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove code that doesn't do anything.Gunnar Sletta2013-09-261-12/+0
| | | | | Change-Id: Id2528167f21e1ab81b998ceb808a9fc4a24b239a Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
* Fix a memory leak in QGLWidget::renderTextLaszlo Agocs2013-09-201-0/+2
| | | | | | | Task-number: QTBUG-32792 Change-Id: Ie9293a1919c1bdf13a5c357a8d2eac303a83d4d4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix upload of glyphs when using RGB32 masks on OpenGL ESGunnar Sletta2013-07-301-2/+6
| | | | | | | | | | | | OpenGL ES doesn't allow internal format to be different from external format, so always do the conversion from BGRA -> RGBA. We are anyway iterating over all the pixels so the performance impact of this should be minimal. Change-Id: Ie891665ad66e31692b69db02d34be8d303a7d631 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Restore smooth-scaled drawing of 0.5x-2.0x scaled glyphs in the GL engineTor Arne Vestbø2013-07-081-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b5922c89ba942 (Add support for retina glyph-based text drawing in the GL engine), and commit 155a20628b91 (Use QPaintEngineEx to decide if font is too big for using the glyph cache) together changed the behavior of drawing scaled cached glyphs in the GL engine, producing blocky text drawing when using the FreeType font engine. Whereas before we would cache all glyphs without any transform, and let the paint engine take care of the transform, commit b5922c added support for a scaled GL glyph cache, resulting in a 2x cache, drawn at 1x for example. The problem was that the FreeType engine claimed to support producing glyphs at 2x, but did that using the QFontEngine baseclass implementations, which use a simple fast-transform to scale up the glyphs. The result was a 2x cache with horrible looking glyphs. The first step in fixing this issue was to have the FreeType engine claim to only support translations. This would then make the paint engine choose path-based drawing for all scaled text, which is slow. To restore the optimization that we would draw 0.5x-2.0x scaled text using a smooth-scale in the GL engine (which was removed in 155a206), we then needed to extend shouldDrawCachedGlyphs() and add a special condition for this, coupled with a bit of logic in drawCachedGlyphs() that ensures we don't propagate the painter scale to the glyph cache if the engine is not able to produce scaled glyphs for it. This means we get the old behavior of the GL engine doing a smooth scale of the 1x glyph in the cache. Finally, since the raster engine also checks if the font engine supports the current transform, but for FreeType then ends up in a separate code path when actually drawing the glyphs (as the FreeType font engine supports internal glyph caching), we need to add a corresponding check for hasInternalCaching() in the shouldDrawCachedGlyphs() function, now that the FreeType engine only reports that it supports translations. Change-Id: Id03de896dec5f29535b281fb235332ef018045d8 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Set projection matrix for systems with OpenGL 3.1Wouter Huysentruit2013-07-031-0/+2
| | | | | | | | | | The projection matrix should also be set for systems running OpenGL 3.1 with GL_ARB_compatibility extension. Task-number: QTBUG-28284 Change-Id: I756155a6064dcbff29fd817e676d31f24f559e8c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>