Commit Graph

15 Commits

Author SHA1 Message Date
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
JiDe Zhang 85b5413dc4 Avoid unnecessary color format conversion
If a color is not the rgb format, when QColor::red() QColor::blue()
QColor::green() is used continuously to obtain the values of different
channels, three times color conversions will occur. Therefore, use
QColor::toRgb() before that to ensure that only one conversion is
performed at most. Not only rgb, the conversion of other formats is the
same.

Change-Id: Ia969e1ca6f1524ad5d7e8dec915bcbc407875c66
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-10-29 18:59:48 +08:00
Laszlo Agocs a86febf876 Fix GL_ constant usage in examples
Change-Id: Iecfa47845edb78928b388d150a3229f8c7a93d5d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-06-17 17:42:02 +02:00
Eskil Abrahamsen Blomfeldt 90bf30376c Anisotropic antialiasing for distance field text
For perspective transforms, we need to find the sample
range in the glyph cache per pixel. We can do this by
getting the gradient of the distance field at the
specific pixel.

This will ensure proper antialiasing with any
projection, but has the limitation that when glyph contours
become thinner than a pixel, they may disappear or become
too emphasized, because the hardware-gradient - based on
neighbouring fragments - is not reliable at that scale.
So we should only default to this when we detect that the
text is child of a 3D scene.

To make this smooth, we need to know the mode of the renderer
when creating the shader. So QSGMaterial::createShader()
now takes a render mode that we can use to customize behavior
based on whether it is rendering into a 2D or 3D scene.

[ChangeLog][QtQuick] The QSGMaterial::createShader() virtual
function has been extended to take a render mode argument,
which can be used for any customizations needed in the case
where the shader will be used in combination with 3D perspective
transformations.

Fixes: QTBUG-84695
Change-Id: I5a18a4edbdfa07e8f9d506c42bb20e8eb580927d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-06-15 10:20:21 +02:00
Laszlo Agocs b87b3d3d43 Make QSGMaterialRhiShader become QSGMaterialShader
After a symbiotic relationship in Qt 5.14 and 5.15, it is time for
QSGMaterialRhiShader to devour its older sibling and take its place.

This makes the direct OpenGL rendering path disfunctional. All
QSGMaterial Qt 6 TODOs are solved, the API is clean and straightforward
again: a QSGMaterial creates a QSGMaterialShader, no special flags and
options needed. (it's just that QSGMaterialShader now has a slightly
different API)

Task-number: QTBUG-79268
Task-number: QTBUG-82997
Change-Id: I545ca8d796c5535e81957c706e7832133be15b7d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-06-02 15:16:46 +02:00
Laszlo Agocs fd4f121fca Remove QSGSimpleMaterial
And port the graph example to QSGMaterial and the RHI. We will not anymore add a
direct OpenGL path (that would mean using QSGMaterialShader) for the example because
the upcoming purge renders that useless anyway.

Task-number: QTBUG-82988
Change-Id: I137575ed5df45b6bfc34a11d73dc5100945081c5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-04-07 17:08:39 +02:00
Shawn Rutledge e17c89f4ce use the override keyword consistently and correctly (clang-tidy)
Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2018-02-27 08:27:38 +00:00
Shawn Rutledge 06e962f263 init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init'
 -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix

Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
2018-02-26 13:08:30 +00:00
Kai Koehne ea6cd0de3c Fix outdated BSD license header
Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:11 +00:00
Edward Welbourne e0acbde6da Shader examples: initialize all members
Coverity (CIDs 161677, 161674) caught us setting a bad example in our
example code.

Change-Id: I395f689586f9a6ad783328b9258096cbc9ccd692
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2016-08-11 08:06:54 +00:00
Jani Heikkinen 20c207815a Fixed license headers
Change-Id: I4d5640ff95e1361ec7e65fb3e87d7726d8185ff5
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-17 13:33:18 +00:00
Jani Heikkinen c5796292ad Update copyright headers
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>
2015-02-12 10:28:11 +00:00
hjk d453b38415 Fix reading of shader sources in scene graph example
Task-number: QTBUG-33080
Change-Id: I9219233ab7c7fbe89c0a9f1453d7c6aeeca498a1
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-03-27 16:54:15 +01:00
hjk 44b16b0698 Avoid out-of-bound accesses in Qt Quick example code
Task-number: QTBUG-36197

Change-Id: I5545c36a1ce9ea6c2451c92e0e79f65e5ab26c68
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2014-02-05 16:40:10 +01:00
Gunnar Sletta 76d8f8a5d3 Graph example
Change-Id: I4a7b52f6e14182aed31354dc3860ef187e1899a4
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
2013-06-14 10:27:34 +02:00