The previous implementation was *extremely* expensive. It
relied on loading a binary JSON file from resources (which
involved decompressing it), then extracting information out of
it to build a gradient. Already-loaded gradients were kept in
a local cache, which had to be mutex protected.
Instead, this patch extends the gradient generator to build
static arrays filled with the web gradient data, sitting in
.rodata.
These arrays are used when building QGradient objects with a
web gradient. No explicit mutex protection is necessary, since
accesses will just read from the arrays.
As benefits, this patch removes:
* the binary json representation from QtGui's resources (~4KB
compressed, ~50KB uncompressed)
* the overhead of reading from the JSON for each used web
gradient;
* the startup costs of registering the webgradients in the
resources;
* all the overhead of mutex locking when building such
gradients;
* all the runtime memory allocations to load, parse and cache
the web gradients (including the memory + CPU spike on first
load due to the uncompression of the JSON data, as well as a
couple of deep copies).
Change-Id: If5c3d704430df76ce8faf55ee75ebd4639ba09c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
[ChangeLog][qmake] A new feature "cmdline" was added that implies
"CONFIG += console" and "CONFIG -= app_bundle".
Task-number: QTBUG-27079
Change-Id: I6e52b07c9341c904bb1424fc717057432f9360e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Some of the gradients from https://webgradients.com/ are not minified
completely, so we need to be a bit more lenient when converting them
to the internal format used by QGradient.
Change-Id: I47466b6a77abd6d2fefc1326fbf6ba5713dd74cb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Similar to Qt::GlobalColor, the presets allow the user to create
brushes based on predefined gradients, quickly getting pretty pixels
on screen.
The presets are based on the linear gradients from WebGradients, a
free collection of gradients, hosted at https://webgradients.com/.
The few radial and blended gradient presets have been excluded.
Change-Id: I1ce8f2210a6045c9edb8829ab3eddcc313549127
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>