Refactor gradient data structure


Store the corresponding brush immediately at construction; the type of
the brush is always the same during the life-time of a gradient, so we
don't need to dynamically allocate the private when constructing the
brush after each update of properties.

The setters can write directly to the private of the brush, after the
appropriate detach, realised through a overload of the static get()
helper.

This avoids data- and code-duplication, at the irrelevant cost of
allocating the brush's private at construction time.

This change revealed that the imageId was serving two purposes: the
user's image after setImage(), and the generated gradient texture
generated when painting. With the refactoring, a painted gradient would
compare different from an un-painted, but otherwise identical gradient.
Split this into a imageId holding the source that is also compared, and
textureId holding the texture for rendering that is not compared. Pass
the texture ID from the QCPaint to markTextureIdUsed(), as that is now
the one used.

Setters now also set the fine-grained dirty-flags, so moving or resizing
only mark Values as dirty, avoiding a texture lookup. Only stop and
image changes mark All dirty flags.

Addresses header review comments.

Pick-to: 6.12
Task-number: QTBUG-146286
Change-Id: I169c54bfd08ca93cf53ba5c604e7e08b8b2294a7
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
commitacb4bb7ca46be42f6d66364ac030f93bb9e05284
parent7408c71cd3e0193f4ddba762d12069b033d7095b
authorVolker Hilsheimer <volker.hilsheimer@qt.io>
committerVolker Hilsheimer <volker.hilsheimer@qt.io>
commit timeWed, 26 Aug 2026 15:49:14 +0000