summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-17 17:48:34 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-03-04 10:29:08 +0000
commit600529e07a46d8e20f4302dc988125f3fee36ec4 (patch)
treed1ef58c493d6f9dd2521c63ce1f07e04a7aa5658 /src/gui/painting
parentb6b3803b213787a04dfc7542caeb541a5535d90f (diff)
QtGui: use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); In QTransform shared warning strings. Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/painting/qtransform.cpp22
3 files changed, 18 insertions, 10 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 34b4d97758..4ab029cf7a 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1163,7 +1163,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
if (s->matrix.type() <= QTransform::TxScale
&& path.isRect()) {
#ifdef QT_DEBUG_DRAW
- qDebug() << " --- optimizing vector clip to rect clip...";
+ qDebug(" --- optimizing vector clip to rect clip...");
#endif
const qreal *points = path.points();
QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 0c3069db97..f83f1c997e 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1951,7 +1951,7 @@ int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height,
xprintf("/Interpolate true\n");
int len = 0;
if (dct) {
- //qDebug() << "DCT";
+ //qDebug("DCT");
xprintf("/Filter /DCTDecode\n>>\nstream\n");
write(data);
len = data.length();
@@ -2215,7 +2215,7 @@ int QPdfEnginePrivate::generateGradientShader(const QGradient *gradient, const Q
return generateRadialGradientShader(static_cast<const QRadialGradient *>(gradient), matrix, alpha);
case QGradient::ConicalGradient:
default:
- qWarning() << "Implement me!";
+ qWarning("Implement me!");
}
return 0;
}
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index a0596d1a07..6058811176 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -53,6 +53,14 @@
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DEBUG
+Q_NEVER_INLINE
+static void nanWarning(const char *func)
+{
+ qWarning("QTransform::%s with NaN called", func);
+}
+#endif // QT_NO_DEBUG
+
#define Q_NEAR_CLIP (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)
#ifdef MAP
@@ -418,7 +426,7 @@ QTransform &QTransform::translate(qreal dx, qreal dy)
return *this;
#ifndef QT_NO_DEBUG
if (qIsNaN(dx) | qIsNaN(dy)) {
- qWarning() << "QTransform::translate with NaN called";
+ nanWarning("translate");
return *this;
}
#endif
@@ -461,7 +469,7 @@ QTransform QTransform::fromTranslate(qreal dx, qreal dy)
{
#ifndef QT_NO_DEBUG
if (qIsNaN(dx) | qIsNaN(dy)) {
- qWarning() << "QTransform::fromTranslate with NaN called";
+ nanWarning("fromTranslate");
return QTransform();
}
#endif
@@ -486,7 +494,7 @@ QTransform & QTransform::scale(qreal sx, qreal sy)
return *this;
#ifndef QT_NO_DEBUG
if (qIsNaN(sx) | qIsNaN(sy)) {
- qWarning() << "QTransform::scale with NaN called";
+ nanWarning("scale");
return *this;
}
#endif
@@ -527,7 +535,7 @@ QTransform QTransform::fromScale(qreal sx, qreal sy)
{
#ifndef QT_NO_DEBUG
if (qIsNaN(sx) | qIsNaN(sy)) {
- qWarning() << "QTransform::fromScale with NaN called";
+ nanWarning("fromScale");
return QTransform();
}
#endif
@@ -552,7 +560,7 @@ QTransform & QTransform::shear(qreal sh, qreal sv)
return *this;
#ifndef QT_NO_DEBUG
if (qIsNaN(sh) | qIsNaN(sv)) {
- qWarning() << "QTransform::shear with NaN called";
+ nanWarning("shear");
return *this;
}
#endif
@@ -613,7 +621,7 @@ QTransform & QTransform::rotate(qreal a, Qt::Axis axis)
return *this;
#ifndef QT_NO_DEBUG
if (qIsNaN(a)) {
- qWarning() << "QTransform::rotate with NaN called";
+ nanWarning("rotate");
return *this;
}
#endif
@@ -704,7 +712,7 @@ QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
{
#ifndef QT_NO_DEBUG
if (qIsNaN(a)) {
- qWarning() << "QTransform::rotateRadians with NaN called";
+ nanWarning("rotateRadians");
return *this;
}
#endif