Fix misuses of 0.9999 constant
Replace it with floor and round. It appears the old behavior was to work around combining ceil with inaccurate FP, but it doesn't appear this hacky ceil is needed. Change-Id: I5c16ec0fa4916e17198a733c46937fde53f2ddb5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
bc922223cf
commit
0806d9799a
@ -4783,13 +4783,8 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
|
|||||||
else if (mat.m11() == -1. && mat.m22() == -1.)
|
else if (mat.m11() == -1. && mat.m22() == -1.)
|
||||||
return rotated180(*this);
|
return rotated180(*this);
|
||||||
|
|
||||||
if (mode == Qt::FastTransformation) {
|
hd = qRound(qAbs(mat.m22()) * hs);
|
||||||
hd = qRound(qAbs(mat.m22()) * hs);
|
wd = qRound(qAbs(mat.m11()) * ws);
|
||||||
wd = qRound(qAbs(mat.m11()) * ws);
|
|
||||||
} else {
|
|
||||||
hd = int(qAbs(mat.m22()) * hs + 0.9999);
|
|
||||||
wd = int(qAbs(mat.m11()) * ws + 0.9999);
|
|
||||||
}
|
|
||||||
scale_xform = true;
|
scale_xform = true;
|
||||||
// The paint-based scaling is only bilinear, and has problems
|
// The paint-based scaling is only bilinear, and has problems
|
||||||
// with scaling smoothly more than 2x down.
|
// with scaling smoothly more than 2x down.
|
||||||
|
@ -626,8 +626,8 @@ qreal QWindowsFontEngine::minRightBearing() const
|
|||||||
fmr = qMin(fmr,abc[i].abcfC);
|
fmr = qMin(fmr,abc[i].abcfC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ml = int(fml - 0.9999);
|
ml = qFloor(fml);
|
||||||
mr = int(fmr - 0.9999);
|
mr = qFloor(fmr);
|
||||||
delete [] abc;
|
delete [] abc;
|
||||||
}
|
}
|
||||||
lbearing = ml;
|
lbearing = ml;
|
||||||
|
@ -1437,22 +1437,16 @@ QPixmap QX11PlatformPixmap::transformed(const QTransform &transform, Qt::Transfo
|
|||||||
transform.m21(), transform.m22(), transform.m23(),
|
transform.m21(), transform.m22(), transform.m23(),
|
||||||
0., 0., 1);
|
0., 0., 1);
|
||||||
bool complex_xform = false;
|
bool complex_xform = false;
|
||||||
qreal scaledWidth;
|
|
||||||
qreal scaledHeight;
|
|
||||||
|
|
||||||
if (mat.type() <= QTransform::TxScale) {
|
if (mat.type() <= QTransform::TxScale) {
|
||||||
scaledHeight = qAbs(mat.m22()) * hs + 0.9999;
|
h = qRound(qAbs(mat.m22()) * hs);
|
||||||
scaledWidth = qAbs(mat.m11()) * ws + 0.9999;
|
w = qRound(qAbs(mat.m11()) * ws);
|
||||||
h = qAbs(int(scaledHeight));
|
|
||||||
w = qAbs(int(scaledWidth));
|
|
||||||
} else { // rotation or shearing
|
} else { // rotation or shearing
|
||||||
QPolygonF a(QRectF(0, 0, ws, hs));
|
QPolygonF a(QRectF(0, 0, ws, hs));
|
||||||
a = mat.map(a);
|
a = mat.map(a);
|
||||||
QRect r = a.boundingRect().toAlignedRect();
|
QRect r = a.boundingRect().toAlignedRect();
|
||||||
w = r.width();
|
w = r.width();
|
||||||
h = r.height();
|
h = r.height();
|
||||||
scaledWidth = w;
|
|
||||||
scaledHeight = h;
|
|
||||||
complex_xform = true;
|
complex_xform = true;
|
||||||
}
|
}
|
||||||
mat = QPixmap::trueMatrix(mat, ws, hs); // true matrix
|
mat = QPixmap::trueMatrix(mat, ws, hs); // true matrix
|
||||||
@ -1461,7 +1455,7 @@ QPixmap QX11PlatformPixmap::transformed(const QTransform &transform, Qt::Transfo
|
|||||||
mat = mat.inverted(&invertible); // invert matrix
|
mat = mat.inverted(&invertible); // invert matrix
|
||||||
|
|
||||||
if (h == 0 || w == 0 || !invertible
|
if (h == 0 || w == 0 || !invertible
|
||||||
|| qAbs(scaledWidth) >= 32768 || qAbs(scaledHeight) >= 32768 )
|
|| qAbs(h) >= 32768 || qAbs(w) >= 32768 )
|
||||||
// error, return null pixmap
|
// error, return null pixmap
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user