summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qplatformbackingstore.h
Commit message (Collapse)AuthorAgeFilesLines
* Add logging for QPlatformBackingStore::composeAndFlushTor Arne Vestbø2018-08-071-0/+2
| | | | | Change-Id: I96778296480d2aaad5e01ed15353106bc90d4d2b Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Let QPlatformBackingStore handle its own QOpenGLContextTor Arne Vestbø2017-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | The resources allocated by QPlatformBackingStore are owned by the class, and should be allocated in a context the class also owns. This removes the asymmetry of having to pass in a context to composeAndFlush, while having to make the same context current before destroying the platform backingstore. The context owned by QPlatformBackingStore is shared with the associated window though a new QWindowPrivate::shareContext() API. The result is that on e.g. iOS, the backingstore does not need to tie the resource allocation of QPlatformBackingStore to the global share context, but can instead tie them to the per-window context, and hence clean them up after each window is closed. Task-number: QTBUG-56653 Change-Id: Ic1bcae50dafeeafaa8d16a7febd83b840ec6367a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Flesh out and clean up QBackingStore documentationTor Arne Vestbø2017-07-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | Some of the functions had wording that suggested people subclass QBackingStore, probably because the docs came from QWindowSurface in QWS times. Clarify the role of the region, window, and offset arguments to flush(), in the case of flushing child windows. Document that paintDevice() is only valid after calling beginPaint(), and should not be cached. Although our own QRasterWindow, and the rasterwindow example, both allow backingstores for child windows, and it works in practice on a few platforms, we keep the documentation stating that they should only be used for top level windows, until we've verified and formalized support for this across platforms. Change-Id: I7b4d6128a0cd2faeb2af9405ac1bcca46440ead1 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Compose renderToTexture widgets with sRGB when neededLaszlo Agocs2017-02-261-1/+2
| | | | | | | | | | | Just requesting an sRGB texture for a QOpenGLWidget does not lead to anything useful when it comes to the end result, the content will just get darkened. For proper operation the target window's default framebuffer must be sRGB capable and linearization during blending must be enabled. Task-number: QTBUG-50987 Change-Id: Ibad0657c29a720590fa22c84c4bc303302de6dc0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Pick up changes to device-pixel-ratio in QRasterBackingStoreTor Arne Vestbø2016-09-271-0/+4
| | | | | | | | | | | Regression from 2d2d9078, which assumed the code in QBackingStore::beginPaint would apply to macOS as well, but QHighDpiScaling::isActive() is only active when Qt does the high DPI scaling, so we never hit the resize() code-path. Adds backingStore() accessor to go from QPlatformBackingStore to QBackingStore. Change-Id: I5de2ade74e731df445ea22e0f49b2a121e678efe Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add qtguiglobal.h and qtguiglobal_p.hLars Knoll2016-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. A similar scheme and naming convention is already being used for many other modules (e.g. printsupport, qml, quick). That header will later on #include the configuration file for Qt Gui. For now it defines the Q_GUI_EXPORT macro for this library. In addition, add a private global header, qtguiglobal_p.h, that can later on include the private config header for Qt Gui for things we don't want to export to the world. Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Enable QPlatformBackingStore::toImage() when QT_NO_OPENGL is definedAndy Nichols2016-04-301-0/+2
| | | | | | | | | | | There are cases where you would want to grab the contents of a QWidget with a QSurfaceType of Raster, and in the case of a -no-opengl build there is no way to get the contents of a QBackingStore. The toImage() function was unnecessarily lumped into the QT_NO_OPENGL ifdef, so this commit removes this truncation of the API. Change-Id: I2644e3dc85339eecd8bae8b91f23ef2f29a7eee4 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-1/+2
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Optimize OpenGL binding of ARGB32PM backing storeAllan Sandfeld Jensen2016-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | Detect premultiplied backing store and upload it without conversion and adjust blend to not multiply alpha again. Task-number: QTBUG-50381 Change-Id: I51939c4f82fbb0c48eaca6e2475bf4cf3722bc2d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | 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>
* Avoid QWidget dependency in QtGuiLaszlo Agocs2015-06-011-2/+2
| | | | | | | | It's not a real dependency as all we need is to store a pointer, but better not to use the name QWidget at all. Change-Id: I30ef1dd44ac7e42c1b9c84675f94088b8c516076 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Clip QOpenGLWidget and QQuickWidget correctlyLaszlo Agocs2015-06-011-1/+3
| | | | | | | | | | | | | Introduce support for the widgets' clipRect(). Right now render-to-texture widgets in scroll areas placed close to each other result in broken (non-existent) clipping. Similarly, stack-on-top widgets fail to clip when placed inside a scroll area. This is now corrected and the qopenglwidget example is enhanced to utilize a scroll area. Task-number: QTBUG-45860 Change-Id: I859a63d61a50d64ba9e87244f83c5969dce12337 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Add flip support to QPlatformBackingStore::toTexture()Laszlo Agocs2015-05-061-1/+10
| | | | | | | | | Necessary for iOS. In addition to swizzle we also need to communicate the need for flipping, so switch to flags instead of bools. Task-number: QTBUG-40034 Change-Id: I055e591afd838878503be6f5f69aa7347965d9cf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.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>
* Introducing QPlatformGraphicsBufferJørgen Lind2015-01-171-0/+3
| | | | | Change-Id: Idcf8f75bd151a877c7097b79df998c1ffd56871c Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Prevent continuous painting with viewport QOpenGLWidgetLaszlo Agocs2014-12-181-2/+9
| | | | | | | | | | | | | | | | | | | | | Add the source widget to the texture list (may be null for custom compositor implementations that add textures not belonging to actual widgets). This allows us to do proper checks with the dirtyRenderToTextureWidgets list. As a result paint events are only sent to a QOpenGLWidget if (1) there was an update() for it or (2) it was actually marked dirty. (2) was previously behaving differently: the widget got a paint event when anything in the window has changed. This is fine for naive animating OpenGL code but less ideal for QGraphicsView. Bool properties like stacksOnTop are now stored in a flags value to prevent future explosion of texture list fields and parameters. Task-number: QTBUG-43178 Change-Id: I48cbcf93df72ac682c9b5d64982a8b648fe21ef3 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.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>
* Fix composition for windows with alphaLaszlo Agocs2014-08-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | While we will cover the entire surface with our textured quads, the clear is still necessary in order to make top-levels with TranslucentBackground render correctly: We don't want to blend transparent areas with undefined content that is in the surface's framebuffer. Blending is problematic for alpha values. We now prevent the blended alpha from being written out. This ensures that in examples like qquickviewcomparison, where the backingstore image contains an alpha of 0.5 while the QQuickWidget texture 1.0, the result is still an alpha value of 1.0 in the final image. Writing out an alpha of 0.5 would break on systems where windows get an alpha buffer by default. hellogl2 can now take a --transparent parameter which makes the QOpenGLWidget being cleared to transparent in order to verify it works in combination with Qt::WA_TranslucentBackground. The swapped red and blue problem is also corrected. RGBA8888 does not need swizzling. The only format that needs this is RGB32. Task-number: QTBUG-40716 Change-Id: I54a9fd3a91a1b59575b38cdb908835315514e40f Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Make QOpenGLWidget publicLaszlo Agocs2014-08-011-1/+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>
* Fix UI squishing when using QWidget::setRenderToTextureJocelyn Turcotte2014-04-031-1/+1
| | | | | | | | | | When resizing a window, a window might not be resized synchronously with its backing store. We need to use the actual texture size as the transform to avoid stretching the rendered texture. Change-Id: I945f6d190577ccdcb54483a267a1e42df1ca3156 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* QOpenGLWidget and new-style compositing on eglfsLaszlo Agocs2014-02-131-0/+2
| | | | | | | | | Integrate with QOpenGLTextureBlitter, QOpenGLWidget and friends. Change-Id: Ic2867b713a21a3d2820d546174fc9164b3dd220c Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Enabling QQuickWidget and QOpenGLWidgetPaul Olav Tvete2014-02-121-0/+32
| | | | | | | | | Enable child widgets (without a native window) that render to an FBO and are composed with the raster backingstore by the platform plugin. A preliminary version of QOpenGLWidget is included as private API. Change-Id: I8f984a4d7db285069ce3d6564707942c823d890d Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* qpa api: replace QPA headers with something more benignGirish Ramakrishnan2012-05-221-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current 'we mean it' headers are considered too aggressive for QPA. Replaced using the following script. for file in `find -type f -name "qplatform*.h" -and -not -name "*_p.h"`; do LINE_NO_1=`grep -n -m 1 "W A R N I N G" $file | awk -F ':' '{print $1}'` LINE_NO_2=`grep -n -m 1 "We mean it." $file | awk -F ':' '{print $1}'` if [ -z "$LINE_NO_1" ]; then LINE_NO_1=`grep -n -m 1 "#define " $file | awk -F ':' '{print $1}'` LINE_NO_2=$((1+$LINE_NO_1)) else LINE_NO_1=$(($LINE_NO_1-2)) LINE_NO_2=$(($LINE_NO_2+2)) fi head -n $LINE_NO_1 $file > $file.new cat >> $file.new <<EOF // // W A R N I N G // ------------- // // This file is part of the QPA API and is not meant to be used // in applications. Usage of this API may make your code // source and binary incompatible with future versions of Qt. // EOF tail -n +$LINE_NO_2 $file >> $file.new mv $file.new $file done Change-Id: I8a974c9bf8942647b7ad950afb372c1f738aa725 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix QPA files inclusion headersGirish Ramakrishnan2012-05-151-3/+3
| | | | | | | find . -name "*.h" | xargs sed "s/^#\(.*\)_QPA_H/#\1_H/" -i Change-Id: Ifa96f8cfcb67070a961c7e5f05719b82653a1174 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Expose QPA API under qpa/*Girish Ramakrishnan2012-05-071-0/+102
The main reasons for doing this are: 1. _qpa.h end up in the master QtGui include file. QtGui is meant for userland applications. qpa code is neither binary nor source compatible. Inadvertant use of QPA api makes the user code binary-incompatible. 2. syncqt creates forwarding headers for non-private header files. This gives people the impression that this is public API. As discussed on the mailing list, even though QPA api is internal and subject to change, it needs to treated differently from private headers since they will be used by in-qtbase and out-of-qtbase plugins. This commit does the following: 1. The _qpa in QPA header files is dropped. 2. syncqt now treats any file with qplatform prefix as a special file and moves it to qpa/ directory. The recommended way of using QPA API in plugins is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API from multiple modules (for example, qplatformfoo might be in QtPrintSupport) 3. The user needs to explicitly add QT += <module>-private to get access to the qpa api. 4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo includes. This commit does not change the cpp filenames. This requires a more careful merging of existing non qpa cpp files and existing cpp files on a case by case basis. This can be done at anytime. The following files are not renamed as part of this changed but will be fixed as part of a future change: src/gui/kernel/qgenericpluginfactory_qpa.h src/gui/kernel/qgenericplugin_qpa.h src/gui/kernel/qwindowsysteminterface_qpa.h files were renamed using for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done includes were renamed using script for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \ -e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \ -e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \ -e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \ -e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \ $file done Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>