Use qFloor instead of qRound for glyph coordinates
[profile/ivi/qtdeclarative.git] / src / quick / scenegraph / qsgdefaultglyphnode_p.cpp
index df85dad..4c4f97a 100644 (file)
@@ -1,10 +1,9 @@
 /****************************************************************************
 **
 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
 **
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
 **
 ** $QT_BEGIN_LICENSE:LGPL$
 ** GNU Lesser General Public License Usage
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -50,6 +50,7 @@
 #include <QtQuick/private/qsgtexture_p.h>
 
 #include <private/qrawfont_p.h>
+#include <QtCore/qmath.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -195,7 +196,7 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
                     fixedPointPositions.data());
     cache->fillInPendingGlyphs();
 
-    int margin = cache->glyphMargin();
+    int margin = fontD->fontEngine->glyphMargin(cache->cacheType());
 
     Q_ASSERT(geometry->indexType() == GL_UNSIGNED_SHORT);
     geometry->allocate(glyphIndexes.size() * 4, glyphIndexes.size() * 6);
@@ -214,8 +215,8 @@ void QSGTextMaskMaterial::populate(const QPointF &p,
          const QTextureGlyphCache::Coord &c = cache->coords.value(glyph);
 
          QPointF glyphPosition = glyphPositions.at(i) + position;
-         int x = qRound(glyphPosition.x()) + c.baseLineX - margin;
-         int y = qRound(glyphPosition.y()) - c.baseLineY - margin;
+         int x = qFloor(glyphPosition.x()) + c.baseLineX - margin;
+         int y = qFloor(glyphPosition.y()) - c.baseLineY - margin;
 
          *boundingRect |= QRectF(x + margin, y + margin, c.w, c.h);