summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Löhning <robert.loehning@qt.io>2025-12-10 23:39:04 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2025-12-13 03:08:15 +0000
commitea7996e51b642c24ce2ee677084c7ee3f5af913d (patch)
treed2270090fef3065929e700bdf17fbc57e62f0911
parent90431eac5dc27e7d282777d6b8c404f0f253adfc (diff)
QFontEngine: Replace divisions by bitshifts6.10
...so static code checkers will not complain about ignoring remainders or fractional parts of the division anymore. Change-Id: If57e1d3a9229424ac382c5f1f6aee8ddba481714 Coverity-Id: 898602 Coverity-Id: 898603 Pick-to: 6.8 6.5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit bb7ceb313c30d592c24567fdfcb55d3832c3fcc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 5deac08db78dcfb1e0c4ff11e7c53190d03f19a2)
-rw-r--r--src/gui/text/qfontengine.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index d41296291f6..5a0667fe415 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -402,7 +402,7 @@ bool QFontEngine::processHheaTable() const
const qreal unitsPerEm = emSquareSize().toReal();
// Bail out if values are too large for QFixed
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (ascent > limitForQFixed || descent > limitForQFixed || leading > limitForQFixed)
return false;
m_ascent = QFixed::fromReal(ascent * fontDef.pixelSize / unitsPerEm);
@@ -470,7 +470,7 @@ bool QFontEngine::processOS2Table() const
if (typoAscent == 0 && typoDescent == 0)
return false;
// Bail out if values are too large for QFixed
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (typoAscent > limitForQFixed || typoDescent > limitForQFixed
|| typoLineGap > limitForQFixed)
return false;
@@ -481,7 +481,7 @@ bool QFontEngine::processOS2Table() const
// Some fonts may have invalid OS/2 data. We detect this and bail out.
if (winAscent == 0 && winDescent == 0)
return false;
- const auto limitForQFixed = qreal(std::numeric_limits<int>::max() / 64) / fontDef.pixelSize;
+ const auto limitForQFixed = qreal(std::numeric_limits<int>::max() >> 6) / fontDef.pixelSize;
if (winAscent > limitForQFixed || winDescent > limitForQFixed)
return false;
m_ascent = QFixed::fromReal(winAscent * fontDef.pixelSize / unitsPerEm);