summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qglyphrun_p.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-05-10 15:08:29 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-06-06 16:02:33 +0200
commit86d88c5b719fd3d50336d9d8e7127b8045ee82ae (patch)
treecd6ad2732f7eec8d7b3530b0d35908c0f0c130ef /src/gui/text/qglyphrun_p.h
parent71cd7dfea1b8f0e287eb1616c0cda5493508c3c4 (diff)
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
Diffstat (limited to 'src/gui/text/qglyphrun_p.h')
-rw-r--r--src/gui/text/qglyphrun_p.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 533679d96a..1cb63b2403 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -71,6 +71,10 @@ public:
: overline(false)
, underline(false)
, strikeOut(false)
+ , glyphIndexData(glyphIndexes.constData())
+ , glyphIndexDataSize(0)
+ , glyphPositionData(glyphPositions.constData())
+ , glyphPositionDataSize(0)
{
}
@@ -82,6 +86,10 @@ public:
, overline(other.overline)
, underline(other.underline)
, strikeOut(other.strikeOut)
+ , glyphIndexData(other.glyphIndexData)
+ , glyphIndexDataSize(other.glyphIndexDataSize)
+ , glyphPositionData(other.glyphPositionData)
+ , glyphPositionDataSize(other.glyphPositionDataSize)
{
}
@@ -89,6 +97,17 @@ public:
QVector<QPointF> glyphPositions;
QRawFont rawFont;
+ const quint32 *glyphIndexData;
+ int glyphIndexDataSize;
+
+ const QPointF *glyphPositionData;
+ int glyphPositionDataSize;
+
+ static QGlyphRunPrivate *get(const QGlyphRun &glyphRun)
+ {
+ return glyphRun.d.data();
+ }
+
uint overline : 1;
uint underline : 1;
uint strikeOut : 1;