Pass QFixed by value
It's a glorified int, so pass it by value instead of cref. Pick-to: 6.4 Change-Id: I1c7a37614cd0d2dac63d2d549563600d401d6dad Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
This commit is contained in:
parent
13764280b4
commit
0a1fe50d0b
@ -47,16 +47,16 @@ public:
|
||||
|
||||
constexpr inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
|
||||
constexpr inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
|
||||
constexpr inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
|
||||
constexpr inline QFixed operator+(QFixed other) const { return fromFixed((val + other.val)); }
|
||||
inline QFixed &operator+=(int i) { val += i * 64; return *this; }
|
||||
inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
|
||||
inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
|
||||
inline QFixed &operator+=(QFixed other) { val += other.val; return *this; }
|
||||
constexpr inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
|
||||
constexpr inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
|
||||
constexpr inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
|
||||
constexpr inline QFixed operator-(QFixed other) const { return fromFixed((val - other.val)); }
|
||||
inline QFixed &operator-=(int i) { val -= i * 64; return *this; }
|
||||
inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
|
||||
inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
|
||||
inline QFixed &operator-=(QFixed other) { val -= other.val; return *this; }
|
||||
constexpr inline QFixed operator-() const { return fromFixed(-val); }
|
||||
|
||||
#define REL_OP(op) \
|
||||
@ -73,7 +73,7 @@ public:
|
||||
constexpr inline bool operator!() const { return !val; }
|
||||
|
||||
inline QFixed &operator/=(int x) { val /= x; return *this; }
|
||||
inline QFixed &operator/=(const QFixed &o) {
|
||||
inline QFixed &operator/=(QFixed o) {
|
||||
if (o.val == 0) {
|
||||
val = 0x7FFFFFFFL;
|
||||
} else {
|
||||
@ -94,7 +94,7 @@ public:
|
||||
inline QFixed operator>>(int d) const { QFixed f = *this; f.val >>= d; return f; }
|
||||
inline QFixed &operator*=(int i) { val *= i; return *this; }
|
||||
inline QFixed &operator*=(uint i) { val *= i; return *this; }
|
||||
inline QFixed &operator*=(const QFixed &o) {
|
||||
inline QFixed &operator*=(QFixed o) {
|
||||
bool neg = false;
|
||||
qint64 a = val;
|
||||
qint64 b = o.val;
|
||||
@ -107,7 +107,7 @@ public:
|
||||
}
|
||||
constexpr inline QFixed operator*(int i) const { return fromFixed(val * i); }
|
||||
constexpr inline QFixed operator*(uint i) const { return fromFixed(val * i); }
|
||||
inline QFixed operator*(const QFixed &o) const { QFixed f = *this; return (f *= o); }
|
||||
inline QFixed operator*(QFixed o) const { QFixed f = *this; return (f *= o); }
|
||||
|
||||
private:
|
||||
constexpr QFixed(qreal i) : val((int)(i*qreal(64))) {}
|
||||
@ -125,19 +125,19 @@ Q_DECLARE_TYPEINFO(QFixed, Q_PRIMITIVE_TYPE);
|
||||
|
||||
#define QFIXED_MAX (INT_MAX/256)
|
||||
|
||||
constexpr inline int qRound(const QFixed &f) { return f.toInt(); }
|
||||
constexpr inline int qFloor(const QFixed &f) { return f.floor().truncate(); }
|
||||
constexpr inline int qRound(QFixed f) { return f.toInt(); }
|
||||
constexpr inline int qFloor(QFixed f) { return f.floor().truncate(); }
|
||||
|
||||
constexpr inline QFixed operator*(int i, const QFixed &d) { return d*i; }
|
||||
constexpr inline QFixed operator+(int i, const QFixed &d) { return d+i; }
|
||||
constexpr inline QFixed operator-(int i, const QFixed &d) { return -(d-i); }
|
||||
constexpr inline QFixed operator*(uint i, const QFixed &d) { return d*i; }
|
||||
constexpr inline QFixed operator+(uint i, const QFixed &d) { return d+i; }
|
||||
constexpr inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
|
||||
// constexpr inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
|
||||
constexpr inline QFixed operator*(int i, QFixed d) { return d*i; }
|
||||
constexpr inline QFixed operator+(int i, QFixed d) { return d+i; }
|
||||
constexpr inline QFixed operator-(int i, QFixed d) { return -(d-i); }
|
||||
constexpr inline QFixed operator*(uint i, QFixed d) { return d*i; }
|
||||
constexpr inline QFixed operator+(uint i, QFixed d) { return d+i; }
|
||||
constexpr inline QFixed operator-(uint i, QFixed d) { return -(d-i); }
|
||||
// constexpr inline QFixed operator*(qreal d, QFixed d2) { return d2*d; }
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
|
||||
inline QDebug &operator<<(QDebug &dbg, QFixed f)
|
||||
{ return dbg << f.toReal(); }
|
||||
#endif
|
||||
|
||||
@ -145,7 +145,7 @@ struct QFixedPoint {
|
||||
QFixed x;
|
||||
QFixed y;
|
||||
constexpr inline QFixedPoint() {}
|
||||
constexpr inline QFixedPoint(const QFixed &_x, const QFixed &_y) : x(_x), y(_y) {}
|
||||
constexpr inline QFixedPoint(QFixed _x, QFixed _y) : x(_x), y(_y) {}
|
||||
constexpr QPointF toPointF() const { return QPointF(x.toReal(), y.toReal()); }
|
||||
constexpr static QFixedPoint fromPointF(const QPointF &p) {
|
||||
return QFixedPoint(QFixed::fromReal(p.x()), QFixed::fromReal(p.y()));
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
virtual bool supportsHorizontalSubPixelPositions() const { return false; }
|
||||
virtual bool supportsVerticalSubPixelPositions() const { return false; }
|
||||
virtual QFixedPoint subPixelPositionFor(const QFixedPoint &position) const;
|
||||
QFixed subPixelPositionForX(const QFixed &x) const
|
||||
QFixed subPixelPositionForX(QFixed x) const
|
||||
{
|
||||
return subPixelPositionFor(QFixedPoint(x, 0)).x;
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ public:
|
||||
QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat);
|
||||
void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0);
|
||||
|
||||
void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
|
||||
void floatMargins(QFixed y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
|
||||
QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const;
|
||||
|
||||
QList<QCheckPoint> checkPoints;
|
||||
@ -3631,7 +3631,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
|
||||
}
|
||||
}
|
||||
|
||||
void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct,
|
||||
void QTextDocumentLayoutPrivate::floatMargins(QFixed y, const QTextLayoutStruct *layoutStruct,
|
||||
QFixed *left, QFixed *right) const
|
||||
{
|
||||
// qDebug() << "floatMargins y=" << y;
|
||||
|
@ -2933,7 +2933,7 @@ static QString stringMidRetainingBidiCC(const QString &string,
|
||||
return prefix + ellidePrefix + QStringView{string}.mid(midStart, midLength) + ellideSuffix + suffix;
|
||||
}
|
||||
|
||||
QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int flags, int from, int count) const
|
||||
QString QTextEngine::elidedText(Qt::TextElideMode mode, QFixed width, int flags, int from, int count) const
|
||||
{
|
||||
// qDebug() << "elidedText; available width" << width.toReal() << "text width:" << this->width(0, layoutData->string.length()).toReal();
|
||||
|
||||
|
@ -586,7 +586,7 @@ private:
|
||||
public:
|
||||
bool atWordSeparator(int position) const;
|
||||
|
||||
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags = 0, int from = 0, int count = -1) const;
|
||||
QString elidedText(Qt::TextElideMode mode, QFixed width, int flags = 0, int from = 0, int count = -1) const;
|
||||
|
||||
void shapeLine(const QScriptLine &line);
|
||||
QFixed leadingSpaceWidth(const QScriptLine &line);
|
||||
|
@ -2189,8 +2189,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine,
|
||||
const QGlyphLayout &glyphLayout,
|
||||
const QPointF &pos,
|
||||
const QGlyphRun::GlyphRunFlags &flags,
|
||||
const QFixed &selectionX,
|
||||
const QFixed &selectionWidth,
|
||||
QFixed selectionX,
|
||||
QFixed selectionWidth,
|
||||
int glyphsStart,
|
||||
int glyphsEnd,
|
||||
unsigned short *logClusters,
|
||||
|
Loading…
x
Reference in New Issue
Block a user