Track texture usage and keep gradients cache within limits


When the gradient had more than 2 stops and stop position or color
change to combination which doesn't yet exist, a new texture gets
created. Until now these haven't been managed, so animating multi-stop
gradients could create a big amount of textures.

Fix this by:
- Enable texture tracking by default. Add
  QCPAINTER_DISABLE_TEXTURE_USAGE_TRACKING env variable to disable this.
  Disabling can be useful to avoid overhead when user knows that
  gradients do not cause memory usage issues in the target system.
- Add also QCPAINTER_MAX_TEXTURES env variable to control when the
  cleaning kicks in. By default this is at 1024 unique textures.

Pick-to: 6.11
Change-Id: I4c02ecc5ca57250d052bbd3e747f4481bf6cea41
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Owais Akhtar <owais.akhtar@qt.io>
commitea45e2232354d499e7e6809e4b0ef5cb4abd853f
parent8b7b5af993cf6f3a62177a15ed27664aa921d9eb
authorKaj Grönholm <kaj.gronholm@qt.io>
committerKaj Grönholm <kaj.gronholm@qt.io>
commit timeMon, 22 Dec 2025 17:56:17 +0200