Gui/Testlib: fix compilation for FEATURE_qreal

Task-number: QTBUG-118877
Change-Id: I4988f3b8b9ed09d8f01873fe34bf78d8105a25da
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a74b550e2c38679c329cd40d2119ab440668468e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tim Blechmann 2024-08-13 12:03:23 +08:00 committed by Qt Cherry-pick Bot
parent ee09375bba
commit 6c8d2e042c
5 changed files with 10 additions and 8 deletions

View File

@ -237,12 +237,12 @@ void QCosmeticStroker::setup()
patternLength = 0;
for (int i = 0; i < patternSize; ++i) {
patternLength += static_cast<int>(qBound(1., penPattern.at(i) * 64, 65536.));
patternLength += qBound(1, int(penPattern.at(i) * 64), 65536);
pattern[i] = patternLength;
}
patternLength = 0;
for (int i = 0; i < patternSize; ++i) {
patternLength += static_cast<int>(qBound(1., penPattern.at(patternSize - 1 - i) * 64, 65536.));
patternLength += qBound(1, int(penPattern.at(patternSize - 1 - i) * 64), 65536);
reversePattern[i] = patternLength;
}
strokeSelection |= Dashed;

View File

@ -2734,10 +2734,12 @@ QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from, in
s << "/C0 [" << stops.at(i).second.redF() << stops.at(i).second.greenF() << stops.at(i).second.blueF() << "]\n"
"/C1 [" << stops.at(i + 1).second.redF() << stops.at(i + 1).second.greenF() << stops.at(i + 1).second.blueF() << "]\n";
break;
case QPdfEngine::ColorModel::Grayscale:
s << "/C0 [" << (qGray(stops.at(i).second.rgba()) / 255.) << "]\n"
"/C1 [" << (qGray(stops.at(i + 1).second.rgba()) / 255.) << "]\n";
case QPdfEngine::ColorModel::Grayscale: {
constexpr qreal normalisationFactor = 1. / 255.;
s << "/C0 [" << (qGray(stops.at(i).second.rgba()) * normalisationFactor) << "]\n"
"/C1 [" << (qGray(stops.at(i + 1).second.rgba()) * normalisationFactor) << "]\n";
break;
}
case QPdfEngine::ColorModel::CMYK:
s << "/C0 [" << stops.at(i).second.cyanF()
<< stops.at(i).second.magentaF()

View File

@ -548,7 +548,7 @@ static void populateFromPattern(FcPattern *pattern,
static bool isDprScaling()
{
return !qFuzzyCompare(qApp->devicePixelRatio(), 1.0);
return !qFuzzyCompare(qApp->devicePixelRatio(), qreal(1.0));
}
QFontconfigDatabase::~QFontconfigDatabase()

View File

@ -51,7 +51,7 @@ void QBenchmarkTickMeasurer::start()
QList<QBenchmarkMeasurerBase::Measurement> QBenchmarkTickMeasurer::stop()
{
CycleCounterTicks now = getticks();
return { { elapsed(now, startTicks), QTest::CPUTicks } };
return { { qreal(elapsed(now, startTicks)), QTest::CPUTicks } };
}
bool QBenchmarkTickMeasurer::isMeasurementAccepted(QBenchmarkMeasurerBase::Measurement)

View File

@ -79,7 +79,7 @@ template <int N> struct FixedBufString
qint64 ratio;
if (v < 1 && Power == 1000) {
const char *prefixes = submultiplePrefixes;
ratio = qreal(std::atto::num) / std::atto::den;
ratio = qreal(std::atto::num) / qreal(std::atto::den);
while (value * ratio > 1000 && *prefixes) {
++prefixes;
ratio *= 1000;