summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglpaintengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move QOpenGLPaintEngine and related classes from QtGui to QtOpenGLJohan Klokkhammer Helsing2020-01-221-2702/+0
| | | | | | | | | Also moves the openglwindow test to the opengl folder, as it makes use of these classes. Task-number: QTBUG-74409 Change-Id: Id9f0013cedcc8bd1e87122c005641d7298525045 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-01-091-0/+1
|\ | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp Change-Id: I4780b25665672692b086ee92092e506c814642f2
| * Disable support for RasterOpModes in GL paint engineJean-Michaël Celerier2020-01-091-0/+1
| | | | | | | | | | | | | | | | This leads to crashes for instance when displaying a text cursor in a graphics scene. Change-Id: I1b5c884ddb8325a7f5bdbc6027f0fae13f139a1c Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-1/+1
|/ | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPainter: don't print deprecated warnings for HighQualityAntialiasingChristian Ehrlicher2019-10-031-0/+3
| | | | | | | | Add pragmas to not print warnings about the usage of the deprecated warnings inside QtCore. Change-Id: I2cd9f111cdf13cddff527ab3bac7fa80417d1445 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPainter: mark obsolete RenderHints as deprecatedChristian Ehrlicher2019-07-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RenderHint::HighQualityAntialiasing and NonCosmeticDefaultPen are obsolete since Qt5 but not marked as such. Therefore add Q_DECL_ENUMERATOR_DEPRECATED_X now so those two enumerations can be removed with Qt6. [ChangeLog][QtGui][QPainter] HighQualityAntialiasing and NonCosmeticDefaultPen are marked as deprecated and don't have an effect anymore Change-Id: Ib0c966a078a1d23d492d0255288e2066c50e87b6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add Grayscale16 Image FormatAllan Sandfeld Jensen2018-12-121-2/+3
| | | | | | | | | | [ChangeLog][QtGui][QImage] Added support for 16-bit grayscale format. Together-with: Aaron Linville<aaron@linville.org> Task-number: QTBUG-41176 Change-Id: I5fe4f54a55ebe1413aa71b882c19627fe22362ac Reviewed-by: Nick D'Ademo <nickdademo@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-09-101-0/+1
|\ | | | | | | | | | | | | Conflicts: mkspecs/common/macx.conf Change-Id: I8576493b417912fa5e5501bc2c1b935d186ac209
| * Fix crash when combining QOpenGLWidget, QStaticText and Qt QuickEskil Abrahamsen Blomfeldt2018-08-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under certain circumstances, if you had a widget with a QOpenGLPaintEngine, and drew QStaticText into this, and then later had Qt Quick access the same cache and try to resize it, we would get a crash because the resize function would have a pointer to the paint engine and try to access its shader manager (which would now be null, since this is outside the begin()/end() phase of the paint engine. The solution is to reset the paint engine pointer to null on the cache once it has been populated and it is no longer needed. [ChangeLog][QtGui][Text] Fixed a possible crash when combining QStaticText, QOpenGLWidget and Qt Quick in the same application. Task-number: QTBUG-70096 Change-Id: I7383ad7456d1a72499cfcd2da09a5a808d4b3eff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement support for 16bpc image formatsAllan Sandfeld Jensen2018-08-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for 16bit per color image formats in QImage. This makes it possible to read and write 16bpc PNGs, and take full advantage of the 16bpc paint engine. [ChangeLog][QtGui][QImage] QImage now supports 64bit image formats with 16 bits per color channel, compatible with 16bpc PNG or RGBA16 OpenGL formats. Task-number: QTBUG-45858 Change-Id: Icd28bd5868a6efcf65cb5bd56031d42941e04099 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Fix tiling of NPOT textures on GL/ESAllan Sandfeld Jensen2018-07-271-8/+16
| | | | | | | | | | | | | | | | | | | | The emulation was not working since the vertices are clamped before getting to the fragment shader. So instead just resize the brush if not supported. Change-Id: I856e47890cd3021874b77d869a6ff7162cadde10 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Move texture uploading out of QOpenGLTextureCacheAllan Sandfeld Jensen2018-07-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | This way the logic can be reused elsewhere. At the same time a standard OpenGL ES/3 way of handling BGRA is added, so we don't depend on extensions, and handling of NPOT and max size which QSGTexture will need. Change-Id: I475bc7127f44be3964fdb482c9e86a20db1fbca5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-07-021-21/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: Mårten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
| * Fix: bad-looking scaled rendering of painterpath in OpenGL paint engineEirik Aavitsland2018-06-281-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For performance, the triangulation of a painter path is stored for reuse. Re-triangulation was only done if the path was to be painted at a significantly different scale AND it contained a curve (bezier) element. But also the triangulation of a path with only straight lines can lose precision if rendered at a small scale, and so look bad when used at a higher scale factor. Fix by removing the mentioned curve element condition. Task-number: QTBUG-68873 Change-Id: Id3492514e9382a5828377b7bafea8cfac7b850a6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Add support for advanced blend equations to our OpenGL QPainterAllan Sandfeld Jensen2018-03-051-1/+68
|/ | | | | | | | | Mesa and NVidia have been supporting these extensions several years now. It also means we can get rid of the dead unused code we had for advanced compositions. Change-Id: I6a2fcda13490abd977eb4cc3d8b34f186d05ca25 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Handle implicit close in QDashedStrokeProcessorAllan Sandfeld Jensen2017-05-021-2/+1
| | | | | | | | | Otherwise dashed polygons will not be closed when stroked like they are documented to be. Task-number: QTBUG-60397 Change-Id: I58e9e3a06af157f9a2789ccab640c9da75867962 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-301-1/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network-chat/peermanager.cpp src/widgets/util/qsystemtrayicon.cpp src/widgets/util/qsystemtrayicon_qpa.cpp src/widgets/util/qsystemtrayicon_win.cpp src/widgets/util/qsystemtrayicon_x11.cpp Change-Id: I1c026df83818c0ccaf956980370e7522960627db
| * Use context as glyph cache key in GL paint engineLaszlo Agocs2017-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch from ctx->shareGroup() to ctx. The original intention to use the same cache instance for sharing GL contexts is reasonable, but can only work when there are only shareable resources involved. The FBO used by QOpenGLTextureGlyphCache is not one of these. Text rendering in Qt Quick already uses the same approach and uses per-context glyph caches. Change-Id: Ie7e521769f28b4902ca714eb029acfbf52814309 Task-number: QTBUG-58276 Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Add support for OpenGL 3.2+ core profile contexts in QPainterJulian Thijssen2017-01-231-35/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows painting via QPainter onto a QOpenGLWindow, QOpenGLWidget or QOpenGLFramebufferObject when an core profile context is in use. This is important on macOS in particular, where compatibility profiles are not available, and so the only way to use modern OpenGL is via a core profile context. Added core profile compatible shaders with moder GLSL keywords. The paint engine binds a VAO and two VBOs from now on, whenever VAOs are supported. Note that this changes behavior also for OpenGL 2.x context that have VAO support via extensions. The Lancelot test suite gains support for core profile contexts. This can be triggered via -coreglbuffer in place of -glbuffer when manually inspecting via 'lance', while tst_lancelot will automatically run core context-based tests whenever supported. Task-number: QTBUG-33535 Change-Id: I6323a7ea2aaa9e111651ebbffd3e40259c8e7a9c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Remove OpenGL dependency from qTriangulateLaszlo Agocs2017-01-181-2/+4
|/ | | | | | | | | | | | | | | | | | | The original implementation is only suitable as long as the only client is the GL paint engine which will call the function with the GL context current. In other cases this cannot be ensured. For instance, doing triangulation on the gui thread in a Quick application using the threaded render loop will have to deal with not having a current context on that thread at all. Doing triangulation on worker threads has the same problem as well. In addition, in modern Qt versions a -no-opengl build does not imply no accelerated graphics API. Therefore, drop the ElementIndexUint check from qtriangulator.cpp and leave it up to the caller to tell if uint indices are supported or not. Change-Id: I7491d84981ee22d05c5fde08994dbb3a4e2432e9 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
* QtGui: use new QRegion::begin()/end() instead of rect()Marc Mutz2016-02-281-3/+3
| | | | | | | Saves ~1100b in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I928be44314dde06d5fdd2486a3417870bda64af4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-261-14/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/dbus/qdbusconnection_p.h src/dbus/qdbusintegrator.cpp src/dbus/qdbusintegrator_p.h tests/auto/corelib/io/qdir/qdir.pro tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
| * Remove dead code from QOpenGLPaintEngineAllan Sandfeld Jensen2016-01-211-14/+1
| | | | | | | | | | | | | | These variables were never used or set to anything meaningfull. Change-Id: Ic68ac5c38a3db28d7a5a05be004bcb6a554a1483 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | 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>
* Don't crash when QOpenGLPaintDevice is created without context.Gunnar Sletta2015-10-191-1/+1
| | | | | Change-Id: Ic826158a1570ec49e9847cf040ce897a682048db Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QtGui: Fix const correctness in old style castsThiago Macieira2015-03-121-1/+1
| | | | | | | Found with GCC's -Wcast-qual. Change-Id: Ia0aac2f09e9245339951ffff13c946844bc31eb8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* 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-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-181-83/+161
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/platformsupport/platformcompositor/qopenglcompositor.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I5422868500be695584a496dbbbc719d146bc572d
| * Make GL2PaintEngine::drawCachedGlyphs use updateTextureTor Arne Vestbø2014-12-141-29/+12
| | | | | | | | | | | | | | | | | | | | Ensures that we have a consistent view of what the last used texture was, which is critical when deciding whether or not we need to re-bind the texture or update texture properties. Change-Id: Ib47eb00abde98d148fc6e569ce3e359b340328fb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * Ensure that GL::updateBrushTexture() activates and binds properlyTor Arne Vestbø2014-12-131-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling QOpenGL2GradientCache::getBuffer() will generate the texture the first time, calling glBindTexture in the process. We did this without first ensuring that the right texture unit was active, resulting in the generated gradient texture binding onto the glyph cache mask unit. We now provide a specialization of bindTexture for a QGradient, which ensures that the right unit is active before calling getBuffer(). Unfortunately we have no way of knowing if the result of getBuffer() was a texture that was already bound, or if we need to bind the result, which means we have to do an unconditional bindTexture of the resulting texture ID. This means double-bind for the initial texture generation, but this was already an issue in the original code. Task-number: QTBUG-43039 Task-number: QTBUG-41244 Change-Id: I20c9b795c8c14f8d58be2b60a284c5a060705ec0 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * GL: Make updateTexture invalidate texture on change of texture unitTor Arne Vestbø2014-12-121-4/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Switching texture units means the value of lastTextureUsed could be invalid, meaning we need to unconditionally re-bind and update parameters. A future optimization would be to keep a per-texture-unit cache, so that we wouldn't have to re-bind and set parameters when switching units back and forth, but this complicates the current code somewhat, so it's left for another patch. Change-Id: Icb2a5d03457a907f3c25bbb437feeb7c5f155716 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * GL2PaintEngine: centralize logic for updating/preparing texturesTor Arne Vestbø2014-12-111-49/+72
| | | | | | | | | | | | | | | | | | | | | | | | Rewrite of updateTextureFilter to include activating and binding as well, so that we can maintain a single view of which texture was the last one to be used from within the engine itself. The behavior should be the same as before. Change-Id: I41781d00458b0176c614266f4360db3c68b120a1 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * GL2PaintEngine: Prevent fillInPendingGlyphs from breaking gradientsTor Arne Vestbø2014-12-101-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The glyph cache internally uses the image texture unit when blitting, but doesn't always activate the unit before binding its texture, resulting in sometimes binding the glyph cache texture to the wrong unit. The image texture unit is also the same as the brush texture unit, so any time we fill in pending glyphs we need to re-bind the brush texture, otherwise drawing text with eg. gradients will fail after the new glyphs have been filled. The new hasPendingGlyphs() member function of the glyph cache is an optimization so that we don't need to activate and rebind unless there are glyphs that need to be filled. Change-Id: Iac74130145d2d6d7bf95206b5e8a2fc760743cb5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-101-27/+26
|\| | | | | | | | | | | | | | | Conflicts: doc/global/template/style/online.css mkspecs/android-g++/qmake.conf Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
| * Reformat QOpenGL2PaintEngineExPrivate a bit to make it easier to refactorTor Arne Vestbø2014-12-051-19/+14
| | | | | | | | | | | | Change-Id: I99f7192008ae8ea3a16f5300e5e4ebdde50847af Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * Collate calls to updateTextureFilter in updateBrushTextureTor Arne Vestbø2014-12-041-4/+5
| | | | | | | | | | | | Change-Id: Id13d5bc122c4f9cc8f44ff82df345a50f2944118 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
| * Simplify GL2PaintEngine::updateTextureFilter, it doesn't need targetTor Arne Vestbø2014-12-031-11/+14
| | | | | | | | | | | | Change-Id: I8b71c33adb37c166bf4fc6dc8c2e7418d60fbf81 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | Support Alpha8 and Grayscale8 natively in the OpenGL paint engineAllan Sandfeld Jensen2014-10-271-0/+14
|/ | | | | | | | | Adds special shaders for the Alpha8 and Grayscale8 formats so that they do not need to rely on the support of GL_ALPHA and GL_LUMINANCE that has been removed from core in recent OpenGL versions. Change-Id: Ie370379b458abf2a50e252bc5099aefc1b11fb1d Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Avoid breaking BC with new virtuals in QOpenGLPaintDeviceLaszlo Agocs2014-10-161-2/+3
| | | | | | Task-number: QTBUG-41046 Change-Id: Iab628d2d6811d528e2cc513b6f8a74baa628541d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix QOpenGLWidget on Cocoa when used as viewportLaszlo Agocs2014-10-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Having a QOpenGLWidget as a graphics view viewport was not functioning on OS X: it was showing incomplete content due to accessing the texture attached to the framebuffer object before the rendering is complete. On the normal path, when rendering is done via paintGL(), the flush was there. When used as a viewport however, this path is not used. The missing flush is now added for the other case too. For performance reasons, we will not flush on every paint engine end(). Instead, the flush is deferred until composition starts. QGLWidget also featured a weird on-by-default autoFillBackground concept. To maintain compatibility with apps that used QGLWidget as the viewport for QGraphicsView, we will now do the same for QOpenGLWidget, but only when it is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults to false, like for any other widget. The docs are extended with a small section about differences between QGLWidget and QOpenGLWidget. Task-number: QTBUG-41046 Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Use NonPremultipliedImageSrc shader when painting non-premuled imagesAllan Sandfeld Jensen2014-09-231-3/+23
| | | | | | | | | Recognize non-premultiplied images and draw them using the existing NonPremultipliedImageSrc shader so we save premultiplying them on the CPU. Change-Id: I3dfc8f9385ff91502d64ccabf4bf54049cc28040 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* 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>
* Make QOpenGLWidget publicLaszlo Agocs2014-08-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | QOpenGLWidget is now public. In addition Qt::WA_AlwaysStackOnTop is introduced to support the special case of semi-transparent QOpenGLWidget or QQuickWidget on top of regular widgets. hellogl_es2 becomes the qopenglwidget example. This example performs painting both via QPainter and native GL commands and has the OpenGL widget combined with other, normal widgets. The widget stack receives some changes when it comes to renderToTexture widgets like QQuickWidget and QOpenGLWidget. Calling update() will now result in a paint event, which is essential for QOpenGLWidget since we want it to behave like a regular widget. The dirty region handling is extended specially for such widgets due to performance reasons. (an OpenGL content update must not result in any backingstore painting, and is thus handled as a different kind of dirtiness) [ChangeLog] Added QOpenGLWidget. This widget serves as a replacement for QGLWidget. Task-number: QTBUG-36899 Task-number: QTBUG-40086 Change-Id: Ibf7f82fea99b39edfffd2fc088e7e0eadbca25cf Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Make QOpenGLTextureCache::bindTexture upload efficientlyAllan Sandfeld Jensen2014-07-041-6/+6
| | | | | | | | | | | | | | | | | | | | Currently QOpenGLTextureCache::bindTexture always convert any uploaded image to RGBA8888 before uploading. This is quite inefficient when OpenGL natively supports uploading formats in the original format. This patch adds support for uploading a few native QImage formats. This also get the performance of QOpenGLTextureCache::bindTexture on par with QGLContext::bindTexture. The texture brush used by QOpenGLPaintEngine is also converted to QImage, since bindTexture will convert it to QImage anyway, and going over QPixmap may cause an unnecessary conversion. [ChangeLog][QtGui][QOpenGLTextureCache] Support uploading common QImage formats directly to OpenGL when supported. Change-Id: I828a763126441a98e4547c32ef52dddf7c129a32 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Rename new QOpenGLContext APIsLaszlo Agocs2014-04-251-4/+4
| | | | | | | | | | | | | | 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>