From 4f577051676ad8ff161d481030f016d0c6bb324f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 5 Mar 2016 00:34:01 +0100 Subject: Fix GCC 6 -Wunused-functions warnings GCC 6 is able to identify member functions that are unused. Remove them. Change-Id: Ic77548164b38a1cd3c957d2c57a5bccb979bc02e Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/painting/qpathclipper.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 3a686bd209..a5557c99ff 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -252,8 +252,6 @@ class SegmentTree public: SegmentTree(QPathSegments &segments); - QRectF boundingRect() const; - void produceIntersections(int segment); private: @@ -304,12 +302,6 @@ SegmentTree::SegmentTree(QPathSegments &segments) m_tree[0] = root; } -QRectF SegmentTree::boundingRect() const -{ - return QRectF(QPointF(m_bounds.x1, m_bounds.y1), - QPointF(m_bounds.x2, m_bounds.y2)); -} - static inline qreal coordinate(const QPointF &pos, int axis) { return axis == 0 ? pos.x() : pos.y(); -- cgit v1.2.3 From 8135e52cb45bd24c288c29da470828fe4fe5e3de Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 2 Mar 2016 11:34:44 +0100 Subject: Fix MIPS DSP optimized fetchUntransformed These have been wrong since being introduced in 5.3. Change-Id: I5b4aa198c8d4c6726f1c5097abe8d43275722dab Reviewed-by: Ljubomir Papuga Reviewed-by: Gunnar Sletta --- src/gui/painting/qdrawhelper_mips_dsp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp index 721b228395..c28b594de3 100644 --- a/src/gui/painting/qdrawhelper_mips_dsp.cpp +++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp @@ -489,7 +489,7 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_888_asm_mips_dsp(buffer, line, length); return buffer; } @@ -497,7 +497,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 2; fetchUntransformed_444_asm_mips_dsp(buffer, line, length); return buffer; } @@ -505,7 +505,7 @@ const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data, int y, int x, int length) { - uchar *line = (uchar *)data->texture.scanLine(y) + x; + const uchar *line = data->texture.scanLine(y) + x * 3; fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length); return buffer; } -- cgit v1.2.3 From fb7ef2b9f5cbc375fb35690326501be6a117314d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 6 Mar 2016 15:06:48 +0100 Subject: QCosmeticStroker: fix out-of-bounds access in drawPixel() Found by UBSan: src/gui/painting/qcosmeticstroker.cpp:150:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' src/gui/painting/qcosmeticstroker.cpp:150:99: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' src/gui/painting/qcosmeticstroker.cpp:151:55: runtime error: index -1 out of bounds for type 'QT_FT_Span_ [255]' That code path makes no sense if no span has been populated yet, so skip the whole block if current_span == 0. Change-Id: I832b989e89c118dc48ab5add3a28bb44c1936a76 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcosmeticstroker.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 8c3fd2ce4f..b310336b9b 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -141,12 +141,14 @@ inline void drawPixel(QCosmeticStroker *stroker, int x, int y, int coverage) if (x < cl.x() || x > cl.right() || y < cl.y() || y > cl.bottom()) return; - int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; - int lasty = stroker->spans[stroker->current_span-1].y; + if (stroker->current_span > 0) { + const int lastx = stroker->spans[stroker->current_span-1].x + stroker->spans[stroker->current_span-1].len ; + const int lasty = stroker->spans[stroker->current_span-1].y; - if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { - stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); - stroker->current_span = 0; + if (stroker->current_span == QCosmeticStroker::NSPANS || y < lasty || (y == lasty && x < lastx)) { + stroker->blend(stroker->current_span, stroker->spans, &stroker->state->penData); + stroker->current_span = 0; + } } stroker->spans[stroker->current_span].x = ushort(x); -- cgit v1.2.3 From 62e0a98282081911616a8c005464d483a3a480d2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Dec 2015 17:15:15 +0100 Subject: Fix debug operators for QPageSize/QPageLayout. Remove placeholder formatting and add noquote. Change-Id: I4a89f88778caf007ce42bbf57edfb514fe76bcdb Reviewed-by: Kai Koehne --- src/gui/painting/qpagelayout.cpp | 33 +++++++++++++++------------------ src/gui/painting/qpagesize.cpp | 14 +++++++------- 2 files changed, 22 insertions(+), 25 deletions(-) (limited to 'src/gui/painting') diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp index f443bbd5ac..15dfa6f8c1 100644 --- a/src/gui/painting/qpagelayout.cpp +++ b/src/gui/painting/qpagelayout.cpp @@ -943,40 +943,37 @@ QRect QPageLayout::paintRectPixels(int resolution) const QDebug operator<<(QDebug dbg, const QPageLayout &layout) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageLayout("; if (layout.isValid()) { - QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)"); - QString units; + const QMarginsF margins = layout.margins(); + dbg << '"' << layout.pageSize().name() << "\", " + << (layout.orientation() == QPageLayout::Portrait ? "Portrait" : "Landscape") + << ", l:" << margins.left() << " r:" << margins.right() << " t:" + << margins.top() << " b:" << margins.bottom() << ' '; switch (layout.units()) { case QPageLayout::Millimeter: - units = QStringLiteral("mm"); + dbg << "mm"; break; case QPageLayout::Point: - units = QStringLiteral("pt"); + dbg << "pt"; break; case QPageLayout::Inch: - units = QStringLiteral("in"); + dbg << "in"; break; case QPageLayout::Pica: - units = QStringLiteral("pc"); + dbg << "pc"; break; case QPageLayout::Didot: - units = QStringLiteral("DD"); + dbg << "DD"; break; case QPageLayout::Cicero: - units = QStringLiteral("CC"); + dbg << "CC"; break; } - output = output.arg(layout.pageSize().name()) - .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape")) - .arg(layout.margins().left()) - .arg(layout.margins().right()) - .arg(layout.margins().top()) - .arg(layout.margins().bottom()) - .arg(units); - dbg.nospace() << output; - } else { - dbg.nospace() << "QPageLayout()"; } + dbg << ')'; return dbg; } #endif diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp index c0aae603b7..17f6b7bb64 100644 --- a/src/gui/painting/qpagesize.cpp +++ b/src/gui/painting/qpagesize.cpp @@ -1855,17 +1855,17 @@ QSize QPageSize::sizePixels(PageSizeId pageSizeId, int resolution) QDebug operator<<(QDebug dbg, const QPageSize &pageSize) { QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg.noquote(); + dbg << "QPageSize("; if (pageSize.isValid()) { - QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)"); - output = output.arg(pageSize.name()) - .arg(pageSize.key()) - .arg(pageSize.sizePoints().width()) - .arg(pageSize.sizePoints().height()) - .arg(pageSize.id()); - dbg.nospace() << output; + dbg << '"' << pageSize.name() << "\", key=\"" << pageSize.key() + << "\", " << pageSize.sizePoints().width() << 'x' + << pageSize.sizePoints().height() << "pt, id=" << pageSize.id(); } else { dbg.nospace() << "QPageSize()"; } + dbg << ')'; return dbg; } #endif -- cgit v1.2.3