aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcanvasitem.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix QQuickCanvasItem::toImage() high-DPI captureMorten Johan Sørvig2017-03-311-7/+10
| | | | | | | | | | | Make toImage() work for devicePixelRatio > 1 by scaling the source rect. Also set the devicePixelRatio on the returned image. Task-number: QTBUG-59170 Change-Id: I0c8ccd562c1cf1e89ff37ca1806b46296480b0d0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-131-0/+1
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlimport.cpp Change-Id: I26f8d18fe8af664ee8573116f182fe12b71e089a
| * Fix build for -no-feature-quick-shadereffectStephan Binner2017-02-271-0/+1
| | | | | | | | | | Change-Id: I334603209818a8030ddb5b5b316cab596c328bf1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Build fix for -no-feature-quick-shadereffectPaul Olav Tvete2017-03-101-0/+1
| | | | | | | | | | Change-Id: Ie1f601c6ae4c6c5d8d23b14a6670979d9c24e209 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Canvas Item: Prevent polish loop when calling requestAnimationFrameAndy Nichols2017-02-021-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | Currently if you call requestAnimationFrame within the callback given by requestAnimationFrame there is a polish loop. This is however the common way when using Canvas2D in the browser to get screen refresh rate animations. This patch makes sure that polish won't be called when processing polish items by calling polish indirectly. Task-number: QTBUG-55778 Change-Id: Ib96e39f7ca3cecc33609976e9049cc309768f9f7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-141-1/+0
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I9d87ed86e95b5901a86cc3aa65d7ac39b0b708c2
| * Fix crash in CanvasGunnar Sletta2017-01-101-1/+0
| | | | | | | | | | | | | | | | | | | | The Image based code path will delete the texture in textureForNextFrame() so deleting it again here is wrong. The convention is supposed to be that if the textureForNextFrame returns 0, it also deleted the input texture. So not deleting is correct for both Image and FBO. Change-Id: I45a5ef94c13358f3637f51ae2d21224518ea6a25 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Port existing qmlInfo callers to qmlWarningRobin Burchell2017-01-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that qmlInfo actually reports info messages, we want to change existing callers to use warning-level messages to preserve the original message level. This was done through: perl -p -i -e "s/qmlInfo\(/qmlWarning\(/" **/*.{cpp,h,qdoc} .. with a little care taken to only add the hunks that should be changed. Change-Id: I511cee11ce0a26ec1048cd2b84c7536b812a0d89 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-141-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-1/+1
| | | | | | | | | | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQuickCanvasItem: optimize mimeToTypeAnton Kudryavtsev2016-10-181-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | Provide early out, if mime is not image. If mime is image, we can drop reduntant 'image/' prefix from all strings. Also we can pass type in lower register to QImage::save(), so use only lower register in this function to de-duplicate .rodata strings. Change-Id: I6365edbe3c24ae096c5b1c23e8707299a8a5d5f3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QQuickCanvasItem: use QStringLiteral lessAnton Kudryavtsev2016-10-131-18/+22
|/ | | | | | | | | | | | | QStringLiteral was used to store type of image, but it was needless wrapper, because it always was be converted to char* to pass to QImage::save(), so replace it with char* to save allocations and text size. Also replace QStringLiteral().arg().arg() pattern with QStringBuilder. Again save allocations and text size. Change-Id: I6614e127789a05069da200c263145654a289b309 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-301-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/quick/items/context2d/qquickcanvasitem.cpp src/quickwidgets/qquickwidget.cpp tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp Change-Id: Idf279cb88e0df2a383489af5b6afdf04d04ae611
| * Use QDateTime::currentMSecsSinceEpoch() instead of currentDateTimeThiago Macieira2016-06-221-1/+1
| | | | | | | | | | | | | | More efficient if all you want is the number of seconds. Change-Id: Ib57b52598e2f452985e9fffd145a36f2b3c703ea Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Add cross-backend simple rect, texture, and ninepatch nodesLaszlo Agocs2016-06-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSGSimpleRectNode is deprecated -> use QSGRectangleNode via QQuickWindow::createRectangleNode() instead. QSGSimpleTextureNode is deprecated -> use QSGImageNode via QQuickWindow::createImageNode() instead. The OpenGL version of the simple rectangle node is switched over to the vertex color material instead of flat, to allow for better batching. Use the same concept for nine patch nodes. The "style" node from Quick Controls 1 is now QSGNinePatchNode in order to provide a proper cross-backend solution which is already necessary due to the software backend, but now generalize it to apply to the accelerated backends with proper materials as well. QC can now simply call createNinePatchNode() without further ado. Also fixes a bug with the D3D12 texture material not enabling blending when needed. When it comes to the internal class names, QSGRectangleNode and QSGImageNode get the Internal prefix in the adaptation layer in order to differentiate from the public API. This involves quite a lot of renaming, but results in a nice and clean public API. Change-Id: Iddf9f9412377843ea6d652bcf25e68d1d74659ea Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | V4: Pass scope around as parameters inside the runtime.Erik Verbruggen2016-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-3/+7
|\| | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp Change-Id: I26d6435a29cac3840bb567ade5149c2562a94bf9
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-101-3/+7
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of 0e053528 was reverted in the merge, about lastTimestamp. It will be applied later in separate commit. qmltest::shadersource-dynamic-sourceobject::test_endresult() was blacklisted on linux. Conflicts: .qmake.conf tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp tests/auto/qmltest/BLACKLIST tests/auto/qmltest/qmltest.pro Task-number: QTBUG-53590 Task-number: QTBUG-53971 Change-Id: I48af90b49a3c7b29de16f4178a04807f8bc05130
| | * Avoid Canvas crashes with qtquickcompilerLaszlo Agocs2016-05-241-3/+7
| | | | | | | | | | | | | | | | | | Change-Id: Ic87052308706b8ef71e2f27837abfbaea57c43cc Task-number: QTBUG-49692 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into HEADLaszlo Agocs2016-05-241-0/+1
|\| | | | | | | | | | | Change-Id: If91e0e28d004f1db978dcab393f189743bb69cd5
| * | V4: allow inlining of ExecutionEngine::{qml,js}Engine()Erik Verbruggen2016-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | All other changes are just to be able to include qv8engine_p.h in qv4engine_p.h Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | QQuickCanvasItem: Don't set QSGGeomety in updatepaintnodesAndy Nichols2016-05-061-5/+3
| | | | | | | | | | | | | | | | | | | | | Just rely on the QSGImageNode to modify the geometry. Change-Id: I91967ba987ac08a1950cc3fd8aa1c1af25537316 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | | D3D12: Fix up Context2DLaszlo Agocs2016-05-031-26/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Querying openglContext() on a non-GL specific path is never a good idea. The usage of QSGSimpleTextureNode is replaced with the correct multi-backend way, i.e. creating an image node via the adaptation layer. Demos like stocqt are now functional with the d3d12 backend as well. Change-Id: I24a6b85163fec5841349057e2fec0be6cbf01130 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | D3D12: Painter nodeLaszlo Agocs2016-05-031-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | Only supports QImage backing. As a bonus add some notes to the Context2D docs too. Change-Id: I18457a1f766d2f136c6864ec06fe596668d5e726 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | | Enable building Qt Quick module with QT_NO_OPENGL definedAndy Nichols2016-03-221-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the Qt Quick module depends on either the OpenGL or OpenGLES headers being available at build time. Since we are adding support for adaptations that do not depend on OpenGL, it should be possible to build Qt Quick in environments that do not have OpenGL development headers. This does present many challenges though because in some cases GL types, and classes that require OpenGL are part of the public APIs. However since these classes were never available when QT_NO_OPENGL was defined, it should be possible to redefine the function signatures under this scenario, since it's not possible to break binary compatibility if there never were any binaries to break compatibility with. One of the bigger changes that was necessary to facilitate this change is creating interfaces out of QSGContext and QSGRenderContext. Here the default behavior was usage of OpenGL directly, even though subclasses could override all OpenGL usage. Making them interfaces should bring QSGContext and QSGRenderContext more in line with the other classes present in the adaptation layer. Change-Id: Iaa54dc0f6cfd18d2da1d059548abf509bd71f200 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-221-0/+8
|\| | | | | | | Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2016-01-191-0/+8
| |\ | | | | | | | | | Change-Id: Ieb48911638b5c1acdfd4dee8aa19dca9be99a1f6
| | * docfix: Make it clearer how Context2D relates to CanvasGunnar Sletta2015-11-301-0/+8
| | | | | | | | | | | | | | | Change-Id: Id64aff29ef8bc7cbb4f7fc46b1a0d30a47585055 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* | | Updated license headersJani Heikkinen2016-01-191-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: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | QQuickCanvasItem: fix expensive iteration over QMap::keys()Anton Kudryavtsev2016-01-141-2/+2
|/ / | | | | | | | | Change-Id: I97cc704d2ddbb8161de8680ae3fa787d4a6255f5 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-021-0/+6
|\| | | | | | | | | | | | | Conflicts: src/quickwidgets/qquickwidget.cpp Change-Id: I3e2326bc86a9d3adaafbe3830b75ce9afa81c45b
| * Make Canvas::layer::enabled workGunnar Sletta2015-09-111-0/+6
| | | | | | | | | | Change-Id: I3e159ea6d02f415307db6d45470665085aaa023e Reviewed-by: Michael Brasser <michael.brasser@live.com>
* | Mark Canvas::tileSize and Canvas::canvasWindow as obsolete.Gunnar Sletta2015-09-281-13/+4
| | | | | | | | | | | | | | | | | | The feature has never worked properly and the documentation is misleading. Task-number: QTBUG-33129 Change-Id: I75c5073ebf4ca10f45d42aca76444ab3d7fb3820 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
| * Fix crash in QQuickCanvasItem::updatePaintNode()Tobias Koenig2015-08-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | QQuickCanvasItem manages the life time of the texture already, so it shouldn't set the ownsTexture flag on the QSGSimpleTextureNode, because that would result in a double deletion when QSGSimpleTextureNode::setTexture() is called. Change-Id: I7c1cc949b664d1a8b64bab092250439171e66233 Task-number: QTBUG-47714 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Some cleanups to QQmlRefCountLars Knoll2015-06-051-1/+1
| | | | | | | | | | | | | | | | | | Rename QQmlRefPointer::take to adopt, as it's a better fit with the semantics. Get rid of the assignment operator from a raw pointer and add a Adopt argument to the constructor. Change-Id: Ia1ebe42b24570f32543e783f91eb3206602772a2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-1/+1
|/ | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Doc: corrected some language issuesNico Vertriest2015-04-171-1/+1
| | | | | | Task-number: QTWEBSITE-628 Change-Id: I608c4fe5e18f6494cc03377080a536a01be232ca Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-1/+6
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf LICENSE.GPLv2 examples/qml/networkaccessmanagerfactory/view.qml src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4stringobject.cpp Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
| * Ensure that Canvas has the correct size with complex bindings.Mitch Curtis2015-01-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a Canvas is a child of an item with certain width and height values (as described in the bug report), it won't paint correctly. For example, the order of events might occur like so: 1. Canvas width set to 1 2. Canvas height set to 1 3. Canvas width set to 32, which causes the height to also be set to 32 Every size change causes QQuickCanvasItem::geometryChanged() to be called, but the third event above causes it to be called recursively, such that the most nested call results in the size being 32x32, but then the execution returns to the first call and 32x1 is used instead, overwriting the correct size. We fix this by setting the new canvas size to width() and height(), ignoring the recursion and instead using the latest size of the item. Change-Id: Iebbcbfaa3217319b32b97f6b68f7a8af197a0e89 Task-number: QTBUG-42878 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
| * Canvas: don't crash when getContext("2d") is called on destruction.Mitch Curtis2015-01-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd assume that a Window existed when that's not always the case. For example: import QtQuick 2.4 import QtQuick.Window 2.2 Window { Loader { sourceComponent: Canvas { Component.onDestruction: getContext("2d") } Component.onCompleted: active = false } } Change-Id: I5f30876e21ced5658adfa3bac494fd4196e0a7e3 Task-number: QTBUG-42222 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-121-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. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* | Get rid of most uses of ValueRefLars Knoll2015-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Make sure we always have an engine when assigning to a PersistentLars Knoll2015-01-131-1/+1
| | | | | | | | | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove v8engine from qmlcomponent and canvas2dLars Knoll2015-01-081-1/+1
|/ | | | | Change-Id: I575ba208de24ffe90bd02905aba67b0b08c5115e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Canvas documentation.Mitch Curtis2014-10-301-6/+6
| | | | | | | | | | | getContext documentation wasn't showing up due to a syntax error: "any ..." Also fixed some small issues here and there. Change-Id: I3c0444d25bd0fea72fb4fcbf07b3e00794ff1414 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* Make Canvas use texture atlas for smallish Image based canvases.Gunnar Sletta2014-09-301-1/+1
| | | | | | | | | | | This makes Canvas with Image batchable in the renderer which means that it is feasible to have 100s of small Canvases in a scene, for instance as static icons rendered with a bit of script. Change-Id: I3ad57360d632b7093fd6993afa88ed35c21d178a Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Doc: apply title case to all section1 titlesNico Vertriest2014-09-241-1/+1
| | | | | | Task-number: QTBUG-41250 Change-Id: I303d989992c9685f73baae50c64accf71b43549f Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Don't assume a QSGRenderContext is valid just because it's not 0Ulf Hermann2014-09-171-1/+4
| | | | | | | Task-number: QTBUG-41353 Change-Id: I2a8c500ed974b3e5f45f3a1eb1f66c7a24b17d56 Reviewed-by: Andy Nichols <andy.nichols@digia.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Check for valid QSGRenderContext instead of QOpenGLContextAndy Nichols2014-09-111-1/+1
| | | | | | | | A QQuickWindow with a valid QSGRenderContext is what should be checked for in QQuickCanvasItem::itemChange. Change-Id: Ibb85c2bb79d85b2d91b5d68cfa8a4760106047ae Reviewed-by: Gunnar Sletta <gunnar@sletta.org>