diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-11 08:24:34 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-11 08:25:04 +0100 |
commit | d456f87ece0323982b7601047712545ab95426ad (patch) | |
tree | 46b90468b01144615f280620d73763fc189d25ac /src/gui/painting | |
parent | cc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff) | |
parent | 4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/io/qfilesystemwatcher_win.cpp
src/corelib/plugin/plugin.pri
src/plugins/platforms/cocoa/qcocoaaccessibility.mm
tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 0915fb763a..dcfa3f0647 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1945,9 +1945,10 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG + // +1 for the last pixel to interpolate with, and +1 for rounding errors. quint32 intermediate_buffer[2][buffer_size + 2]; // count is the size used in the intermediate_buffer. - int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors. + int count = (qint64(length) * fdx + fixed_scale - 1) / fixed_scale + 2; Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case int f = 0; int lim = count; @@ -2455,12 +2456,13 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper // The idea is first to do the interpolation between the row s1 and the row s2 // into an intermediate buffer, then we interpolate between two pixel of this buffer. FetchPixelsFunc fetch = qFetchPixels[layout->bpp]; + // +1 for the last pixel to interpolate with, and +1 for rounding errors. uint buf1[buffer_size + 2]; uint buf2[buffer_size + 2]; const uint *ptr1; const uint *ptr2; - int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors. + int count = (qint64(length) * fdx + fixed_scale - 1) / fixed_scale + 2; Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case if (blendType == BlendTransformedBilinearTiled) { diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index dbae48a7ee..52bf44c64a 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1009,7 +1009,8 @@ void QPdfEngine::drawHyperlink(const QRectF &r, const QUrl &url) const uint annot = d->addXrefEntry(-1); const QByteArray urlascii = url.toEncoded(); int len = urlascii.size(); - QVarLengthArray<char> url_esc(0); + QVarLengthArray<char> url_esc; + url_esc.reserve(len + 1); for (int j = 0; j < len; j++) { if (urlascii[j] == '(' || urlascii[j] == ')' || urlascii[j] == '\\') url_esc.append('\\'); @@ -2013,10 +2014,11 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from } QVector<QGradientBound> gradientBounds; + gradientBounds.reserve((to - from) * (numStops - 1)); for (int step = from; step < to; ++step) { if (reflect && step % 2) { - for (int i = stops.size() - 1; i > 0; --i) { + for (int i = numStops - 1; i > 0; --i) { QGradientBound b; b.start = step + 1 - qBound(qreal(0.), stops.at(i).first, qreal(1.)); b.stop = step + 1 - qBound(qreal(0.), stops.at(i - 1).first, qreal(1.)); @@ -2025,7 +2027,7 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from gradientBounds << b; } } else { - for (int i = 0; i < stops.size() - 1; ++i) { + for (int i = 0; i < numStops - 1; ++i) { QGradientBound b; b.start = step + qBound(qreal(0.), stops.at(i).first, qreal(1.)); b.stop = step + qBound(qreal(0.), stops.at(i + 1).first, qreal(1.)); |