QRawFont: improve performance and safety of glyphIndexesForString()
authorKonstantin Ritt <ritt.ks@gmail.com>
Thu, 11 Oct 2012 13:19:34 +0000 (16:19 +0300)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 15 Oct 2012 08:18:31 +0000 (10:18 +0200)
commit3e030a9652e7a95ed28e24ec258a7895e8bc1e34
treea62f0860a6c7d1fc4c18ce168c79316c7d2489e5
parente488d0f4da4ada306e6a1686149c2aedc8bc9391
QRawFont: improve performance and safety of glyphIndexesForString()

As of 98c1eb1750498cdff9d3b26658e5e5be9c026c92, partially initialized
QGlyphLayout is ok for stringToCMap() if GlyphIndicesOnly flag is set,
thus we can use the glyphIndexes buffer directly and avoid copying.
Also add some checks to guarantee we're not falling into an undefined behavior
for the empty text or NULL buffer.

Change-Id: I662953703e4c65edbebabbe4b753972417d963f3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
src/gui/text/qrawfont.cpp
src/gui/text/qrawfont.h
tests/auto/gui/text/qrawfont/tst_qrawfont.cpp