summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-10-11 06:23:32 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-13 03:17:53 +0200
commitec4593d6d06b6b6de5cd26cf66d5c6a866231251 (patch)
tree51fed93b972e9ce29e3ad7c152a6184f8e0c6cfa /src/gui/text
parent4717d36c9110f016868e37d9eff74b1d28af5a9c (diff)
QGlyphRun: Fix isEmpty() and boundingRect() didn't work after setRawData()
Change-Id: I44a347ef24961493d6b8353abbb215c713ccce52 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qglyphrun.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 48e0b15c85..f46e86e88c 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -473,15 +473,15 @@ void QGlyphRun::setBoundingRect(const QRectF &boundingRect)
*/
QRectF QGlyphRun::boundingRect() const
{
- if (!d->boundingRect.isEmpty())
+ if (!d->boundingRect.isEmpty() || !d->rawFont.isValid())
return d->boundingRect;
qreal minX, minY, maxX, maxY;
minX = minY = maxX = maxY = 0;
- for (int i=0; i<qMin(d->glyphPositions.size(), d->glyphIndexes.size()); ++i) {
- QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexes.at(i));
- glyphRect.translate(d->glyphPositions.at(i));
+ for (int i = 0, n = qMin(d->glyphIndexDataSize, d->glyphPositionDataSize); i < n; ++i) {
+ QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]);
+ glyphRect.translate(d->glyphPositionData[i]);
if (i == 0) {
minX = glyphRect.left();
@@ -506,7 +506,7 @@ QRectF QGlyphRun::boundingRect() const
*/
bool QGlyphRun::isEmpty() const
{
- return d->glyphIndexes.isEmpty();
+ return d->glyphIndexDataSize == 0;
}
QT_END_NAMESPACE