text: Consistently use VLAs, drop vectors


The main, and only typedefs are now in
QCRhiDistanceFieldGlyphCache:

  using VertexList = QVarLengthArray<TexturedPoint2D, 256>;
  using IndexList = QVarLengthArray<uint32_t, 384>;

Everything else is using these typedefs, instead of replicating
them sometimes with QVLA, sometimes with std::vector.

In QCDistanceFieldGlyphCache we can avoid a copy of the vertex and
index data, since QCRhiDistanceFieldGlyphCache::generateVertices()
can give the desired result right away, by generating uint32_t
indices in the first place, and the index values do not need additional
offsetting at all if generateVertices appends to the same container
for all glyph runs. No temporary, work lists are needed.

Then, instead of creating local variables again and again in
QCPainterEngine::fillText(), which is especially not ideal with
containers that allocate right from the first item, use member
variables instead.

Thus getting rid of any kind of allocation, as long as the capacity of
the two lists is big enough. This works because when generating
vertices/indices, clearing is now done with QVLA::clear(), which keeps
the allocations.

We apply a simple limit, however, and not keep the QVLA allocations when
the number of vertices/indices is very big, to prevent user complaints
about "high memory usage". In addition, QCPainter's cleanupResources is
now made to shrink to fit all relevant QVLAs in the engine.

Pick-to: 6.11
Change-Id: Ie7e812985c1a8a63a392be4aaf7b5bd6a47e0068
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
commit54476f347afc4b362b92b27606bf427b5e5d2180
parent942bd4c709064833c21c665bfdfe6a77e93265ca
authorLaszlo Agocs <laszlo.agocs@qt.io>
committerLaszlo Agocs <laszlo.agocs@qt.io>
commit timeMon, 19 Jan 2026 16:59:59 +0100