Don't use qreal as a loop counter

Fix static analyzer warning

Change-Id: I5c1a0c63e66b7c2511b4801bbe399681de998850
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
bb10
Eirik Aavitsland 2021-04-20 15:36:25 +02:00
parent 3b8031059a
commit 3a1be7dfcb
1 changed files with 7 additions and 5 deletions

View File

@ -217,15 +217,17 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
const qreal o2 = offset*offset;
const qreal max_dist_line = threshold*offset*offset;
const qreal max_dist_normal = threshold*offset;
const qreal spacing = qreal(0.25);
for (qreal i = spacing; i < qreal(0.99); i += spacing) {
QPointF p1 = b1->pointAt(i);
QPointF p2 = b2->pointAt(i);
const int divisions = 4;
const qreal spacing = qreal(1.0) / divisions;
qreal t = spacing;
for (int i = 1; i < divisions; ++i, t += spacing) {
QPointF p1 = b1->pointAt(t);
QPointF p2 = b2->pointAt(t);
qreal d = (p1.x() - p2.x())*(p1.x() - p2.x()) + (p1.y() - p2.y())*(p1.y() - p2.y());
if (qAbs(d - o2) > max_dist_line)
return Split;
QPointF normalPoint = b1->normalVector(i);
QPointF normalPoint = b1->normalVector(t);
qreal l = qAbs(normalPoint.x()) + qAbs(normalPoint.y());
if (l != qreal(0.0)) {
d = qAbs( normalPoint.x()*(p1.y() - p2.y()) - normalPoint.y()*(p1.x() - p2.x()) ) / l;