Add function QGlyphRun::setRawData()
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Tue, 10 May 2011 13:08:29 +0000 (15:08 +0200)
committerQt Continuous Integration System <qt-info@nokia.com>
Tue, 7 Jun 2011 08:30:57 +0000 (10:30 +0200)
commitae3b5b3ab4b9c268db8230cc2ac5edac3680a2d8
treeb0f9c8b0287c2c35c33e6cbff95606c6b41e3a02
parenteabaf61256d8c1966f8f6d49d0cb2d9b2ba9f71b
Add function QGlyphRun::setRawData()

To provide an optimized way of constructing QGlyphRun objects with no
copying or allocation, we add function setRawData() (naming inspired by
QByteArray::setRawData()). Data retrieved from QRawFont can be passed
directly into this. The logic is now that the data pointers in
QGlyphRunPrivate should always point to the current valid data and is
what will be used in comparisons and drawing calls. The vectors are
optimizations to avoid unnecessary copying if the user wants to use
the QVector based API (which makes it easier to manage the memory.)
This reflected in the functions that return QVectors, which will
return the stored vector if and only if it is identical to the
current pointer. Otherwise we will have to copy the memory.

The internal addition operators in QGlyphRun have been removed since
they really provide no real optimization and have an unclear definition
if the two glyph runs are based on different fonts.

Reviewed-by: Jiang Jiang
(cherry picked from commit 86d88c5b719fd3d50336d9d8e7127b8045ee82ae)

Change-Id: Id5bb55ee3d93afb32ffca850f53382e856df7b3e
Reviewed-on: http://codereview.qt.nokia.com/342
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
src/gui/painting/qpainter.cpp
src/gui/painting/qpainter_p.h
src/gui/text/qglyphrun.cpp
src/gui/text/qglyphrun.h
src/gui/text/qglyphrun_p.h
src/gui/text/qtextlayout.cpp
tests/auto/qglyphrun/tst_qglyphrun.cpp