summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index d746ab9379..d68d719c39 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1003,7 +1003,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('\\');
@@ -2007,10 +2008,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.));
@@ -2019,7 +2021,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.));