Now the parameters from the prototypes are used as default values and
the graph file can overload them.
Change-Id: I9a8a73963c7e578bd0a34e96f76f147a12224f4f
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This will allow to make the prototypes more extensible when referred to
from a graph file while providing some sane defaults.
Change-Id: I1ae10182427d8a7d29c51a64e19e99139494ea92
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This will allow to create nodes having an entry point for tuning, still
need to be exploited by the loaders and the shader generator. Coming in
further commits.
Change-Id: I8384b0f528c9919e9f8d35102adde2b307f08b80
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
We forgot to check that the node content was correct and complete when
loading the graph.
Change-Id: Id4ee6aaba6ca268b0785e7fa3fb51a19817e7c9c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Changes internal data-size and pointer calculations
to qssize_t.
Adds new sizeInBytes() accessor to read byte size, and
marks the old one deprecated.
Task-number: QTBUG-50912
Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fix a number of issues that caused polygons to not always be drawn
fully connected.
Ensures the original lastPixel is set when drawing closed polygons,
ensure we don't round away from the original starting point, and add
handling of edges that need to be rounded half a pixel sideways to line
up with endpoints.
Task-number: QTBUG-27053
Change-Id: Ib51ee5623a629996af51a0967096383f04e91e2f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Especially in examples, where we should show off our convenience
functions, prefer calling these functions over doing arithmetic with
M_PI (or approximations thereto) and 180 (give or take simple
factors). This incidentally documents what's going on, just by the
name of the function used (and reveals at least one place where
variables were misnamed; the return from atan is in radians, *not*
degrees).
Task-number: QTBUG-58083
Change-Id: I6e5d66721cafab423378f970af525400423e971e
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reads the v4 and v5 info-header together with the rest of the info-
headers, and use that to report the correct image format before
decoding.
Change-Id: I69e2bcc54367b7f14820815ae2ae1fa2d8d5dc8c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Like other QWindow properties we can just store it, and the platform
window should pick it up on creation like other properties.
[ChangeLog][QtGui][QWindow] setMask() no longer requires the window
to be created to have an effect; it can be set at any time.
Change-Id: I55b616363801b770bd61bda5325b443013b99866
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Currently a file with a .9.png extension will only have its @2x variant
found if it follows this format:
foo.9@2x.png
Since ".9" should be considered part of the file suffix, it should
ideally be able to look like this and still be picked up:
foo@2x.9.png
This patch makes qt_findAtNxFile() account for .9.* extensions.
This is needed for the image-based style support in Qt Quick Controls
2, which uses 9-patch images.
qmlbench benchmark results using
benchmarks\auto\creation\quick.image\delegates_image.qml with
QT_SCALE_FACTOR=2 show no difference in performance after this patch
is applied.
[ChangeLog][QtGui] High DPI variants of 9-patch images can now be
loaded using the following syntax: "foo@2x.9.png"
Change-Id: I6d1384113bef21b4fe85a104ee6b16869c93b077
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The return order of the keys is random, so let's sort both first, then
we can compare the lists. Should get rid of the test flakiness.
Change-Id: I2e89d3cc603da6a4667b3677350baa4d40d59b45
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This class allows to node definitions from a JSON representation. This
will come in handy to ship preset prototypes for use with
QShaderGraphLoader.
Change-Id: I3f3b5d7852e17d484069b4814ee6e5910997c613
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This class allows to load a shader graph from its JSON representation.
To avoid duplicating the shader snippets inside of the JSON which would
be a maintenance nightmare, we instead allow to register a set of node
prototypes by their name and only refer to said names inside the JSON.
Change-Id: I3e7b39e8b3c25f51f331a0a59dda883ac8e2bc57
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This class is meant to generate code from shader graphs
Change-Id: I1cf22352387f3f9f55e7589aa77a296689836911
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This is our "byte code" representing a flattened graph. It will be used
as input for the code generation.
Change-Id: Ie02a60d07c035f3d16872e79931eb7cde168a8d1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This allows to connect our nodes together via ports. This way user code
can assemble a shader from simpler blocks.
Change-Id: I168dcf4af6aa11ad47b68d91e5a55e96ca922678
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Nodes will allow to describe inputs, outputs or value transformations in
a shader graph.
Change-Id: I44f806d9595fd0e68fc9026cda2b4fa0a62af283
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
The ports will be used to connect nodes from our shader graphs.
Change-Id: I9d4fbb1f7bd8320c4373ebb166a4fe13bd1482c9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This is the first building block toward a node based generator for
shader programs.
QShaderFormat will be used by the other classes to qualify in which
format the code snippets and includes used are.
Change-Id: I11aefc6bb359832a853ed1b6bec302dc3516cfc4
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Use M_PI (and friends), where possible, in favor of hand-coded
approximations of various (in)accuracies. Where that's not available
(e.g. fragment shaders), use the same value that qmath.h uses for
M_PI, for consistency. Replaced math.h with qmath.h in places that
defined a fall-back in case math.h omits it (it's not in the C++
standard, although M_PI is in POSIX); or removed this entirely where
it wasn't used.
Reworked some code to reduce the amount of arithmetic needed, in the
process; e.g. pulling common factors out of loops. Revised an
example's doc to not waste time talking about using a six-sig-fig
value for pi (which we no longer do) - it really wasn't relevant, or
anything to be proud of; nor did the doc mention its later use.
Task-number: QTBUG-58083
Change-Id: I5a31e3a2b6a823b97a43209bed61a37b9aa6c05f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test was never loading images from a valid path, and thus never
had any fullfill the base option which meant nothing was tested.
Making it work revealed that the Format option on BMP formats doesn't
predict semi-transparent files.
Change-Id: I7035a0f63ebfbce940ce7a17a6142cf177480798
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Similar on how it is done for Windows desktop we also use the given
style hint when building the list of fallbacks a font family.
Change-Id: I71378581d07f20ebe5bf0bc757bba919cc70e118
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
This method now returns -1 by default, due to commit 6255cb893d
which mistakenly replaced -1 with Qt::IgnoreAction (0x0).
As a result, dropping is forbidden in a number of applications
(I detected this in zanshin).
Change-Id: I4922451216e08d5d3fe36f8ba87364a361b691bf
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
We have to use a temporary data path for winrt, as the applications
are sandboxed and cannot just put data anywhere.
Change-Id: I8f95de132e5b5ac77441cbbf26af873b8018c7cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Corresponds to the similar function QPainterPath::intersects() and is
faster than calculating the intersection and then checking if it is
empty.
Change-Id: I694bb2206ed330a456a41d4118a952a68177b7a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
QPainterPath could in certain cases where sub-path points were on the
border of a rect fail to calculate intersects() correctly.
The patch adds handling of such cases by looking if end points cross in
or out of the rect. Other cases are already caught.
Task-number: QTBUG-31551
Change-Id: I6284da8ff8646d4636702923a76362302dde5767
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Return an empty size if no suitable entry found to avoid mismatch with
the returned pixmap()'s size (the QIconEngine::actualSize() returns the
originally requested size).
Change-Id: Ia278719a54392b62c5f9fc0529476baba5cd7df0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The intersection algorithm for intersection with rects, might return
one edge of the rect even if that edge does not intersect with the path.
To deal with that we collapse paths with empty bounding rects to the empty path.
Task-number: QTBUG-60024
Change-Id: I3e305983c66548e772d7d7ce3de99d715edbdd1b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Changed testing of focus of modal dialogs to match behavior on offscreen
and minimal platforms.
Change-Id: Ife3ea41b4b78df2e64c8d8e740332914b1e5a67c
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
... for calculated test data names.
In tst_qimage.cpp, use QLatin1String instead of QString for image
format pretty-printing, to avoid needless memory allocation and, more
importantly in the context of this patch, to make the result usable
with addRow(), which does not support %ls.
Change-Id: Ib1953aee2da235ae912917a450491ac8be69ca3a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
CSS style such as "line-height: 1.5;" should be used as a multiplier,
but Qt uses it as percentage which makes line spacing way too small. To
workaround this, convert it to percent and use as
QTextBlockFormat::ProportionalHeight instead.
[ChangeLog][QtGui][Important Behvior Changes] Changed CSS line-height
property with multiplier to follow CSS spec
Task-number: QTBUG-56848
Task-number: QTCREATORBUG-17683
Change-Id: Icc98f7c0d4d07542a220702c287f23fa450ef875
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Fixes two separate errors. QImage::transform was incorrectly adding
colors to the color-table of the returned image when the converted image
would not be indexed, and qpnghandler was looking at non-empty color-
table instead of color format.
Task-number: QTBUG-43708
Change-Id: Ife14b6428ca65ac7d3a0b36a89a73e56d64586b4
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
When multiplying a QMatrix4x4 by itself, we were clobbering the very
matrix we read from. Employ read-caching to avoid this aliasing problem.
[ChangeLog][QtGui][QMatrix4x4] operator*=() now calculates the correct
result even if the RHS and LHS are the same object.
Change-Id: I8534d56cfdd62c336577125127f05173fcec2873
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
<div>1<br/></div>2 was inserting two newlines between 1 and 2, while all
tested web browsers only insert one newline - as long as there is nothing
between the <br/> and the </div>.
This was the cause for extra newlines being inserted in KMail when
replying to HTML emails, such as those generated by gmail.
Change-Id: I5145d977701e68913264357bba22780e7cdd3f7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Now set the QImage devicePixelRatio so the content is correct on all
screens.
Task-number: QTBUG-53795
Change-Id: Ic92eee98f691ebb1e0212498c1ae13ede74bca93
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
If we do not the fontDef of the multifont will be the default 0.
Task-number: QTBUG-59443
Change-Id: Ib223517975b2a57b2371e309d12cd8f918d30825
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Make it possible to blacklist the (newly created)
quitOnLastWindowClosedMulti() if all else fails.
Task-number: QTBUG-59088
Change-Id: I8c143a2017e7aefaf6cad6ada9c1464d40c952e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
... leveraging the existing support for QLatin1String, which is the
char equivalent of QStringView.
The only noteworthy changes here are the port of the low-level
functions to size_t and that the internal template function,
setColorFromString(), can now take its argument by value, since only
views are ever passed to it anymore.
In the test, used new QTest::addRow() to format test names, and
introduced temporaries to avoid re-calculating the same input values
for every check.
Change-Id: Ia3c59e5c435ff753f34993a8d85c0c0b4e8e2b22
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Only test for xcb specific sub-features if xcb is available in
the first place - not the case with Boot2Qt builds.
Change-Id: Iad49648ce1c8781d0c7bb2b2dcd4b7834434d51d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
If the respective modules aren't available we cannot build the tests
and examples. We drop the qtConfig(opengl) requirement for the opengl
examples as
a, we would need to make the QtGui configuration available for that to
work, and
b, we should not add too much detail to the tests and examples build
configurations. Checking each test and example for every feature it
uses would be too much.
Task-number: QTBUG-57255
Change-Id: Ifb043c81ec9e5c487765297bd65704812cd281fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
A convenience subclass of QWindow that provides a Vulkan-capable
window with a double-buffered FIFO swapchain.
While advanced use cases are better served by a custom QWindow
subclass, many applications can benefit from having a convenient
helper that makes getting started easier.
Add also three examples of increasing complexity, and a variant that
shows embeddeding into widgets via QWindowContainer.
[ChangeLog][QtGui] Added QVulkanWindow, a convenience subclass of
QWindow.
Task-number: QTBUG-55981
Change-Id: I6cdc9ff1390ac6258e278377233fd369a0bfeddc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
For Android, Windows and xcb. Verified on Win10 with NVIDIA, Win10
with AMD, Android with Tegra K1, Android aarch64 with Tegra X1, and
Linux aarch64 with Tegra X1 (Jetson TX1, L4T).
Introduce QPA-based Vulkan library loader, core function resolver, and
instance creation support. In addition to creating a new VkInstance,
adopting an existing one from an external engine is supported as well.
The WSI specifics are hidden in the platform plugins. Vulkan-capable
windows use the new surface type VulkanSurface and are associated with
a QVulkanInstance.
On Windows VULKAN_SDK is picked up automatically so finding vulkan.h
needs no additional manual steps once the LunarG SDK is installed.
[ChangeLog][QtGui] Added support for rendering to QWindow via the Vulkan
graphics API.
Task-number: QTBUG-55981
Change-Id: I50fa92d313fa440e0cc73939c6d7510ca317fbc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
When the insertion into the cache fails then it will delete the entry
for us which already calls releaseKey(). So we should not call it a
second time.
Task-number: QTBUG-58259
Change-Id: I816c6f29ef97fe3a245f145c4faf1e0649f72dc5
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Carbon is deprecated and we should not rely on it at runtime or compile
time. These headers were only included for a small collection of
keyboard key constants which have now been hardcoded instead.
Change-Id: Ia2eaa267584b63be8019be3bbf64cba897a985a8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
The color values of ppm and pgm images can be either 8 or 16 bits.
They can also be scaled to a smaller max value, and they can be
expressed either binary or ascii. For some of these permutations, Qt's
image handler lacked implementation or would decode the wrong color
value. This commit fixes that.
Task-number: QTBUG-18262
Task-number: QTBUG-35990
Change-Id: I7cf11c2366244f3a9b31c1a565a81e2658bc6a51
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This is not a bug in QImageWriter, but caller code. We should be
explicit about what the problem was so it can be fixed.
[ChangeLog][QtGui][QImageWriter] Add QImageWriter::InvalidImageError to
communicate invalid attempts to write a bad QImage (for instance, a null
QImage).
Change-Id: I0333b8263f1da1c672bed17dab48bfd6cafe41a2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The cumbersome complex calls to QMatrix were surely easy to write
thanks to copy-and-paste; but this left the reader to either
laboriously check or guess that all the copies were the same (and
notice that there were two, in fact). DRY.
Since QMatrix wants qreal data, change the float deg angle to a qreal
and work in qreal throughout. Passing the angle to a function instead
of repeating it obviates the need for a local variable in the calling
code, to hold its value.
Change-Id: I6bb4adf438a893083ca19f27942502c1e5c518aa
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).
Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).
This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.
Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
We can defer the creation until the window is shown.
Change-Id: I3d5b45ae59ee0925996cf12cd46dd574c8c6ef95
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Remove the line setting the DPR from the source; the image
is moved.
Task-number: QTBUG-58653
Task-number: QTBUG-58645
Change-Id: I2de94681459dba1d69dee06da44617fb9fa35bcc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
When calculating the width of a text for drawing decorations on top,
we use the effective advance of the whole text after it has been
through the shaper.
However, in the case of QStaticText and QGlyphRun, there is shortcut:
Since we only have the glyph indexes and position of each glyph,
we use the position + advance of the right-most glyph to find the
right-most edge of the decoration. For this, however, we use the
advance of the glyph *out of context* of the rest of the string,
because the whole idea is to avoid doing the shaping of the string
with every draw call. In some rare cases, the advance of the
right-most character, in the context of the string, is different
from the advance of the standalone glyph.
Now, one way of fixing this would be to store the width of the
text in QStaticText and QGlyphRun, but since it is a very rare
artifact which is barely visible, I have opted to just work around
it in the test instead, the workaround being to force integer
metrics so that we don't get the small 0.2 pixel error.
Task-number: QTBUG-55217
Change-Id: I8d16d52f2ef27275cabb7d3865aeeaa31617ba3d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Recent HB changed the way of handling ZWJ/ZWNJ to be more in par
with other engines.
Change-Id: I8abacd195e4b247c8fa6d91ef1086e74da0a1efb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The QFontMetricsF version of the test should not truncate the
returned values, as the results may then be wrong.
Change-Id: I17f97f846bb723709e695e8866e437d6888d275b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
OpenSUSE has a bitmap font called "Waree" while the test
is created for the TrueType font which is available on Ubuntu.
The style names are different, so we can use that to check
that we have the right one.
Change-Id: I808d0d1ecde9f10ed7730dc76ab3818490002ba9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Qt already supports high DPI icons using the “@nx” approach, where the
device pixel ratio that the image was designed for is in the file
name. However, our implementation of the freedekstop.org Icon Theme
specification did not support the Scale directory key:
https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
This meant that users creating icons via QIcon::fromTheme() did not
get high DPI support. This patch fixes that.
[ChangeLog][QtGui][QIcon] Implemented support for Scale directory key
according to Icon Theme Spec. Icons created via QIcon::fromTheme()
now have high DPI support by specifying the Scale in the appropriate
entry of the relevant index.theme file.
Task-number: QTBUG-49820
Change-Id: If442fbc551034166d88defe607109de1c6ca1d28
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Amends 7896ae052a. The previous change
focused only on ZWJ and ZWNJ, but there are many other formatting characters
that we need to support and that may be rejected by the German keyboard-hack.
This opens up for all characters in the Other_Format category.
Task-number: QTBUG-58364
Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Use the new QImage method instead of operating on private API.
At the same time the code is improved to ensure the QImage is detached.
Change-Id: Ia015c0bb18d7bc62da38397594730254843e5a0d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
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>