Fix specific overflow in qtextlayout
Adds qAddOverflow and qMulOverflow definitions to QFixed Fixes: QTBUG-113337 Pick-to: 6.5 6.5.1 6.2 5.15 Change-Id: I13579306defceaccdc0fbb1ec0e9b77c6f8d1af9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
1b736a815b
commit
7b7a01c266
@ -18,6 +18,7 @@
|
|||||||
#include <QtGui/private/qtguiglobal_p.h>
|
#include <QtGui/private/qtguiglobal_p.h>
|
||||||
#include "QtCore/qdebug.h"
|
#include "QtCore/qdebug.h"
|
||||||
#include "QtCore/qpoint.h"
|
#include "QtCore/qpoint.h"
|
||||||
|
#include "QtCore/qnumeric.h"
|
||||||
#include "QtCore/qsize.h"
|
#include "QtCore/qsize.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -136,6 +137,22 @@ 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; }
|
// constexpr inline QFixed operator*(qreal d, QFixed d2) { return d2*d; }
|
||||||
|
|
||||||
|
inline bool qAddOverflow(QFixed v1, QFixed v2, QFixed *r)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
bool result = qAddOverflow(v1.value(), v2.value(), &val);
|
||||||
|
r->setValue(val);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool qMulOverflow(QFixed v1, QFixed v2, QFixed *r)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
bool result = qMulOverflow(v1.value(), v2.value(), &val);
|
||||||
|
r->setValue(val);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
inline QDebug &operator<<(QDebug &dbg, QFixed f)
|
inline QDebug &operator<<(QDebug &dbg, QFixed f)
|
||||||
{ return dbg << f.toReal(); }
|
{ return dbg << f.toReal(); }
|
||||||
|
@ -2164,9 +2164,12 @@ found:
|
|||||||
eng->maxWidth = qMax(eng->maxWidth, line.textWidth);
|
eng->maxWidth = qMax(eng->maxWidth, line.textWidth);
|
||||||
} else {
|
} else {
|
||||||
eng->minWidth = qMax(eng->minWidth, lbh.minw);
|
eng->minWidth = qMax(eng->minWidth, lbh.minw);
|
||||||
eng->layoutData->currentMaxWidth += line.textWidth;
|
if (qAddOverflow(eng->layoutData->currentMaxWidth, line.textWidth, &eng->layoutData->currentMaxWidth))
|
||||||
if (!manuallyWrapped)
|
eng->layoutData->currentMaxWidth = QFIXED_MAX;
|
||||||
eng->layoutData->currentMaxWidth += lbh.spaceData.textWidth;
|
if (!manuallyWrapped) {
|
||||||
|
if (qAddOverflow(eng->layoutData->currentMaxWidth, lbh.spaceData.textWidth, &eng->layoutData->currentMaxWidth))
|
||||||
|
eng->layoutData->currentMaxWidth = QFIXED_MAX;
|
||||||
|
}
|
||||||
eng->maxWidth = qMax(eng->maxWidth, eng->layoutData->currentMaxWidth);
|
eng->maxWidth = qMax(eng->maxWidth, eng->layoutData->currentMaxWidth);
|
||||||
if (manuallyWrapped)
|
if (manuallyWrapped)
|
||||||
eng->layoutData->currentMaxWidth = 0;
|
eng->layoutData->currentMaxWidth = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user