diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qtransform.cpp | 43 | ||||
-rw-r--r-- | src/gui/text/qstatictext.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 2 |
3 files changed, 46 insertions, 3 deletions
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 988d678..80b7520 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -47,6 +47,7 @@ #include "qpainterpath.h" #include "qvariant.h" #include <qmath.h> +#include <qnumeric.h> #include <private/qbezier_p.h> @@ -410,6 +411,12 @@ QTransform &QTransform::translate(qreal dx, qreal dy) { if (dx == 0 && dy == 0) return *this; +#ifndef QT_NO_DEBUG + if (qIsNaN(dx) | qIsNaN(dy)) { + qWarning() << "QTransform::translate with NaN called"; + return *this; + } +#endif switch(inline_type()) { case TxNone: @@ -447,6 +454,12 @@ QTransform &QTransform::translate(qreal dx, qreal dy) */ QTransform QTransform::fromTranslate(qreal dx, qreal dy) { +#ifndef QT_NO_DEBUG + if (qIsNaN(dx) | qIsNaN(dy)) { + qWarning() << "QTransform::fromTranslate with NaN called"; + return QTransform(); +} +#endif QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1, true); if (dx == 0 && dy == 0) transform.m_type = TxNone; @@ -466,6 +479,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy) { if (sx == 1 && sy == 1) return *this; +#ifndef QT_NO_DEBUG + if (qIsNaN(sx) | qIsNaN(sy)) { + qWarning() << "QTransform::scale with NaN called"; + return *this; + } +#endif switch(inline_type()) { case TxNone: @@ -501,6 +520,12 @@ QTransform & QTransform::scale(qreal sx, qreal sy) */ QTransform QTransform::fromScale(qreal sx, qreal sy) { +#ifndef QT_NO_DEBUG + if (qIsNaN(sx) | qIsNaN(sy)) { + qWarning() << "QTransform::fromScale with NaN called"; + return QTransform(); +} +#endif QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1, true); if (sx == 1. && sy == 1.) transform.m_type = TxNone; @@ -520,6 +545,12 @@ QTransform & QTransform::shear(qreal sh, qreal sv) { if (sh == 0 && sv == 0) return *this; +#ifndef QT_NO_DEBUG + if (qIsNaN(sh) | qIsNaN(sv)) { + qWarning() << "QTransform::shear with NaN called"; + return *this; + } +#endif switch(inline_type()) { case TxNone: @@ -575,6 +606,12 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) { if (a == 0) return *this; +#ifndef QT_NO_DEBUG + if (qIsNaN(a)) { + qWarning() << "QTransform::rotate with NaN called"; + return *this; + } +#endif qreal sina = 0; qreal cosa = 0; @@ -660,6 +697,12 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis) */ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) { +#ifndef QT_NO_DEBUG + if (qIsNaN(a)) { + qWarning() << "QTransform::rotateRadians with NaN called"; + return *this; + } +#endif qreal sina = qSin(a); qreal cosa = qCos(a); diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 06b0d3b..d7bf34e 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -387,8 +387,8 @@ QStaticTextPrivate *QStaticTextPrivate::get(const QStaticText *q) return q->data.data(); } -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); +Q_GUI_EXPORT extern int qt_defaultDpiX(); +Q_GUI_EXPORT extern int qt_defaultDpiY(); namespace { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 312d135..ce7915d 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -305,7 +305,7 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const Once the layout is done, these lines can be drawn on a paint device. - Here's some pseudo code that presents the layout phase: + Here's some code snippet that presents the layout phase: \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0 The text can be drawn by calling the layout's draw() function: |