| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | #include "qplatformdefs.h" | - |
| 42 | #include <qdebug.h> | - |
| 43 | #include "qpdf_p.h" | - |
| 44 | #include <qfile.h> | - |
| 45 | #include <qtemporaryfile.h> | - |
| 46 | #include <private/qmath_p.h> | - |
| 47 | #include <private/qpainter_p.h> | - |
| 48 | #include <qnumeric.h> | - |
| 49 | #include "private/qfont_p.h" | - |
| 50 | #include <qimagewriter.h> | - |
| 51 | #include "qbuffer.h" | - |
| 52 | #include "QtCore/qdatetime.h" | - |
| 53 | | - |
| 54 | #ifndef QT_NO_COMPRESS | - |
| 55 | #include <zlib.h> | - |
| 56 | #endif | - |
| 57 | | - |
| 58 | #ifdef QT_NO_COMPRESS | - |
| 59 | static const bool do_compress = false; | - |
| 60 | #else | - |
| 61 | static const bool do_compress = true; | - |
| 62 | #endif | - |
| 63 | | - |
| 64 | // might be helpful for smooth transforms of images | - |
| 65 | // Can't use it though, as gs generates completely wrong images if this is true. | - |
| 66 | static const bool interpolateImages = false; | - |
| 67 | | - |
| 68 | QT_BEGIN_NAMESPACE | - |
| 69 | | - |
| 70 | inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features() | - |
| 71 | { | - |
| 72 | QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures; executed (the execution status of this line is deduced): QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures; | - |
| 73 | f &= ~(QPaintEngine::PorterDuff | QPaintEngine::PerspectiveTransform executed (the execution status of this line is deduced): f &= ~(QPaintEngine::PorterDuff | QPaintEngine::PerspectiveTransform | - |
| 74 | | QPaintEngine::ObjectBoundingModeGradients executed (the execution status of this line is deduced): | QPaintEngine::ObjectBoundingModeGradients | - |
| 75 | #ifndef USE_NATIVE_GRADIENTS executed (the execution status of this line is deduced): | - |
| 76 | | QPaintEngine::LinearGradientFill executed (the execution status of this line is deduced): | QPaintEngine::LinearGradientFill | - |
| 77 | #endif executed (the execution status of this line is deduced): | - |
| 78 | | QPaintEngine::RadialGradientFill executed (the execution status of this line is deduced): | QPaintEngine::RadialGradientFill | - |
| 79 | | QPaintEngine::ConicalGradientFill); executed (the execution status of this line is deduced): | QPaintEngine::ConicalGradientFill); | - |
| 80 | return f; executed: return f;Execution Count:234 | 234 |
| 81 | } | - |
| 82 | | - |
| 83 | | - |
| 84 | | - |
| 85 | /* also adds a space at the end of the number */ | - |
| 86 | const char *qt_real_to_string(qreal val, char *buf) { | - |
| 87 | const char *ret = buf; executed (the execution status of this line is deduced): const char *ret = buf; | - |
| 88 | | - |
| 89 | if (qIsNaN(val)) { partially evaluated: qIsNaN(val)| no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
| 90 | *(buf++) = '0'; never executed (the execution status of this line is deduced): *(buf++) = '0'; | - |
| 91 | *(buf++) = ' '; never executed (the execution status of this line is deduced): *(buf++) = ' '; | - |
| 92 | *buf = 0; never executed (the execution status of this line is deduced): *buf = 0; | - |
| 93 | return ret; never executed: return ret; | 0 |
| 94 | } | - |
| 95 | | - |
| 96 | if (val < 0) { evaluated: val < 0| yes Evaluation Count:20 | yes Evaluation Count:116 |
| 20-116 |
| 97 | *(buf++) = '-'; executed (the execution status of this line is deduced): *(buf++) = '-'; | - |
| 98 | val = -val; executed (the execution status of this line is deduced): val = -val; | - |
| 99 | } executed: }Execution Count:20 | 20 |
| 100 | unsigned int ival = (unsigned int) val; executed (the execution status of this line is deduced): unsigned int ival = (unsigned int) val; | - |
| 101 | qreal frac = val - (qreal)ival; executed (the execution status of this line is deduced): qreal frac = val - (qreal)ival; | - |
| 102 | | - |
| 103 | int ifrac = (int)(frac * 1000000000); executed (the execution status of this line is deduced): int ifrac = (int)(frac * 1000000000); | - |
| 104 | if (ifrac == 1000000000) { partially evaluated: ifrac == 1000000000| no Evaluation Count:0 | yes Evaluation Count:136 |
| 0-136 |
| 105 | ++ival; never executed (the execution status of this line is deduced): ++ival; | - |
| 106 | ifrac = 0; never executed (the execution status of this line is deduced): ifrac = 0; | - |
| 107 | } | 0 |
| 108 | char output[256]; executed (the execution status of this line is deduced): char output[256]; | - |
| 109 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
| 110 | while (ival) { evaluated: ival| yes Evaluation Count:104 | yes Evaluation Count:136 |
| 104-136 |
| 111 | output[i] = '0' + (ival % 10); executed (the execution status of this line is deduced): output[i] = '0' + (ival % 10); | - |
| 112 | ++i; executed (the execution status of this line is deduced): ++i; | - |
| 113 | ival /= 10; executed (the execution status of this line is deduced): ival /= 10; | - |
| 114 | } executed: }Execution Count:104 | 104 |
| 115 | int fact = 100000000; executed (the execution status of this line is deduced): int fact = 100000000; | - |
| 116 | if (i == 0) { evaluated: i == 0| yes Evaluation Count:88 | yes Evaluation Count:48 |
| 48-88 |
| 117 | *(buf++) = '0'; executed (the execution status of this line is deduced): *(buf++) = '0'; | - |
| 118 | } else { executed: }Execution Count:88 | 88 |
| 119 | while (i) { evaluated: i| yes Evaluation Count:104 | yes Evaluation Count:48 |
| 48-104 |
| 120 | *(buf++) = output[--i]; executed (the execution status of this line is deduced): *(buf++) = output[--i]; | - |
| 121 | fact /= 10; executed (the execution status of this line is deduced): fact /= 10; | - |
| 122 | ifrac /= 10; executed (the execution status of this line is deduced): ifrac /= 10; | - |
| 123 | } executed: }Execution Count:104 | 104 |
| 124 | } executed: }Execution Count:48 | 48 |
| 125 | | - |
| 126 | if (ifrac) { evaluated: ifrac| yes Evaluation Count:76 | yes Evaluation Count:60 |
| 60-76 |
| 127 | *(buf++) = '.'; executed (the execution status of this line is deduced): *(buf++) = '.'; | - |
| 128 | while (fact) { evaluated: fact| yes Evaluation Count:604 | yes Evaluation Count:76 |
| 76-604 |
| 129 | *(buf++) = '0' + ((ifrac/fact) % 10); executed (the execution status of this line is deduced): *(buf++) = '0' + ((ifrac/fact) % 10); | - |
| 130 | fact /= 10; executed (the execution status of this line is deduced): fact /= 10; | - |
| 131 | } executed: }Execution Count:604 | 604 |
| 132 | } executed: }Execution Count:76 | 76 |
| 133 | *(buf++) = ' '; executed (the execution status of this line is deduced): *(buf++) = ' '; | - |
| 134 | *buf = 0; executed (the execution status of this line is deduced): *buf = 0; | - |
| 135 | return ret; executed: return ret;Execution Count:136 | 136 |
| 136 | } | - |
| 137 | | - |
| 138 | const char *qt_int_to_string(int val, char *buf) { | - |
| 139 | const char *ret = buf; executed (the execution status of this line is deduced): const char *ret = buf; | - |
| 140 | if (val < 0) { partially evaluated: val < 0| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 141 | *(buf++) = '-'; never executed (the execution status of this line is deduced): *(buf++) = '-'; | - |
| 142 | val = -val; never executed (the execution status of this line is deduced): val = -val; | - |
| 143 | } | 0 |
| 144 | char output[256]; executed (the execution status of this line is deduced): char output[256]; | - |
| 145 | int i = 0; executed (the execution status of this line is deduced): int i = 0; | - |
| 146 | while (val) { evaluated: val| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 147 | output[i] = '0' + (val % 10); executed (the execution status of this line is deduced): output[i] = '0' + (val % 10); | - |
| 148 | ++i; executed (the execution status of this line is deduced): ++i; | - |
| 149 | val /= 10; executed (the execution status of this line is deduced): val /= 10; | - |
| 150 | } executed: }Execution Count:4 | 4 |
| 151 | if (i == 0) { partially evaluated: i == 0| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 152 | *(buf++) = '0'; never executed (the execution status of this line is deduced): *(buf++) = '0'; | - |
| 153 | } else { | 0 |
| 154 | while (i) evaluated: i| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 155 | *(buf++) = output[--i]; executed: *(buf++) = output[--i];Execution Count:4 | 4 |
| 156 | } executed: }Execution Count:4 | 4 |
| 157 | *(buf++) = ' '; executed (the execution status of this line is deduced): *(buf++) = ' '; | - |
| 158 | *buf = 0; executed (the execution status of this line is deduced): *buf = 0; | - |
| 159 | return ret; executed: return ret;Execution Count:4 | 4 |
| 160 | } | - |
| 161 | | - |
| 162 | | - |
| 163 | namespace QPdf { | - |
| 164 | ByteStream::ByteStream(QByteArray *byteArray, bool fileBacking) | - |
| 165 | : dev(new QBuffer(byteArray)), | - |
| 166 | fileBackingEnabled(fileBacking), | - |
| 167 | fileBackingActive(false), | - |
| 168 | handleDirty(false) | - |
| 169 | { | - |
| 170 | dev->open(QIODevice::ReadWrite | QIODevice::Append); executed (the execution status of this line is deduced): dev->open(QIODevice::ReadWrite | QIODevice::Append); | - |
| 171 | } executed: }Execution Count:22 | 22 |
| 172 | | - |
| 173 | ByteStream::ByteStream(bool fileBacking) | - |
| 174 | : dev(new QBuffer(&ba)), | - |
| 175 | fileBackingEnabled(fileBacking), | - |
| 176 | fileBackingActive(false), | - |
| 177 | handleDirty(false) | - |
| 178 | { | - |
| 179 | dev->open(QIODevice::ReadWrite); executed (the execution status of this line is deduced): dev->open(QIODevice::ReadWrite); | - |
| 180 | } executed: }Execution Count:40 | 40 |
| 181 | | - |
| 182 | ByteStream::~ByteStream() | - |
| 183 | { | - |
| 184 | delete dev; executed (the execution status of this line is deduced): delete dev; | - |
| 185 | } executed: }Execution Count:62 | 62 |
| 186 | | - |
| 187 | ByteStream &ByteStream::operator <<(char chr) | - |
| 188 | { | - |
| 189 | if (handleDirty) prepareBuffer(); never executed: prepareBuffer(); partially evaluated: handleDirty| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 190 | dev->write(&chr, 1); executed (the execution status of this line is deduced): dev->write(&chr, 1); | - |
| 191 | return *this; executed: return *this;Execution Count:4 | 4 |
| 192 | } | - |
| 193 | | - |
| 194 | ByteStream &ByteStream::operator <<(const char *str) | - |
| 195 | { | - |
| 196 | if (handleDirty) prepareBuffer(); never executed: prepareBuffer(); partially evaluated: handleDirty| no Evaluation Count:0 | yes Evaluation Count:298 |
| 0-298 |
| 197 | dev->write(str, strlen(str)); executed (the execution status of this line is deduced): dev->write(str, strlen(str)); | - |
| 198 | return *this; executed: return *this;Execution Count:298 | 298 |
| 199 | } | - |
| 200 | | - |
| 201 | ByteStream &ByteStream::operator <<(const QByteArray &str) | - |
| 202 | { | - |
| 203 | if (handleDirty) prepareBuffer(); never executed: prepareBuffer(); partially evaluated: handleDirty| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 204 | dev->write(str); executed (the execution status of this line is deduced): dev->write(str); | - |
| 205 | return *this; executed: return *this;Execution Count:22 | 22 |
| 206 | } | - |
| 207 | | - |
| 208 | ByteStream &ByteStream::operator <<(const ByteStream &src) | - |
| 209 | { | - |
| 210 | Q_ASSERT(!src.dev->isSequential()); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 211 | if (handleDirty) prepareBuffer(); never executed: prepareBuffer(); never evaluated: handleDirty | 0 |
| 212 | // We do play nice here, even though it looks ugly. | - |
| 213 | // We save the position and restore it afterwards. | - |
| 214 | ByteStream &s = const_cast<ByteStream&>(src); never executed (the execution status of this line is deduced): ByteStream &s = const_cast<ByteStream&>(src); | - |
| 215 | qint64 pos = s.dev->pos(); never executed (the execution status of this line is deduced): qint64 pos = s.dev->pos(); | - |
| 216 | s.dev->reset(); never executed (the execution status of this line is deduced): s.dev->reset(); | - |
| 217 | while (!s.dev->atEnd()) { never evaluated: !s.dev->atEnd() | 0 |
| 218 | QByteArray buf = s.dev->read(chunkSize()); never executed (the execution status of this line is deduced): QByteArray buf = s.dev->read(chunkSize()); | - |
| 219 | dev->write(buf); never executed (the execution status of this line is deduced): dev->write(buf); | - |
| 220 | } | 0 |
| 221 | s.dev->seek(pos); never executed (the execution status of this line is deduced): s.dev->seek(pos); | - |
| 222 | return *this; never executed: return *this; | 0 |
| 223 | } | - |
| 224 | | - |
| 225 | ByteStream &ByteStream::operator <<(qreal val) { | - |
| 226 | char buf[256]; executed (the execution status of this line is deduced): char buf[256]; | - |
| 227 | qt_real_to_string(val, buf); executed (the execution status of this line is deduced): qt_real_to_string(val, buf); | - |
| 228 | *this << buf; executed (the execution status of this line is deduced): *this << buf; | - |
| 229 | return *this; executed: return *this;Execution Count:136 | 136 |
| 230 | } | - |
| 231 | | - |
| 232 | ByteStream &ByteStream::operator <<(int val) { | - |
| 233 | char buf[256]; executed (the execution status of this line is deduced): char buf[256]; | - |
| 234 | qt_int_to_string(val, buf); executed (the execution status of this line is deduced): qt_int_to_string(val, buf); | - |
| 235 | *this << buf; executed (the execution status of this line is deduced): *this << buf; | - |
| 236 | return *this; executed: return *this;Execution Count:4 | 4 |
| 237 | } | - |
| 238 | | - |
| 239 | ByteStream &ByteStream::operator <<(const QPointF &p) { | - |
| 240 | char buf[256]; never executed (the execution status of this line is deduced): char buf[256]; | - |
| 241 | qt_real_to_string(p.x(), buf); never executed (the execution status of this line is deduced): qt_real_to_string(p.x(), buf); | - |
| 242 | *this << buf; never executed (the execution status of this line is deduced): *this << buf; | - |
| 243 | qt_real_to_string(p.y(), buf); never executed (the execution status of this line is deduced): qt_real_to_string(p.y(), buf); | - |
| 244 | *this << buf; never executed (the execution status of this line is deduced): *this << buf; | - |
| 245 | return *this; never executed: return *this; | 0 |
| 246 | } | - |
| 247 | | - |
| 248 | QIODevice *ByteStream::stream() | - |
| 249 | { | - |
| 250 | dev->reset(); executed (the execution status of this line is deduced): dev->reset(); | - |
| 251 | handleDirty = true; executed (the execution status of this line is deduced): handleDirty = true; | - |
| 252 | return dev; executed: return dev;Execution Count:20 | 20 |
| 253 | } | - |
| 254 | | - |
| 255 | void ByteStream::clear() | - |
| 256 | { | - |
| 257 | dev->open(QIODevice::ReadWrite | QIODevice::Truncate); never executed (the execution status of this line is deduced): dev->open(QIODevice::ReadWrite | QIODevice::Truncate); | - |
| 258 | } | 0 |
| 259 | | - |
| 260 | void ByteStream::constructor_helper(QByteArray *ba) | - |
| 261 | { | - |
| 262 | delete dev; never executed (the execution status of this line is deduced): delete dev; | - |
| 263 | dev = new QBuffer(ba); never executed (the execution status of this line is deduced): dev = new QBuffer(ba); | - |
| 264 | dev->open(QIODevice::ReadWrite); never executed (the execution status of this line is deduced): dev->open(QIODevice::ReadWrite); | - |
| 265 | } | 0 |
| 266 | | - |
| 267 | void ByteStream::prepareBuffer() | - |
| 268 | { | - |
| 269 | Q_ASSERT(!dev->isSequential()); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 270 | qint64 size = dev->size(); never executed (the execution status of this line is deduced): qint64 size = dev->size(); | - |
| 271 | if (fileBackingEnabled && !fileBackingActive never evaluated: fileBackingEnabled never evaluated: !fileBackingActive | 0 |
| 272 | && size > maxMemorySize()) { never evaluated: size > maxMemorySize() | 0 |
| 273 | // Switch to file backing. | - |
| 274 | QTemporaryFile *newFile = new QTemporaryFile; never executed (the execution status of this line is deduced): QTemporaryFile *newFile = new QTemporaryFile; | - |
| 275 | newFile->open(); never executed (the execution status of this line is deduced): newFile->open(); | - |
| 276 | dev->reset(); never executed (the execution status of this line is deduced): dev->reset(); | - |
| 277 | while (!dev->atEnd()) { never evaluated: !dev->atEnd() | 0 |
| 278 | QByteArray buf = dev->read(chunkSize()); never executed (the execution status of this line is deduced): QByteArray buf = dev->read(chunkSize()); | - |
| 279 | newFile->write(buf); never executed (the execution status of this line is deduced): newFile->write(buf); | - |
| 280 | } | 0 |
| 281 | delete dev; never executed (the execution status of this line is deduced): delete dev; | - |
| 282 | dev = newFile; never executed (the execution status of this line is deduced): dev = newFile; | - |
| 283 | ba.clear(); never executed (the execution status of this line is deduced): ba.clear(); | - |
| 284 | fileBackingActive = true; never executed (the execution status of this line is deduced): fileBackingActive = true; | - |
| 285 | } | 0 |
| 286 | if (dev->pos() != size) { never evaluated: dev->pos() != size | 0 |
| 287 | dev->seek(size); never executed (the execution status of this line is deduced): dev->seek(size); | - |
| 288 | handleDirty = false; never executed (the execution status of this line is deduced): handleDirty = false; | - |
| 289 | } | 0 |
| 290 | } | 0 |
| 291 | } | - |
| 292 | | - |
| 293 | #define QT_PATH_ELEMENT(elm) | - |
| 294 | | - |
| 295 | QByteArray QPdf::generatePath(const QPainterPath &path, const QTransform &matrix, PathFlags flags) | - |
| 296 | { | - |
| 297 | QByteArray result; never executed (the execution status of this line is deduced): QByteArray result; | - |
| 298 | if (!path.elementCount()) never evaluated: !path.elementCount() | 0 |
| 299 | return result; never executed: return result; | 0 |
| 300 | | - |
| 301 | ByteStream s(&result); never executed (the execution status of this line is deduced): ByteStream s(&result); | - |
| 302 | | - |
| 303 | int start = -1; never executed (the execution status of this line is deduced): int start = -1; | - |
| 304 | for (int i = 0; i < path.elementCount(); ++i) { never evaluated: i < path.elementCount() | 0 |
| 305 | const QPainterPath::Element &elm = path.elementAt(i); never executed (the execution status of this line is deduced): const QPainterPath::Element &elm = path.elementAt(i); | - |
| 306 | switch (elm.type) { | - |
| 307 | case QPainterPath::MoveToElement: | - |
| 308 | if (start >= 0 never evaluated: start >= 0 | 0 |
| 309 | && path.elementAt(start).x == path.elementAt(i-1).x never evaluated: path.elementAt(start).x == path.elementAt(i-1).x | 0 |
| 310 | && path.elementAt(start).y == path.elementAt(i-1).y) never evaluated: path.elementAt(start).y == path.elementAt(i-1).y | 0 |
| 311 | s << "h\n"; never executed: s << "h\n"; | 0 |
| 312 | s << matrix.map(QPointF(elm.x, elm.y)) << "m\n"; never executed (the execution status of this line is deduced): s << matrix.map(QPointF(elm.x, elm.y)) << "m\n"; | - |
| 313 | start = i; never executed (the execution status of this line is deduced): start = i; | - |
| 314 | break; | 0 |
| 315 | case QPainterPath::LineToElement: | - |
| 316 | s << matrix.map(QPointF(elm.x, elm.y)) << "l\n"; never executed (the execution status of this line is deduced): s << matrix.map(QPointF(elm.x, elm.y)) << "l\n"; | - |
| 317 | break; | 0 |
| 318 | case QPainterPath::CurveToElement: | - |
| 319 | Q_ASSERT(path.elementAt(i+1).type == QPainterPath::CurveToDataElement); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 320 | Q_ASSERT(path.elementAt(i+2).type == QPainterPath::CurveToDataElement); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 321 | s << matrix.map(QPointF(elm.x, elm.y)) never executed (the execution status of this line is deduced): s << matrix.map(QPointF(elm.x, elm.y)) | - |
| 322 | << matrix.map(QPointF(path.elementAt(i+1).x, path.elementAt(i+1).y)) never executed (the execution status of this line is deduced): << matrix.map(QPointF(path.elementAt(i+1).x, path.elementAt(i+1).y)) | - |
| 323 | << matrix.map(QPointF(path.elementAt(i+2).x, path.elementAt(i+2).y)) never executed (the execution status of this line is deduced): << matrix.map(QPointF(path.elementAt(i+2).x, path.elementAt(i+2).y)) | - |
| 324 | << "c\n"; never executed (the execution status of this line is deduced): << "c\n"; | - |
| 325 | i += 2; never executed (the execution status of this line is deduced): i += 2; | - |
| 326 | break; | 0 |
| 327 | default: | - |
| 328 | qFatal("QPdf::generatePath(), unhandled type: %d", elm.type); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 328, __PRETTY_FUNCTION__).fatal("QPdf::generatePath(), unhandled type: %d", elm.type); | - |
| 329 | } | 0 |
| 330 | } | 0 |
| 331 | if (start >= 0 never evaluated: start >= 0 | 0 |
| 332 | && path.elementAt(start).x == path.elementAt(path.elementCount()-1).x never evaluated: path.elementAt(start).x == path.elementAt(path.elementCount()-1).x | 0 |
| 333 | && path.elementAt(start).y == path.elementAt(path.elementCount()-1).y) never evaluated: path.elementAt(start).y == path.elementAt(path.elementCount()-1).y | 0 |
| 334 | s << "h\n"; never executed: s << "h\n"; | 0 |
| 335 | | - |
| 336 | Qt::FillRule fillRule = path.fillRule(); never executed (the execution status of this line is deduced): Qt::FillRule fillRule = path.fillRule(); | - |
| 337 | | - |
| 338 | const char *op = ""; never executed (the execution status of this line is deduced): const char *op = ""; | - |
| 339 | switch (flags) { | - |
| 340 | case ClipPath: | - |
| 341 | op = (fillRule == Qt::WindingFill) ? "W n\n" : "W* n\n"; never evaluated: (fillRule == Qt::WindingFill) | 0 |
| 342 | break; | 0 |
| 343 | case FillPath: | - |
| 344 | op = (fillRule == Qt::WindingFill) ? "f\n" : "f*\n"; never evaluated: (fillRule == Qt::WindingFill) | 0 |
| 345 | break; | 0 |
| 346 | case StrokePath: | - |
| 347 | op = "S\n"; never executed (the execution status of this line is deduced): op = "S\n"; | - |
| 348 | break; | 0 |
| 349 | case FillAndStrokePath: | - |
| 350 | op = (fillRule == Qt::WindingFill) ? "B\n" : "B*\n"; never evaluated: (fillRule == Qt::WindingFill) | 0 |
| 351 | break; | 0 |
| 352 | } | - |
| 353 | s << op; never executed (the execution status of this line is deduced): s << op; | - |
| 354 | return result; never executed: return result; | 0 |
| 355 | } | - |
| 356 | | - |
| 357 | QByteArray QPdf::generateMatrix(const QTransform &matrix) | - |
| 358 | { | - |
| 359 | QByteArray result; executed (the execution status of this line is deduced): QByteArray result; | - |
| 360 | ByteStream s(&result); executed (the execution status of this line is deduced): ByteStream s(&result); | - |
| 361 | s << matrix.m11() executed (the execution status of this line is deduced): s << matrix.m11() | - |
| 362 | << matrix.m12() executed (the execution status of this line is deduced): << matrix.m12() | - |
| 363 | << matrix.m21() executed (the execution status of this line is deduced): << matrix.m21() | - |
| 364 | << matrix.m22() executed (the execution status of this line is deduced): << matrix.m22() | - |
| 365 | << matrix.dx() executed (the execution status of this line is deduced): << matrix.dx() | - |
| 366 | << matrix.dy() executed (the execution status of this line is deduced): << matrix.dy() | - |
| 367 | << "cm\n"; executed (the execution status of this line is deduced): << "cm\n"; | - |
| 368 | return result; executed: return result;Execution Count:20 | 20 |
| 369 | } | - |
| 370 | | - |
| 371 | QByteArray QPdf::generateDashes(const QPen &pen) | - |
| 372 | { | - |
| 373 | QByteArray result; executed (the execution status of this line is deduced): QByteArray result; | - |
| 374 | ByteStream s(&result); executed (the execution status of this line is deduced): ByteStream s(&result); | - |
| 375 | s << '['; executed (the execution status of this line is deduced): s << '['; | - |
| 376 | | - |
| 377 | QVector<qreal> dasharray = pen.dashPattern(); executed (the execution status of this line is deduced): QVector<qreal> dasharray = pen.dashPattern(); | - |
| 378 | qreal w = pen.widthF(); executed (the execution status of this line is deduced): qreal w = pen.widthF(); | - |
| 379 | if (w < 0.001) partially evaluated: w < 0.001| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 380 | w = 1; | 0 |
| 381 | for (int i = 0; i < dasharray.size(); ++i) { partially evaluated: i < dasharray.size()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 382 | qreal dw = dasharray.at(i)*w; never executed (the execution status of this line is deduced): qreal dw = dasharray.at(i)*w; | - |
| 383 | if (dw < 0.0001) dw = 0.0001; never executed: dw = 0.0001; never evaluated: dw < 0.0001 | 0 |
| 384 | s << dw; never executed (the execution status of this line is deduced): s << dw; | - |
| 385 | } | 0 |
| 386 | s << ']'; executed (the execution status of this line is deduced): s << ']'; | - |
| 387 | //qDebug() << "dasharray: pen has" << dasharray; | - |
| 388 | //qDebug() << " => " << result; | - |
| 389 | return result; executed: return result;Execution Count:2 | 2 |
| 390 | } | - |
| 391 | | - |
| 392 | | - |
| 393 | | - |
| 394 | static const char* pattern_for_brush[] = { | - |
| 395 | 0, // NoBrush | - |
| 396 | 0, // SolidPattern | - |
| 397 | "0 J\n" | - |
| 398 | "6 w\n" | - |
| 399 | "[] 0 d\n" | - |
| 400 | "4 0 m\n" | - |
| 401 | "4 8 l\n" | - |
| 402 | "0 4 m\n" | - |
| 403 | "8 4 l\n" | - |
| 404 | "S\n", // Dense1Pattern | - |
| 405 | | - |
| 406 | "0 J\n" | - |
| 407 | "2 w\n" | - |
| 408 | "[6 2] 1 d\n" | - |
| 409 | "0 0 m\n" | - |
| 410 | "0 8 l\n" | - |
| 411 | "8 0 m\n" | - |
| 412 | "8 8 l\n" | - |
| 413 | "S\n" | - |
| 414 | "[] 0 d\n" | - |
| 415 | "2 0 m\n" | - |
| 416 | "2 8 l\n" | - |
| 417 | "6 0 m\n" | - |
| 418 | "6 8 l\n" | - |
| 419 | "S\n" | - |
| 420 | "[6 2] -3 d\n" | - |
| 421 | "4 0 m\n" | - |
| 422 | "4 8 l\n" | - |
| 423 | "S\n", // Dense2Pattern | - |
| 424 | | - |
| 425 | "0 J\n" | - |
| 426 | "2 w\n" | - |
| 427 | "[6 2] 1 d\n" | - |
| 428 | "0 0 m\n" | - |
| 429 | "0 8 l\n" | - |
| 430 | "8 0 m\n" | - |
| 431 | "8 8 l\n" | - |
| 432 | "S\n" | - |
| 433 | "[2 2] -1 d\n" | - |
| 434 | "2 0 m\n" | - |
| 435 | "2 8 l\n" | - |
| 436 | "6 0 m\n" | - |
| 437 | "6 8 l\n" | - |
| 438 | "S\n" | - |
| 439 | "[6 2] -3 d\n" | - |
| 440 | "4 0 m\n" | - |
| 441 | "4 8 l\n" | - |
| 442 | "S\n", // Dense3Pattern | - |
| 443 | | - |
| 444 | "0 J\n" | - |
| 445 | "2 w\n" | - |
| 446 | "[2 2] 1 d\n" | - |
| 447 | "0 0 m\n" | - |
| 448 | "0 8 l\n" | - |
| 449 | "8 0 m\n" | - |
| 450 | "8 8 l\n" | - |
| 451 | "S\n" | - |
| 452 | "[2 2] -1 d\n" | - |
| 453 | "2 0 m\n" | - |
| 454 | "2 8 l\n" | - |
| 455 | "6 0 m\n" | - |
| 456 | "6 8 l\n" | - |
| 457 | "S\n" | - |
| 458 | "[2 2] 1 d\n" | - |
| 459 | "4 0 m\n" | - |
| 460 | "4 8 l\n" | - |
| 461 | "S\n", // Dense4Pattern | - |
| 462 | | - |
| 463 | "0 J\n" | - |
| 464 | "2 w\n" | - |
| 465 | "[2 6] -1 d\n" | - |
| 466 | "0 0 m\n" | - |
| 467 | "0 8 l\n" | - |
| 468 | "8 0 m\n" | - |
| 469 | "8 8 l\n" | - |
| 470 | "S\n" | - |
| 471 | "[2 2] 1 d\n" | - |
| 472 | "2 0 m\n" | - |
| 473 | "2 8 l\n" | - |
| 474 | "6 0 m\n" | - |
| 475 | "6 8 l\n" | - |
| 476 | "S\n" | - |
| 477 | "[2 6] 3 d\n" | - |
| 478 | "4 0 m\n" | - |
| 479 | "4 8 l\n" | - |
| 480 | "S\n", // Dense5Pattern | - |
| 481 | | - |
| 482 | "0 J\n" | - |
| 483 | "2 w\n" | - |
| 484 | "[2 6] -1 d\n" | - |
| 485 | "0 0 m\n" | - |
| 486 | "0 8 l\n" | - |
| 487 | "8 0 m\n" | - |
| 488 | "8 8 l\n" | - |
| 489 | "S\n" | - |
| 490 | "[2 6] 3 d\n" | - |
| 491 | "4 0 m\n" | - |
| 492 | "4 8 l\n" | - |
| 493 | "S\n", // Dense6Pattern | - |
| 494 | | - |
| 495 | "0 J\n" | - |
| 496 | "2 w\n" | - |
| 497 | "[2 6] -1 d\n" | - |
| 498 | "0 0 m\n" | - |
| 499 | "0 8 l\n" | - |
| 500 | "8 0 m\n" | - |
| 501 | "8 8 l\n" | - |
| 502 | "S\n", // Dense7Pattern | - |
| 503 | | - |
| 504 | "1 w\n" | - |
| 505 | "0 4 m\n" | - |
| 506 | "8 4 l\n" | - |
| 507 | "S\n", // HorPattern | - |
| 508 | | - |
| 509 | "1 w\n" | - |
| 510 | "4 0 m\n" | - |
| 511 | "4 8 l\n" | - |
| 512 | "S\n", // VerPattern | - |
| 513 | | - |
| 514 | "1 w\n" | - |
| 515 | "4 0 m\n" | - |
| 516 | "4 8 l\n" | - |
| 517 | "0 4 m\n" | - |
| 518 | "8 4 l\n" | - |
| 519 | "S\n", // CrossPattern | - |
| 520 | | - |
| 521 | "1 w\n" | - |
| 522 | "-1 5 m\n" | - |
| 523 | "5 -1 l\n" | - |
| 524 | "3 9 m\n" | - |
| 525 | "9 3 l\n" | - |
| 526 | "S\n", // BDiagPattern | - |
| 527 | | - |
| 528 | "1 w\n" | - |
| 529 | "-1 3 m\n" | - |
| 530 | "5 9 l\n" | - |
| 531 | "3 -1 m\n" | - |
| 532 | "9 5 l\n" | - |
| 533 | "S\n", // FDiagPattern | - |
| 534 | | - |
| 535 | "1 w\n" | - |
| 536 | "-1 3 m\n" | - |
| 537 | "5 9 l\n" | - |
| 538 | "3 -1 m\n" | - |
| 539 | "9 5 l\n" | - |
| 540 | "-1 5 m\n" | - |
| 541 | "5 -1 l\n" | - |
| 542 | "3 9 m\n" | - |
| 543 | "9 3 l\n" | - |
| 544 | "S\n", // DiagCrossPattern | - |
| 545 | }; | - |
| 546 | | - |
| 547 | QByteArray QPdf::patternForBrush(const QBrush &b) | - |
| 548 | { | - |
| 549 | int style = b.style(); never executed (the execution status of this line is deduced): int style = b.style(); | - |
| 550 | if (style > Qt::DiagCrossPattern) never evaluated: style > Qt::DiagCrossPattern | 0 |
| 551 | return QByteArray(); never executed: return QByteArray(); | 0 |
| 552 | return pattern_for_brush[style]; never executed: return pattern_for_brush[style]; | 0 |
| 553 | } | - |
| 554 | | - |
| 555 | #ifdef USE_NATIVE_GRADIENTS | - |
| 556 | static void writeTriangleLine(uchar *&data, int xpos, int ypos, int xoff, int yoff, uint rgb, uchar flag, bool alpha) | - |
| 557 | { | - |
| 558 | data[0] = flag; | - |
| 559 | data[1] = (uchar)(xpos >> 16); | - |
| 560 | data[2] = (uchar)(xpos >> 8); | - |
| 561 | data[3] = (uchar)(xpos >> 0); | - |
| 562 | data[4] = (uchar)(ypos >> 16); | - |
| 563 | data[5] = (uchar)(ypos >> 8); | - |
| 564 | data[6] = (uchar)(ypos >> 0); | - |
| 565 | data += 7; | - |
| 566 | if (alpha) { | - |
| 567 | *data++ = (uchar)qAlpha(rgb); | - |
| 568 | } else { | - |
| 569 | *data++ = (uchar)qRed(rgb); | - |
| 570 | *data++ = (uchar)qGreen(rgb); | - |
| 571 | *data++ = (uchar)qBlue(rgb); | - |
| 572 | } | - |
| 573 | xpos += xoff; | - |
| 574 | ypos += yoff; | - |
| 575 | data[0] = flag; | - |
| 576 | data[1] = (uchar)(xpos >> 16); | - |
| 577 | data[2] = (uchar)(xpos >> 8); | - |
| 578 | data[3] = (uchar)(xpos >> 0); | - |
| 579 | data[4] = (uchar)(ypos >> 16); | - |
| 580 | data[5] = (uchar)(ypos >> 8); | - |
| 581 | data[6] = (uchar)(ypos >> 0); | - |
| 582 | data += 7; | - |
| 583 | if (alpha) { | - |
| 584 | *data++ = (uchar)qAlpha(rgb); | - |
| 585 | } else { | - |
| 586 | *data++ = (uchar)qRed(rgb); | - |
| 587 | *data++ = (uchar)qGreen(rgb); | - |
| 588 | *data++ = (uchar)qBlue(rgb); | - |
| 589 | } | - |
| 590 | } | - |
| 591 | | - |
| 592 | | - |
| 593 | QByteArray QPdf::generateLinearGradientShader(const QLinearGradient *gradient, const QPointF *page_rect, bool alpha) | - |
| 594 | { | - |
| 595 | // generate list of triangles with colors | - |
| 596 | QPointF start = gradient->start(); | - |
| 597 | QPointF stop = gradient->finalStop(); | - |
| 598 | QGradientStops stops = gradient->stops(); | - |
| 599 | QPointF offset = stop - start; | - |
| 600 | QGradient::Spread spread = gradient->spread(); | - |
| 601 | | - |
| 602 | if (gradient->spread() == QGradient::ReflectSpread) { | - |
| 603 | offset *= 2; | - |
| 604 | for (int i = stops.size() - 2; i >= 0; --i) { | - |
| 605 | QGradientStop stop = stops.at(i); | - |
| 606 | stop.first = 2. - stop.first; | - |
| 607 | stops.append(stop); | - |
| 608 | } | - |
| 609 | for (int i = 0 ; i < stops.size(); ++i) | - |
| 610 | stops[i].first /= 2.; | - |
| 611 | } | - |
| 612 | | - |
| 613 | QPointF orthogonal(offset.y(), -offset.x()); | - |
| 614 | qreal length = offset.x()*offset.x() + offset.y()*offset.y(); | - |
| 615 | | - |
| 616 | // find the max and min values in offset and orth direction that are needed to cover | - |
| 617 | // the whole page | - |
| 618 | int off_min = INT_MAX; | - |
| 619 | int off_max = INT_MIN; | - |
| 620 | qreal ort_min = INT_MAX; | - |
| 621 | qreal ort_max = INT_MIN; | - |
| 622 | for (int i = 0; i < 4; ++i) { | - |
| 623 | qreal off = ((page_rect[i].x() - start.x()) * offset.x() + (page_rect[i].y() - start.y()) * offset.y())/length; | - |
| 624 | qreal ort = ((page_rect[i].x() - start.x()) * orthogonal.x() + (page_rect[i].y() - start.y()) * orthogonal.y())/length; | - |
| 625 | off_min = qMin(off_min, qFloor(off)); | - |
| 626 | off_max = qMax(off_max, qCeil(off)); | - |
| 627 | ort_min = qMin(ort_min, ort); | - |
| 628 | ort_max = qMax(ort_max, ort); | - |
| 629 | } | - |
| 630 | ort_min -= 1; | - |
| 631 | ort_max += 1; | - |
| 632 | | - |
| 633 | start += off_min * offset + ort_min * orthogonal; | - |
| 634 | orthogonal *= (ort_max - ort_min); | - |
| 635 | int num = off_max - off_min; | - |
| 636 | | - |
| 637 | QPointF gradient_rect[4] = { start, | - |
| 638 | start + orthogonal, | - |
| 639 | start + num*offset, | - |
| 640 | start + num*offset + orthogonal }; | - |
| 641 | qreal xmin = gradient_rect[0].x(); | - |
| 642 | qreal xmax = gradient_rect[0].x(); | - |
| 643 | qreal ymin = gradient_rect[0].y(); | - |
| 644 | qreal ymax = gradient_rect[0].y(); | - |
| 645 | for (int i = 1; i < 4; ++i) { | - |
| 646 | xmin = qMin(xmin, gradient_rect[i].x()); | - |
| 647 | xmax = qMax(xmax, gradient_rect[i].x()); | - |
| 648 | ymin = qMin(ymin, gradient_rect[i].y()); | - |
| 649 | ymax = qMax(ymax, gradient_rect[i].y()); | - |
| 650 | } | - |
| 651 | xmin -= 1000; | - |
| 652 | xmax += 1000; | - |
| 653 | ymin -= 1000; | - |
| 654 | ymax += 1000; | - |
| 655 | start -= QPointF(xmin, ymin); | - |
| 656 | qreal factor_x = qreal(1<<24)/(xmax - xmin); | - |
| 657 | qreal factor_y = qreal(1<<24)/(ymax - ymin); | - |
| 658 | int xoff = (int)(orthogonal.x()*factor_x); | - |
| 659 | int yoff = (int)(orthogonal.y()*factor_y); | - |
| 660 | | - |
| 661 | QByteArray triangles; | - |
| 662 | triangles.resize(spread == QGradient::PadSpread ? 20*(stops.size()+2) : 20*num*stops.size()); | - |
| 663 | uchar *data = (uchar *) triangles.data(); | - |
| 664 | if (spread == QGradient::PadSpread) { | - |
| 665 | if (off_min > 0 || off_max < 1) { | - |
| 666 | // linear gradient outside of page | - |
| 667 | const QGradientStop ¤t_stop = off_min > 0 ? stops.at(stops.size()-1) : stops.at(0); | - |
| 668 | uint rgb = current_stop.second.rgba(); | - |
| 669 | int xpos = (int)(start.x()*factor_x); | - |
| 670 | int ypos = (int)(start.y()*factor_y); | - |
| 671 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, 0, alpha); | - |
| 672 | start += num*offset; | - |
| 673 | xpos = (int)(start.x()*factor_x); | - |
| 674 | ypos = (int)(start.y()*factor_y); | - |
| 675 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, 1, alpha); | - |
| 676 | } else { | - |
| 677 | int flag = 0; | - |
| 678 | if (off_min < 0) { | - |
| 679 | uint rgb = stops.at(0).second.rgba(); | - |
| 680 | int xpos = (int)(start.x()*factor_x); | - |
| 681 | int ypos = (int)(start.y()*factor_y); | - |
| 682 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha); | - |
| 683 | start -= off_min*offset; | - |
| 684 | flag = 1; | - |
| 685 | } | - |
| 686 | for (int s = 0; s < stops.size(); ++s) { | - |
| 687 | const QGradientStop ¤t_stop = stops.at(s); | - |
| 688 | uint rgb = current_stop.second.rgba(); | - |
| 689 | int xpos = (int)(start.x()*factor_x); | - |
| 690 | int ypos = (int)(start.y()*factor_y); | - |
| 691 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha); | - |
| 692 | if (s < stops.size()-1) | - |
| 693 | start += offset*(stops.at(s+1).first - stops.at(s).first); | - |
| 694 | flag = 1; | - |
| 695 | } | - |
| 696 | if (off_max > 1) { | - |
| 697 | start += (off_max - 1)*offset; | - |
| 698 | uint rgb = stops.at(stops.size()-1).second.rgba(); | - |
| 699 | int xpos = (int)(start.x()*factor_x); | - |
| 700 | int ypos = (int)(start.y()*factor_y); | - |
| 701 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha); | - |
| 702 | } | - |
| 703 | } | - |
| 704 | } else { | - |
| 705 | for (int i = 0; i < num; ++i) { | - |
| 706 | uchar flag = 0; | - |
| 707 | for (int s = 0; s < stops.size(); ++s) { | - |
| 708 | uint rgb = stops.at(s).second.rgba(); | - |
| 709 | int xpos = (int)(start.x()*factor_x); | - |
| 710 | int ypos = (int)(start.y()*factor_y); | - |
| 711 | writeTriangleLine(data, xpos, ypos, xoff, yoff, rgb, flag, alpha); | - |
| 712 | if (s < stops.size()-1) | - |
| 713 | start += offset*(stops.at(s+1).first - stops.at(s).first); | - |
| 714 | flag = 1; | - |
| 715 | } | - |
| 716 | } | - |
| 717 | } | - |
| 718 | triangles.resize((char *)data - triangles.constData()); | - |
| 719 | | - |
| 720 | QByteArray shader; | - |
| 721 | QPdf::ByteStream s(&shader); | - |
| 722 | s << "<<\n" | - |
| 723 | "/ShadingType 4\n" | - |
| 724 | "/ColorSpace " << (alpha ? "/DeviceGray\n" : "/DeviceRGB\n") << | - |
| 725 | "/AntiAlias true\n" | - |
| 726 | "/BitsPerCoordinate 24\n" | - |
| 727 | "/BitsPerComponent 8\n" | - |
| 728 | "/BitsPerFlag 8\n" | - |
| 729 | "/Decode [" << xmin << xmax << ymin << ymax << (alpha ? "0 1]\n" : "0 1 0 1 0 1]\n") << | - |
| 730 | "/AntiAlias true\n" | - |
| 731 | "/Length " << triangles.length() << "\n" | - |
| 732 | ">>\n" | - |
| 733 | "stream\n" << triangles << "endstream\n" | - |
| 734 | "endobj\n"; | - |
| 735 | return shader; | - |
| 736 | } | - |
| 737 | #endif | - |
| 738 | | - |
| 739 | static void moveToHook(qfixed x, qfixed y, void *data) | - |
| 740 | { | - |
| 741 | QPdf::Stroker *t = (QPdf::Stroker *)data; never executed (the execution status of this line is deduced): QPdf::Stroker *t = (QPdf::Stroker *)data; | - |
| 742 | if (!t->first) never evaluated: !t->first | 0 |
| 743 | *t->stream << "h\n"; never executed: *t->stream << "h\n"; | 0 |
| 744 | if (!t->cosmeticPen) never evaluated: !t->cosmeticPen | 0 |
| 745 | t->matrix.map(x, y, &x, &y); never executed: t->matrix.map(x, y, &x, &y); | 0 |
| 746 | *t->stream << x << y << "m\n"; never executed (the execution status of this line is deduced): *t->stream << x << y << "m\n"; | - |
| 747 | t->first = false; never executed (the execution status of this line is deduced): t->first = false; | - |
| 748 | } | 0 |
| 749 | | - |
| 750 | static void lineToHook(qfixed x, qfixed y, void *data) | - |
| 751 | { | - |
| 752 | QPdf::Stroker *t = (QPdf::Stroker *)data; never executed (the execution status of this line is deduced): QPdf::Stroker *t = (QPdf::Stroker *)data; | - |
| 753 | if (!t->cosmeticPen) never evaluated: !t->cosmeticPen | 0 |
| 754 | t->matrix.map(x, y, &x, &y); never executed: t->matrix.map(x, y, &x, &y); | 0 |
| 755 | *t->stream << x << y << "l\n"; never executed (the execution status of this line is deduced): *t->stream << x << y << "l\n"; | - |
| 756 | } | 0 |
| 757 | | - |
| 758 | static void cubicToHook(qfixed c1x, qfixed c1y, | - |
| 759 | qfixed c2x, qfixed c2y, | - |
| 760 | qfixed ex, qfixed ey, | - |
| 761 | void *data) | - |
| 762 | { | - |
| 763 | QPdf::Stroker *t = (QPdf::Stroker *)data; never executed (the execution status of this line is deduced): QPdf::Stroker *t = (QPdf::Stroker *)data; | - |
| 764 | if (!t->cosmeticPen) { never evaluated: !t->cosmeticPen | 0 |
| 765 | t->matrix.map(c1x, c1y, &c1x, &c1y); never executed (the execution status of this line is deduced): t->matrix.map(c1x, c1y, &c1x, &c1y); | - |
| 766 | t->matrix.map(c2x, c2y, &c2x, &c2y); never executed (the execution status of this line is deduced): t->matrix.map(c2x, c2y, &c2x, &c2y); | - |
| 767 | t->matrix.map(ex, ey, &ex, &ey); never executed (the execution status of this line is deduced): t->matrix.map(ex, ey, &ex, &ey); | - |
| 768 | } | 0 |
| 769 | *t->stream << c1x << c1y never executed (the execution status of this line is deduced): *t->stream << c1x << c1y | - |
| 770 | << c2x << c2y never executed (the execution status of this line is deduced): << c2x << c2y | - |
| 771 | << ex << ey never executed (the execution status of this line is deduced): << ex << ey | - |
| 772 | << "c\n"; never executed (the execution status of this line is deduced): << "c\n"; | - |
| 773 | } | 0 |
| 774 | | - |
| 775 | QPdf::Stroker::Stroker() | - |
| 776 | : stream(0), | - |
| 777 | first(true), | - |
| 778 | dashStroker(&basicStroker) | - |
| 779 | { | - |
| 780 | stroker = &basicStroker; executed (the execution status of this line is deduced): stroker = &basicStroker; | - |
| 781 | basicStroker.setMoveToHook(moveToHook); executed (the execution status of this line is deduced): basicStroker.setMoveToHook(moveToHook); | - |
| 782 | basicStroker.setLineToHook(lineToHook); executed (the execution status of this line is deduced): basicStroker.setLineToHook(lineToHook); | - |
| 783 | basicStroker.setCubicToHook(cubicToHook); executed (the execution status of this line is deduced): basicStroker.setCubicToHook(cubicToHook); | - |
| 784 | cosmeticPen = true; executed (the execution status of this line is deduced): cosmeticPen = true; | - |
| 785 | basicStroker.setStrokeWidth(.1); executed (the execution status of this line is deduced): basicStroker.setStrokeWidth(.1); | - |
| 786 | } executed: }Execution Count:234 | 234 |
| 787 | | - |
| 788 | void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints) | - |
| 789 | { | - |
| 790 | if (pen.style() == Qt::NoPen) { partially evaluated: pen.style() == Qt::NoPen| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 791 | stroker = 0; never executed (the execution status of this line is deduced): stroker = 0; | - |
| 792 | return; | 0 |
| 793 | } | - |
| 794 | qreal w = pen.widthF(); executed (the execution status of this line is deduced): qreal w = pen.widthF(); | - |
| 795 | bool zeroWidth = w < 0.0001; executed (the execution status of this line is deduced): bool zeroWidth = w < 0.0001; | - |
| 796 | cosmeticPen = qt_pen_is_cosmetic(pen, hints); executed (the execution status of this line is deduced): cosmeticPen = qt_pen_is_cosmetic(pen, hints); | - |
| 797 | if (zeroWidth) partially evaluated: zeroWidth| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 798 | w = .1; | 0 |
| 799 | | - |
| 800 | basicStroker.setStrokeWidth(w); executed (the execution status of this line is deduced): basicStroker.setStrokeWidth(w); | - |
| 801 | basicStroker.setCapStyle(pen.capStyle()); executed (the execution status of this line is deduced): basicStroker.setCapStyle(pen.capStyle()); | - |
| 802 | basicStroker.setJoinStyle(pen.joinStyle()); executed (the execution status of this line is deduced): basicStroker.setJoinStyle(pen.joinStyle()); | - |
| 803 | basicStroker.setMiterLimit(pen.miterLimit()); executed (the execution status of this line is deduced): basicStroker.setMiterLimit(pen.miterLimit()); | - |
| 804 | | - |
| 805 | QVector<qreal> dashpattern = pen.dashPattern(); executed (the execution status of this line is deduced): QVector<qreal> dashpattern = pen.dashPattern(); | - |
| 806 | if (zeroWidth) { partially evaluated: zeroWidth| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 807 | for (int i = 0; i < dashpattern.size(); ++i) never evaluated: i < dashpattern.size() | 0 |
| 808 | dashpattern[i] *= 10.; never executed: dashpattern[i] *= 10.; | 0 |
| 809 | } | 0 |
| 810 | if (!dashpattern.isEmpty()) { partially evaluated: !dashpattern.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 811 | dashStroker.setDashPattern(dashpattern); never executed (the execution status of this line is deduced): dashStroker.setDashPattern(dashpattern); | - |
| 812 | dashStroker.setDashOffset(pen.dashOffset()); never executed (the execution status of this line is deduced): dashStroker.setDashOffset(pen.dashOffset()); | - |
| 813 | stroker = &dashStroker; never executed (the execution status of this line is deduced): stroker = &dashStroker; | - |
| 814 | } else { | 0 |
| 815 | stroker = &basicStroker; executed (the execution status of this line is deduced): stroker = &basicStroker; | - |
| 816 | } executed: }Execution Count:2 | 2 |
| 817 | } | - |
| 818 | | - |
| 819 | void QPdf::Stroker::strokePath(const QPainterPath &path) | - |
| 820 | { | - |
| 821 | if (!stroker) never evaluated: !stroker | 0 |
| 822 | return; | 0 |
| 823 | first = true; never executed (the execution status of this line is deduced): first = true; | - |
| 824 | | - |
| 825 | stroker->strokePath(path, this, cosmeticPen ? matrix : QTransform()); never executed (the execution status of this line is deduced): stroker->strokePath(path, this, cosmeticPen ? matrix : QTransform()); | - |
| 826 | *stream << "h f\n"; never executed (the execution status of this line is deduced): *stream << "h f\n"; | - |
| 827 | } | 0 |
| 828 | | - |
| 829 | QByteArray QPdf::ascii85Encode(const QByteArray &input) | - |
| 830 | { | - |
| 831 | int isize = input.size()/4*4; never executed (the execution status of this line is deduced): int isize = input.size()/4*4; | - |
| 832 | QByteArray output; never executed (the execution status of this line is deduced): QByteArray output; | - |
| 833 | output.resize(input.size()*5/4+7); never executed (the execution status of this line is deduced): output.resize(input.size()*5/4+7); | - |
| 834 | char *out = output.data(); never executed (the execution status of this line is deduced): char *out = output.data(); | - |
| 835 | const uchar *in = (const uchar *)input.constData(); never executed (the execution status of this line is deduced): const uchar *in = (const uchar *)input.constData(); | - |
| 836 | for (int i = 0; i < isize; i += 4) { never evaluated: i < isize | 0 |
| 837 | uint val = (((uint)in[i])<<24) + (((uint)in[i+1])<<16) + (((uint)in[i+2])<<8) + (uint)in[i+3]; never executed (the execution status of this line is deduced): uint val = (((uint)in[i])<<24) + (((uint)in[i+1])<<16) + (((uint)in[i+2])<<8) + (uint)in[i+3]; | - |
| 838 | if (val == 0) { never evaluated: val == 0 | 0 |
| 839 | *out = 'z'; never executed (the execution status of this line is deduced): *out = 'z'; | - |
| 840 | ++out; never executed (the execution status of this line is deduced): ++out; | - |
| 841 | } else { | 0 |
| 842 | char base[5]; never executed (the execution status of this line is deduced): char base[5]; | - |
| 843 | base[4] = val % 85; never executed (the execution status of this line is deduced): base[4] = val % 85; | - |
| 844 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 845 | base[3] = val % 85; never executed (the execution status of this line is deduced): base[3] = val % 85; | - |
| 846 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 847 | base[2] = val % 85; never executed (the execution status of this line is deduced): base[2] = val % 85; | - |
| 848 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 849 | base[1] = val % 85; never executed (the execution status of this line is deduced): base[1] = val % 85; | - |
| 850 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 851 | base[0] = val % 85; never executed (the execution status of this line is deduced): base[0] = val % 85; | - |
| 852 | *(out++) = base[0] + '!'; never executed (the execution status of this line is deduced): *(out++) = base[0] + '!'; | - |
| 853 | *(out++) = base[1] + '!'; never executed (the execution status of this line is deduced): *(out++) = base[1] + '!'; | - |
| 854 | *(out++) = base[2] + '!'; never executed (the execution status of this line is deduced): *(out++) = base[2] + '!'; | - |
| 855 | *(out++) = base[3] + '!'; never executed (the execution status of this line is deduced): *(out++) = base[3] + '!'; | - |
| 856 | *(out++) = base[4] + '!'; never executed (the execution status of this line is deduced): *(out++) = base[4] + '!'; | - |
| 857 | } | 0 |
| 858 | } | - |
| 859 | //write the last few bytes | - |
| 860 | int remaining = input.size() - isize; never executed (the execution status of this line is deduced): int remaining = input.size() - isize; | - |
| 861 | if (remaining) { never evaluated: remaining | 0 |
| 862 | uint val = 0; never executed (the execution status of this line is deduced): uint val = 0; | - |
| 863 | for (int i = isize; i < input.size(); ++i) never evaluated: i < input.size() | 0 |
| 864 | val = (val << 8) + in[i]; never executed: val = (val << 8) + in[i]; | 0 |
| 865 | val <<= 8*(4-remaining); never executed (the execution status of this line is deduced): val <<= 8*(4-remaining); | - |
| 866 | char base[5]; never executed (the execution status of this line is deduced): char base[5]; | - |
| 867 | base[4] = val % 85; never executed (the execution status of this line is deduced): base[4] = val % 85; | - |
| 868 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 869 | base[3] = val % 85; never executed (the execution status of this line is deduced): base[3] = val % 85; | - |
| 870 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 871 | base[2] = val % 85; never executed (the execution status of this line is deduced): base[2] = val % 85; | - |
| 872 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 873 | base[1] = val % 85; never executed (the execution status of this line is deduced): base[1] = val % 85; | - |
| 874 | val /= 85; never executed (the execution status of this line is deduced): val /= 85; | - |
| 875 | base[0] = val % 85; never executed (the execution status of this line is deduced): base[0] = val % 85; | - |
| 876 | for (int i = 0; i < remaining+1; ++i) never evaluated: i < remaining+1 | 0 |
| 877 | *(out++) = base[i] + '!'; never executed: *(out++) = base[i] + '!'; | 0 |
| 878 | } | 0 |
| 879 | *(out++) = '~'; never executed (the execution status of this line is deduced): *(out++) = '~'; | - |
| 880 | *(out++) = '>'; never executed (the execution status of this line is deduced): *(out++) = '>'; | - |
| 881 | output.resize(out-output.data()); never executed (the execution status of this line is deduced): output.resize(out-output.data()); | - |
| 882 | return output; never executed: return output; | 0 |
| 883 | } | - |
| 884 | | - |
| 885 | const char *QPdf::toHex(ushort u, char *buffer) | - |
| 886 | { | - |
| 887 | int i = 3; never executed (the execution status of this line is deduced): int i = 3; | - |
| 888 | while (i >= 0) { | 0 |
| 889 | ushort hex = (u & 0x000f); never executed (the execution status of this line is deduced): ushort hex = (u & 0x000f); | - |
| 890 | if (hex < 0x0a) never evaluated: hex < 0x0a | 0 |
| 891 | buffer[i] = '0'+hex; never executed: buffer[i] = '0'+hex; | 0 |
| 892 | else | - |
| 893 | buffer[i] = 'A'+(hex-0x0a); never executed: buffer[i] = 'A'+(hex-0x0a); | 0 |
| 894 | u = u >> 4; never executed (the execution status of this line is deduced): u = u >> 4; | - |
| 895 | i--; never executed (the execution status of this line is deduced): i--; | - |
| 896 | } | 0 |
| 897 | buffer[4] = '\0'; never executed (the execution status of this line is deduced): buffer[4] = '\0'; | - |
| 898 | return buffer; never executed: return buffer; | 0 |
| 899 | } | - |
| 900 | | - |
| 901 | const char *QPdf::toHex(uchar u, char *buffer) | - |
| 902 | { | - |
| 903 | int i = 1; never executed (the execution status of this line is deduced): int i = 1; | - |
| 904 | while (i >= 0) { | 0 |
| 905 | ushort hex = (u & 0x000f); never executed (the execution status of this line is deduced): ushort hex = (u & 0x000f); | - |
| 906 | if (hex < 0x0a) never evaluated: hex < 0x0a | 0 |
| 907 | buffer[i] = '0'+hex; never executed: buffer[i] = '0'+hex; | 0 |
| 908 | else | - |
| 909 | buffer[i] = 'A'+(hex-0x0a); never executed: buffer[i] = 'A'+(hex-0x0a); | 0 |
| 910 | u = u >> 4; never executed (the execution status of this line is deduced): u = u >> 4; | - |
| 911 | i--; never executed (the execution status of this line is deduced): i--; | - |
| 912 | } | 0 |
| 913 | buffer[2] = '\0'; never executed (the execution status of this line is deduced): buffer[2] = '\0'; | - |
| 914 | return buffer; never executed: return buffer; | 0 |
| 915 | } | - |
| 916 | | - |
| 917 | | - |
| 918 | QPdfPage::QPdfPage() | - |
| 919 | : QPdf::ByteStream(true) // Enable file backing | - |
| 920 | { | - |
| 921 | } executed: }Execution Count:40 | 40 |
| 922 | | - |
| 923 | void QPdfPage::streamImage(int w, int h, int object) | - |
| 924 | { | - |
| 925 | *this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n"; never executed (the execution status of this line is deduced): *this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n"; | - |
| 926 | if (!images.contains(object)) never evaluated: !images.contains(object) | 0 |
| 927 | images.append(object); never executed: images.append(object); | 0 |
| 928 | } | 0 |
| 929 | | - |
| 930 | | - |
| 931 | QPdfEngine::QPdfEngine(QPdfEnginePrivate &dd) | - |
| 932 | : QPaintEngine(dd, qt_pdf_decide_features()) | - |
| 933 | { | - |
| 934 | } executed: }Execution Count:234 | 234 |
| 935 | | - |
| 936 | QPdfEngine::QPdfEngine() | - |
| 937 | : QPaintEngine(*new QPdfEnginePrivate(), qt_pdf_decide_features()) | - |
| 938 | { | - |
| 939 | } | 0 |
| 940 | | - |
| 941 | void QPdfEngine::setOutputFilename(const QString &filename) | - |
| 942 | { | - |
| 943 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 944 | d->outputFileName = filename; never executed (the execution status of this line is deduced): d->outputFileName = filename; | - |
| 945 | } | 0 |
| 946 | | - |
| 947 | | - |
| 948 | void QPdfEngine::drawPoints (const QPointF *points, int pointCount) | - |
| 949 | { | - |
| 950 | if (!points) | 0 |
| 951 | return; | 0 |
| 952 | | - |
| 953 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 954 | QPainterPath p; never executed (the execution status of this line is deduced): QPainterPath p; | - |
| 955 | for (int i=0; i!=pointCount;++i) { never evaluated: i!=pointCount | 0 |
| 956 | p.moveTo(points[i]); never executed (the execution status of this line is deduced): p.moveTo(points[i]); | - |
| 957 | p.lineTo(points[i] + QPointF(0, 0.001)); never executed (the execution status of this line is deduced): p.lineTo(points[i] + QPointF(0, 0.001)); | - |
| 958 | } | 0 |
| 959 | | - |
| 960 | bool hadBrush = d->hasBrush; never executed (the execution status of this line is deduced): bool hadBrush = d->hasBrush; | - |
| 961 | d->hasBrush = false; never executed (the execution status of this line is deduced): d->hasBrush = false; | - |
| 962 | drawPath(p); never executed (the execution status of this line is deduced): drawPath(p); | - |
| 963 | d->hasBrush = hadBrush; never executed (the execution status of this line is deduced): d->hasBrush = hadBrush; | - |
| 964 | } | 0 |
| 965 | | - |
| 966 | void QPdfEngine::drawLines (const QLineF *lines, int lineCount) | - |
| 967 | { | - |
| 968 | if (!lines) | 0 |
| 969 | return; | 0 |
| 970 | | - |
| 971 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 972 | QPainterPath p; never executed (the execution status of this line is deduced): QPainterPath p; | - |
| 973 | for (int i=0; i!=lineCount;++i) { never evaluated: i!=lineCount | 0 |
| 974 | p.moveTo(lines[i].p1()); never executed (the execution status of this line is deduced): p.moveTo(lines[i].p1()); | - |
| 975 | p.lineTo(lines[i].p2()); never executed (the execution status of this line is deduced): p.lineTo(lines[i].p2()); | - |
| 976 | } | 0 |
| 977 | bool hadBrush = d->hasBrush; never executed (the execution status of this line is deduced): bool hadBrush = d->hasBrush; | - |
| 978 | d->hasBrush = false; never executed (the execution status of this line is deduced): d->hasBrush = false; | - |
| 979 | drawPath(p); never executed (the execution status of this line is deduced): drawPath(p); | - |
| 980 | d->hasBrush = hadBrush; never executed (the execution status of this line is deduced): d->hasBrush = hadBrush; | - |
| 981 | } | 0 |
| 982 | | - |
| 983 | void QPdfEngine::drawRects (const QRectF *rects, int rectCount) | - |
| 984 | { | - |
| 985 | if (!rects) partially evaluated: !rects| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 986 | return; | 0 |
| 987 | | - |
| 988 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 989 | | - |
| 990 | if (d->clipEnabled && d->allClipped) partially evaluated: d->clipEnabled| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: d->allClipped | 0-2 |
| 991 | return; | 0 |
| 992 | if (!d->hasPen && !d->hasBrush) partially evaluated: !d->hasPen| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !d->hasBrush | 0-2 |
| 993 | return; | 0 |
| 994 | | - |
| 995 | QBrush penBrush = d->pen.brush(); executed (the execution status of this line is deduced): QBrush penBrush = d->pen.brush(); | - |
| 996 | if (d->simplePen || !d->hasPen) { partially evaluated: d->simplePen| yes Evaluation Count:2 | no Evaluation Count:0 |
never evaluated: !d->hasPen | 0-2 |
| 997 | // draw strokes natively in this case for better output | - |
| 998 | if(!d->simplePen && !d->stroker.matrix.isIdentity()) partially evaluated: !d->simplePen| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !d->stroker.matrix.isIdentity() | 0-2 |
| 999 | *d->currentPage << "q\n" << QPdf::generateMatrix(d->stroker.matrix); never executed: *d->currentPage << "q\n" << QPdf::generateMatrix(d->stroker.matrix); | 0 |
| 1000 | for (int i = 0; i < rectCount; ++i) evaluated: i < rectCount| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 1001 | *d->currentPage << rects[i].x() << rects[i].y() << rects[i].width() << rects[i].height() << "re\n"; executed: *d->currentPage << rects[i].x() << rects[i].y() << rects[i].width() << rects[i].height() << "re\n";Execution Count:2 | 2 |
| 1002 | *d->currentPage << (d->hasPen ? (d->hasBrush ? "B\n" : "S\n") : "f\n"); executed (the execution status of this line is deduced): *d->currentPage << (d->hasPen ? (d->hasBrush ? "B\n" : "S\n") : "f\n"); | - |
| 1003 | if(!d->simplePen && !d->stroker.matrix.isIdentity()) partially evaluated: !d->simplePen| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !d->stroker.matrix.isIdentity() | 0-2 |
| 1004 | *d->currentPage << "Q\n"; never executed: *d->currentPage << "Q\n"; | 0 |
| 1005 | } else { executed: }Execution Count:2 | 2 |
| 1006 | QPainterPath p; never executed (the execution status of this line is deduced): QPainterPath p; | - |
| 1007 | for (int i=0; i!=rectCount; ++i) never evaluated: i!=rectCount | 0 |
| 1008 | p.addRect(rects[i]); never executed: p.addRect(rects[i]); | 0 |
| 1009 | drawPath(p); never executed (the execution status of this line is deduced): drawPath(p); | - |
| 1010 | } | 0 |
| 1011 | } | - |
| 1012 | | - |
| 1013 | void QPdfEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - |
| 1014 | { | - |
| 1015 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1016 | | - |
| 1017 | if (!points || !pointCount) never evaluated: !points never evaluated: !pointCount | 0 |
| 1018 | return; | 0 |
| 1019 | | - |
| 1020 | bool hb = d->hasBrush; never executed (the execution status of this line is deduced): bool hb = d->hasBrush; | - |
| 1021 | QPainterPath p; never executed (the execution status of this line is deduced): QPainterPath p; | - |
| 1022 | | - |
| 1023 | switch(mode) { | - |
| 1024 | case OddEvenMode: | - |
| 1025 | p.setFillRule(Qt::OddEvenFill); never executed (the execution status of this line is deduced): p.setFillRule(Qt::OddEvenFill); | - |
| 1026 | break; | 0 |
| 1027 | case ConvexMode: | - |
| 1028 | case WindingMode: | - |
| 1029 | p.setFillRule(Qt::WindingFill); never executed (the execution status of this line is deduced): p.setFillRule(Qt::WindingFill); | - |
| 1030 | break; | 0 |
| 1031 | case PolylineMode: | - |
| 1032 | d->hasBrush = false; never executed (the execution status of this line is deduced): d->hasBrush = false; | - |
| 1033 | break; | 0 |
| 1034 | default: | - |
| 1035 | break; | 0 |
| 1036 | } | - |
| 1037 | | - |
| 1038 | p.moveTo(points[0]); never executed (the execution status of this line is deduced): p.moveTo(points[0]); | - |
| 1039 | for (int i = 1; i < pointCount; ++i) never evaluated: i < pointCount | 0 |
| 1040 | p.lineTo(points[i]); never executed: p.lineTo(points[i]); | 0 |
| 1041 | | - |
| 1042 | if (mode != PolylineMode) never evaluated: mode != PolylineMode | 0 |
| 1043 | p.closeSubpath(); never executed: p.closeSubpath(); | 0 |
| 1044 | drawPath(p); never executed (the execution status of this line is deduced): drawPath(p); | - |
| 1045 | | - |
| 1046 | d->hasBrush = hb; never executed (the execution status of this line is deduced): d->hasBrush = hb; | - |
| 1047 | } | 0 |
| 1048 | | - |
| 1049 | void QPdfEngine::drawPath (const QPainterPath &p) | - |
| 1050 | { | - |
| 1051 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1052 | | - |
| 1053 | if (d->clipEnabled && d->allClipped) never evaluated: d->clipEnabled never evaluated: d->allClipped | 0 |
| 1054 | return; | 0 |
| 1055 | if (!d->hasPen && !d->hasBrush) never evaluated: !d->hasPen never evaluated: !d->hasBrush | 0 |
| 1056 | return; | 0 |
| 1057 | | - |
| 1058 | if (d->simplePen) { never evaluated: d->simplePen | 0 |
| 1059 | // draw strokes natively in this case for better output | - |
| 1060 | *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath); never executed (the execution status of this line is deduced): *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath); | - |
| 1061 | } else { | 0 |
| 1062 | if (d->hasBrush) never evaluated: d->hasBrush | 0 |
| 1063 | *d->currentPage << QPdf::generatePath(p, d->stroker.matrix, QPdf::FillPath); never executed: *d->currentPage << QPdf::generatePath(p, d->stroker.matrix, QPdf::FillPath); | 0 |
| 1064 | if (d->hasPen) { never evaluated: d->hasPen | 0 |
| 1065 | *d->currentPage << "q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "q\n"; | - |
| 1066 | QBrush b = d->brush; never executed (the execution status of this line is deduced): QBrush b = d->brush; | - |
| 1067 | d->brush = d->pen.brush(); never executed (the execution status of this line is deduced): d->brush = d->pen.brush(); | - |
| 1068 | setBrush(); never executed (the execution status of this line is deduced): setBrush(); | - |
| 1069 | d->stroker.strokePath(p); never executed (the execution status of this line is deduced): d->stroker.strokePath(p); | - |
| 1070 | *d->currentPage << "Q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1071 | d->brush = b; never executed (the execution status of this line is deduced): d->brush = b; | - |
| 1072 | } | 0 |
| 1073 | } | 0 |
| 1074 | } | - |
| 1075 | | - |
| 1076 | void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr) | - |
| 1077 | { | - |
| 1078 | if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull()) never evaluated: sr.isEmpty() never evaluated: rectangle.isEmpty() never evaluated: pixmap.isNull() | 0 |
| 1079 | return; | 0 |
| 1080 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1081 | | - |
| 1082 | QBrush b = d->brush; never executed (the execution status of this line is deduced): QBrush b = d->brush; | - |
| 1083 | | - |
| 1084 | QRect sourceRect = sr.toRect(); never executed (the execution status of this line is deduced): QRect sourceRect = sr.toRect(); | - |
| 1085 | QPixmap pm = sourceRect != pixmap.rect() ? pixmap.copy(sourceRect) : pixmap; never evaluated: sourceRect != pixmap.rect() | 0 |
| 1086 | QImage image = pm.toImage(); never executed (the execution status of this line is deduced): QImage image = pm.toImage(); | - |
| 1087 | bool bitmap = true; never executed (the execution status of this line is deduced): bool bitmap = true; | - |
| 1088 | const int object = d->addImage(image, &bitmap, pm.cacheKey()); never executed (the execution status of this line is deduced): const int object = d->addImage(image, &bitmap, pm.cacheKey()); | - |
| 1089 | if (object < 0) never evaluated: object < 0 | 0 |
| 1090 | return; | 0 |
| 1091 | | - |
| 1092 | *d->currentPage << "q\n/GSa gs\n"; never executed (the execution status of this line is deduced): *d->currentPage << "q\n/GSa gs\n"; | - |
| 1093 | *d->currentPage never executed (the execution status of this line is deduced): *d->currentPage | - |
| 1094 | << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), never executed (the execution status of this line is deduced): << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), | - |
| 1095 | rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); never executed (the execution status of this line is deduced): rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); | - |
| 1096 | if (bitmap) { | 0 |
| 1097 | // set current pen as d->brush | - |
| 1098 | d->brush = d->pen.brush(); never executed (the execution status of this line is deduced): d->brush = d->pen.brush(); | - |
| 1099 | } | 0 |
| 1100 | setBrush(); never executed (the execution status of this line is deduced): setBrush(); | - |
| 1101 | d->currentPage->streamImage(image.width(), image.height(), object); never executed (the execution status of this line is deduced): d->currentPage->streamImage(image.width(), image.height(), object); | - |
| 1102 | *d->currentPage << "Q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1103 | | - |
| 1104 | d->brush = b; never executed (the execution status of this line is deduced): d->brush = b; | - |
| 1105 | } | 0 |
| 1106 | | - |
| 1107 | void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags) | - |
| 1108 | { | - |
| 1109 | if (sr.isEmpty() || rectangle.isEmpty() || image.isNull()) never evaluated: sr.isEmpty() never evaluated: rectangle.isEmpty() never evaluated: image.isNull() | 0 |
| 1110 | return; | 0 |
| 1111 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1112 | | - |
| 1113 | QRect sourceRect = sr.toRect(); never executed (the execution status of this line is deduced): QRect sourceRect = sr.toRect(); | - |
| 1114 | QImage im = sourceRect != image.rect() ? image.copy(sourceRect) : image; never evaluated: sourceRect != image.rect() | 0 |
| 1115 | bool bitmap = true; never executed (the execution status of this line is deduced): bool bitmap = true; | - |
| 1116 | const int object = d->addImage(im, &bitmap, im.cacheKey()); never executed (the execution status of this line is deduced): const int object = d->addImage(im, &bitmap, im.cacheKey()); | - |
| 1117 | if (object < 0) never evaluated: object < 0 | 0 |
| 1118 | return; | 0 |
| 1119 | | - |
| 1120 | *d->currentPage << "q\n/GSa gs\n"; never executed (the execution status of this line is deduced): *d->currentPage << "q\n/GSa gs\n"; | - |
| 1121 | *d->currentPage never executed (the execution status of this line is deduced): *d->currentPage | - |
| 1122 | << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), never executed (the execution status of this line is deduced): << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(), | - |
| 1123 | rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); never executed (the execution status of this line is deduced): rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix)); | - |
| 1124 | setBrush(); never executed (the execution status of this line is deduced): setBrush(); | - |
| 1125 | d->currentPage->streamImage(im.width(), im.height(), object); never executed (the execution status of this line is deduced): d->currentPage->streamImage(im.width(), im.height(), object); | - |
| 1126 | *d->currentPage << "Q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1127 | } | 0 |
| 1128 | | - |
| 1129 | void QPdfEngine::drawTiledPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QPointF &point) | - |
| 1130 | { | - |
| 1131 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1132 | | - |
| 1133 | bool bitmap = (pixmap.depth() == 1); never executed (the execution status of this line is deduced): bool bitmap = (pixmap.depth() == 1); | - |
| 1134 | QBrush b = d->brush; never executed (the execution status of this line is deduced): QBrush b = d->brush; | - |
| 1135 | QPointF bo = d->brushOrigin; never executed (the execution status of this line is deduced): QPointF bo = d->brushOrigin; | - |
| 1136 | bool hp = d->hasPen; never executed (the execution status of this line is deduced): bool hp = d->hasPen; | - |
| 1137 | d->hasPen = false; never executed (the execution status of this line is deduced): d->hasPen = false; | - |
| 1138 | bool hb = d->hasBrush; never executed (the execution status of this line is deduced): bool hb = d->hasBrush; | - |
| 1139 | d->hasBrush = true; never executed (the execution status of this line is deduced): d->hasBrush = true; | - |
| 1140 | | - |
| 1141 | d->brush = QBrush(pixmap); never executed (the execution status of this line is deduced): d->brush = QBrush(pixmap); | - |
| 1142 | if (bitmap) | 0 |
| 1143 | // #### fix bitmap case where we have a brush pen | - |
| 1144 | d->brush.setColor(d->pen.color()); never executed: d->brush.setColor(d->pen.color()); | 0 |
| 1145 | | - |
| 1146 | d->brushOrigin = -point; never executed (the execution status of this line is deduced): d->brushOrigin = -point; | - |
| 1147 | *d->currentPage << "q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "q\n"; | - |
| 1148 | setBrush(); never executed (the execution status of this line is deduced): setBrush(); | - |
| 1149 | | - |
| 1150 | drawRects(&rectangle, 1); never executed (the execution status of this line is deduced): drawRects(&rectangle, 1); | - |
| 1151 | *d->currentPage << "Q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1152 | | - |
| 1153 | d->hasPen = hp; never executed (the execution status of this line is deduced): d->hasPen = hp; | - |
| 1154 | d->hasBrush = hb; never executed (the execution status of this line is deduced): d->hasBrush = hb; | - |
| 1155 | d->brush = b; never executed (the execution status of this line is deduced): d->brush = b; | - |
| 1156 | d->brushOrigin = bo; never executed (the execution status of this line is deduced): d->brushOrigin = bo; | - |
| 1157 | } | 0 |
| 1158 | | - |
| 1159 | void QPdfEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - |
| 1160 | { | - |
| 1161 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1162 | | - |
| 1163 | if (!d->hasPen || (d->clipEnabled && d->allClipped)) never evaluated: !d->hasPen never evaluated: d->clipEnabled never evaluated: d->allClipped | 0 |
| 1164 | return; | 0 |
| 1165 | | - |
| 1166 | if (d->stroker.matrix.type() >= QTransform::TxProject) { never evaluated: d->stroker.matrix.type() >= QTransform::TxProject | 0 |
| 1167 | QPaintEngine::drawTextItem(p, textItem); never executed (the execution status of this line is deduced): QPaintEngine::drawTextItem(p, textItem); | - |
| 1168 | return; | 0 |
| 1169 | } | - |
| 1170 | | - |
| 1171 | *d->currentPage << "q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "q\n"; | - |
| 1172 | if(!d->simplePen) never evaluated: !d->simplePen | 0 |
| 1173 | *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); never executed: *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); | 0 |
| 1174 | | - |
| 1175 | bool hp = d->hasPen; never executed (the execution status of this line is deduced): bool hp = d->hasPen; | - |
| 1176 | d->hasPen = false; never executed (the execution status of this line is deduced): d->hasPen = false; | - |
| 1177 | QBrush b = d->brush; never executed (the execution status of this line is deduced): QBrush b = d->brush; | - |
| 1178 | d->brush = d->pen.brush(); never executed (the execution status of this line is deduced): d->brush = d->pen.brush(); | - |
| 1179 | setBrush(); never executed (the execution status of this line is deduced): setBrush(); | - |
| 1180 | | - |
| 1181 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); never executed (the execution status of this line is deduced): const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - |
| 1182 | Q_ASSERT(ti.fontEngine->type() != QFontEngine::Multi); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 1183 | d->drawTextItem(p, ti); never executed (the execution status of this line is deduced): d->drawTextItem(p, ti); | - |
| 1184 | d->hasPen = hp; never executed (the execution status of this line is deduced): d->hasPen = hp; | - |
| 1185 | d->brush = b; never executed (the execution status of this line is deduced): d->brush = b; | - |
| 1186 | *d->currentPage << "Q\n"; never executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1187 | } | 0 |
| 1188 | | - |
| 1189 | | - |
| 1190 | void QPdfEngine::updateState(const QPaintEngineState &state) | - |
| 1191 | { | - |
| 1192 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1193 | | - |
| 1194 | QPaintEngine::DirtyFlags flags = state.state(); executed (the execution status of this line is deduced): QPaintEngine::DirtyFlags flags = state.state(); | - |
| 1195 | | - |
| 1196 | if (flags & DirtyTransform) partially evaluated: flags & DirtyTransform| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1197 | d->stroker.matrix = state.transform(); never executed: d->stroker.matrix = state.transform(); | 0 |
| 1198 | | - |
| 1199 | if (flags & DirtyPen) { partially evaluated: flags & DirtyPen| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1200 | d->pen = state.pen(); executed (the execution status of this line is deduced): d->pen = state.pen(); | - |
| 1201 | d->hasPen = d->pen.style() != Qt::NoPen; executed (the execution status of this line is deduced): d->hasPen = d->pen.style() != Qt::NoPen; | - |
| 1202 | d->stroker.setPen(d->pen, state.renderHints()); executed (the execution status of this line is deduced): d->stroker.setPen(d->pen, state.renderHints()); | - |
| 1203 | QBrush penBrush = d->pen.brush(); executed (the execution status of this line is deduced): QBrush penBrush = d->pen.brush(); | - |
| 1204 | bool oldSimple = d->simplePen; executed (the execution status of this line is deduced): bool oldSimple = d->simplePen; | - |
| 1205 | d->simplePen = (d->hasPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque()); partially evaluated: d->hasPen| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: (penBrush.style() == Qt::SolidPattern)| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: penBrush.isOpaque()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1206 | if (oldSimple != d->simplePen) partially evaluated: oldSimple != d->simplePen| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1207 | flags |= DirtyTransform; executed: flags |= DirtyTransform;Execution Count:2 | 2 |
| 1208 | } else if (flags & DirtyHints) { executed: }Execution Count:2 never evaluated: flags & DirtyHints | 0-2 |
| 1209 | d->stroker.setPen(d->pen, state.renderHints()); never executed (the execution status of this line is deduced): d->stroker.setPen(d->pen, state.renderHints()); | - |
| 1210 | } | 0 |
| 1211 | if (flags & DirtyBrush) { partially evaluated: flags & DirtyBrush| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1212 | d->brush = state.brush(); never executed (the execution status of this line is deduced): d->brush = state.brush(); | - |
| 1213 | if (d->brush.color().alpha() == 0 && d->brush.style() == Qt::SolidPattern) never evaluated: d->brush.color().alpha() == 0 never evaluated: d->brush.style() == Qt::SolidPattern | 0 |
| 1214 | d->brush.setStyle(Qt::NoBrush); never executed: d->brush.setStyle(Qt::NoBrush); | 0 |
| 1215 | d->hasBrush = d->brush.style() != Qt::NoBrush; never executed (the execution status of this line is deduced): d->hasBrush = d->brush.style() != Qt::NoBrush; | - |
| 1216 | } | 0 |
| 1217 | if (flags & DirtyBrushOrigin) { partially evaluated: flags & DirtyBrushOrigin| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1218 | d->brushOrigin = state.brushOrigin(); never executed (the execution status of this line is deduced): d->brushOrigin = state.brushOrigin(); | - |
| 1219 | flags |= DirtyBrush; never executed (the execution status of this line is deduced): flags |= DirtyBrush; | - |
| 1220 | } | 0 |
| 1221 | if (flags & DirtyOpacity) partially evaluated: flags & DirtyOpacity| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1222 | d->opacity = state.opacity(); never executed: d->opacity = state.opacity(); | 0 |
| 1223 | | - |
| 1224 | bool ce = d->clipEnabled; executed (the execution status of this line is deduced): bool ce = d->clipEnabled; | - |
| 1225 | if (flags & DirtyClipPath) { partially evaluated: flags & DirtyClipPath| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1226 | d->clipEnabled = true; never executed (the execution status of this line is deduced): d->clipEnabled = true; | - |
| 1227 | updateClipPath(state.clipPath(), state.clipOperation()); never executed (the execution status of this line is deduced): updateClipPath(state.clipPath(), state.clipOperation()); | - |
| 1228 | } else if (flags & DirtyClipRegion) { never executed: } partially evaluated: flags & DirtyClipRegion| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1229 | d->clipEnabled = true; never executed (the execution status of this line is deduced): d->clipEnabled = true; | - |
| 1230 | QPainterPath path; never executed (the execution status of this line is deduced): QPainterPath path; | - |
| 1231 | QVector<QRect> rects = state.clipRegion().rects(); never executed (the execution status of this line is deduced): QVector<QRect> rects = state.clipRegion().rects(); | - |
| 1232 | for (int i = 0; i < rects.size(); ++i) never evaluated: i < rects.size() | 0 |
| 1233 | path.addRect(rects.at(i)); never executed: path.addRect(rects.at(i)); | 0 |
| 1234 | updateClipPath(path, state.clipOperation()); never executed (the execution status of this line is deduced): updateClipPath(path, state.clipOperation()); | - |
| 1235 | flags |= DirtyClipPath; never executed (the execution status of this line is deduced): flags |= DirtyClipPath; | - |
| 1236 | } else if (flags & DirtyClipEnabled) { never executed: } partially evaluated: flags & DirtyClipEnabled| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1237 | d->clipEnabled = state.isClipEnabled(); never executed (the execution status of this line is deduced): d->clipEnabled = state.isClipEnabled(); | - |
| 1238 | } | 0 |
| 1239 | | - |
| 1240 | if (ce != d->clipEnabled) partially evaluated: ce != d->clipEnabled| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1241 | flags |= DirtyClipPath; never executed: flags |= DirtyClipPath; | 0 |
| 1242 | else if (!d->clipEnabled) partially evaluated: !d->clipEnabled| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1243 | flags &= ~DirtyClipPath; executed: flags &= ~DirtyClipPath;Execution Count:2 | 2 |
| 1244 | | - |
| 1245 | setupGraphicsState(flags); executed (the execution status of this line is deduced): setupGraphicsState(flags); | - |
| 1246 | } executed: }Execution Count:2 | 2 |
| 1247 | | - |
| 1248 | void QPdfEngine::setupGraphicsState(QPaintEngine::DirtyFlags flags) | - |
| 1249 | { | - |
| 1250 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1251 | if (flags & DirtyClipPath) evaluated: flags & DirtyClipPath| yes Evaluation Count:20 | yes Evaluation Count:2 |
| 2-20 |
| 1252 | flags |= DirtyTransform|DirtyPen|DirtyBrush; executed: flags |= DirtyTransform|DirtyPen|DirtyBrush;Execution Count:20 | 20 |
| 1253 | | - |
| 1254 | if (flags & DirtyTransform) { partially evaluated: flags & DirtyTransform| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 1255 | *d->currentPage << "Q\n"; executed (the execution status of this line is deduced): *d->currentPage << "Q\n"; | - |
| 1256 | flags |= DirtyPen|DirtyBrush; executed (the execution status of this line is deduced): flags |= DirtyPen|DirtyBrush; | - |
| 1257 | } executed: }Execution Count:22 | 22 |
| 1258 | | - |
| 1259 | if (flags & DirtyClipPath) { evaluated: flags & DirtyClipPath| yes Evaluation Count:20 | yes Evaluation Count:2 |
| 2-20 |
| 1260 | *d->currentPage << "Q q\n"; executed (the execution status of this line is deduced): *d->currentPage << "Q q\n"; | - |
| 1261 | | - |
| 1262 | d->allClipped = false; executed (the execution status of this line is deduced): d->allClipped = false; | - |
| 1263 | if (d->clipEnabled && !d->clips.isEmpty()) { partially evaluated: d->clipEnabled| no Evaluation Count:0 | yes Evaluation Count:20 |
never evaluated: !d->clips.isEmpty() | 0-20 |
| 1264 | for (int i = 0; i < d->clips.size(); ++i) { never evaluated: i < d->clips.size() | 0 |
| 1265 | if (d->clips.at(i).isEmpty()) { never evaluated: d->clips.at(i).isEmpty() | 0 |
| 1266 | d->allClipped = true; never executed (the execution status of this line is deduced): d->allClipped = true; | - |
| 1267 | break; | 0 |
| 1268 | } | - |
| 1269 | } | 0 |
| 1270 | if (!d->allClipped) { never evaluated: !d->allClipped | 0 |
| 1271 | for (int i = 0; i < d->clips.size(); ++i) { never evaluated: i < d->clips.size() | 0 |
| 1272 | *d->currentPage << QPdf::generatePath(d->clips.at(i), QTransform(), QPdf::ClipPath); never executed (the execution status of this line is deduced): *d->currentPage << QPdf::generatePath(d->clips.at(i), QTransform(), QPdf::ClipPath); | - |
| 1273 | } | 0 |
| 1274 | } | 0 |
| 1275 | } | 0 |
| 1276 | } executed: }Execution Count:20 | 20 |
| 1277 | | - |
| 1278 | if (flags & DirtyTransform) { partially evaluated: flags & DirtyTransform| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 1279 | *d->currentPage << "q\n"; executed (the execution status of this line is deduced): *d->currentPage << "q\n"; | - |
| 1280 | if (d->simplePen && !d->stroker.matrix.isIdentity()) evaluated: d->simplePen| yes Evaluation Count:2 | yes Evaluation Count:20 |
partially evaluated: !d->stroker.matrix.isIdentity()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-20 |
| 1281 | *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); never executed: *d->currentPage << QPdf::generateMatrix(d->stroker.matrix); | 0 |
| 1282 | } executed: }Execution Count:22 | 22 |
| 1283 | if (flags & DirtyBrush) partially evaluated: flags & DirtyBrush| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 1284 | setBrush(); executed: setBrush();Execution Count:22 | 22 |
| 1285 | if (d->simplePen && (flags & DirtyPen)) evaluated: d->simplePen| yes Evaluation Count:2 | yes Evaluation Count:20 |
partially evaluated: (flags & DirtyPen)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-20 |
| 1286 | setPen(); executed: setPen();Execution Count:2 | 2 |
| 1287 | } executed: }Execution Count:22 | 22 |
| 1288 | | - |
| 1289 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - |
| 1290 | | - |
| 1291 | void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) | - |
| 1292 | { | - |
| 1293 | Q_D(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1294 | QPainterPath path = d->stroker.matrix.map(p); never executed (the execution status of this line is deduced): QPainterPath path = d->stroker.matrix.map(p); | - |
| 1295 | //qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op; | - |
| 1296 | | - |
| 1297 | if (op == Qt::NoClip) { never evaluated: op == Qt::NoClip | 0 |
| 1298 | d->clipEnabled = false; never executed (the execution status of this line is deduced): d->clipEnabled = false; | - |
| 1299 | d->clips.clear(); never executed (the execution status of this line is deduced): d->clips.clear(); | - |
| 1300 | } else if (op == Qt::ReplaceClip) { never executed: } never evaluated: op == Qt::ReplaceClip | 0 |
| 1301 | d->clips.clear(); never executed (the execution status of this line is deduced): d->clips.clear(); | - |
| 1302 | d->clips.append(path); never executed (the execution status of this line is deduced): d->clips.append(path); | - |
| 1303 | } else if (op == Qt::IntersectClip) { never executed: } never evaluated: op == Qt::IntersectClip | 0 |
| 1304 | d->clips.append(path); never executed (the execution status of this line is deduced): d->clips.append(path); | - |
| 1305 | } else { // UniteClip | 0 |
| 1306 | // ask the painter for the current clipping path. that's the easiest solution | - |
| 1307 | path = painter()->clipPath(); never executed (the execution status of this line is deduced): path = painter()->clipPath(); | - |
| 1308 | path = d->stroker.matrix.map(path); never executed (the execution status of this line is deduced): path = d->stroker.matrix.map(path); | - |
| 1309 | d->clips.clear(); never executed (the execution status of this line is deduced): d->clips.clear(); | - |
| 1310 | d->clips.append(path); never executed (the execution status of this line is deduced): d->clips.append(path); | - |
| 1311 | } | 0 |
| 1312 | } | - |
| 1313 | | - |
| 1314 | void QPdfEngine::setPen() | - |
| 1315 | { | - |
| 1316 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1317 | if (d->pen.style() == Qt::NoPen) partially evaluated: d->pen.style() == Qt::NoPen| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1318 | return; | 0 |
| 1319 | QBrush b = d->pen.brush(); executed (the execution status of this line is deduced): QBrush b = d->pen.brush(); | - |
| 1320 | Q_ASSERT(b.style() == Qt::SolidPattern && b.isOpaque()); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1321 | | - |
| 1322 | QColor rgba = b.color(); executed (the execution status of this line is deduced): QColor rgba = b.color(); | - |
| 1323 | if (d->grayscale) { partially evaluated: d->grayscale| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1324 | qreal gray = qGray(rgba.rgba())/255.; never executed (the execution status of this line is deduced): qreal gray = qGray(rgba.rgba())/255.; | - |
| 1325 | *d->currentPage << gray << gray << gray; never executed (the execution status of this line is deduced): *d->currentPage << gray << gray << gray; | - |
| 1326 | } else { | 0 |
| 1327 | *d->currentPage << rgba.redF() executed (the execution status of this line is deduced): *d->currentPage << rgba.redF() | - |
| 1328 | << rgba.greenF() executed (the execution status of this line is deduced): << rgba.greenF() | - |
| 1329 | << rgba.blueF(); executed (the execution status of this line is deduced): << rgba.blueF(); | - |
| 1330 | } executed: }Execution Count:2 | 2 |
| 1331 | *d->currentPage << "SCN\n"; executed (the execution status of this line is deduced): *d->currentPage << "SCN\n"; | - |
| 1332 | | - |
| 1333 | *d->currentPage << d->pen.widthF() << "w "; executed (the execution status of this line is deduced): *d->currentPage << d->pen.widthF() << "w "; | - |
| 1334 | | - |
| 1335 | int pdfCapStyle = 0; executed (the execution status of this line is deduced): int pdfCapStyle = 0; | - |
| 1336 | switch(d->pen.capStyle()) { | - |
| 1337 | case Qt::FlatCap: | - |
| 1338 | pdfCapStyle = 0; never executed (the execution status of this line is deduced): pdfCapStyle = 0; | - |
| 1339 | break; | 0 |
| 1340 | case Qt::SquareCap: | - |
| 1341 | pdfCapStyle = 2; executed (the execution status of this line is deduced): pdfCapStyle = 2; | - |
| 1342 | break; executed: break;Execution Count:2 | 2 |
| 1343 | case Qt::RoundCap: | - |
| 1344 | pdfCapStyle = 1; never executed (the execution status of this line is deduced): pdfCapStyle = 1; | - |
| 1345 | break; | 0 |
| 1346 | default: | - |
| 1347 | break; | 0 |
| 1348 | } | - |
| 1349 | *d->currentPage << pdfCapStyle << "J "; executed (the execution status of this line is deduced): *d->currentPage << pdfCapStyle << "J "; | - |
| 1350 | | - |
| 1351 | int pdfJoinStyle = 0; executed (the execution status of this line is deduced): int pdfJoinStyle = 0; | - |
| 1352 | switch(d->pen.joinStyle()) { | - |
| 1353 | case Qt::MiterJoin: | - |
| 1354 | pdfJoinStyle = 0; never executed (the execution status of this line is deduced): pdfJoinStyle = 0; | - |
| 1355 | break; | 0 |
| 1356 | case Qt::BevelJoin: | - |
| 1357 | pdfJoinStyle = 2; executed (the execution status of this line is deduced): pdfJoinStyle = 2; | - |
| 1358 | break; executed: break;Execution Count:2 | 2 |
| 1359 | case Qt::RoundJoin: | - |
| 1360 | pdfJoinStyle = 1; never executed (the execution status of this line is deduced): pdfJoinStyle = 1; | - |
| 1361 | break; | 0 |
| 1362 | default: | - |
| 1363 | break; | 0 |
| 1364 | } | - |
| 1365 | *d->currentPage << pdfJoinStyle << "j "; executed (the execution status of this line is deduced): *d->currentPage << pdfJoinStyle << "j "; | - |
| 1366 | | - |
| 1367 | *d->currentPage << QPdf::generateDashes(d->pen) << " 0 d\n"; executed (the execution status of this line is deduced): *d->currentPage << QPdf::generateDashes(d->pen) << " 0 d\n"; | - |
| 1368 | } executed: }Execution Count:2 | 2 |
| 1369 | | - |
| 1370 | | - |
| 1371 | void QPdfEngine::setBrush() | - |
| 1372 | { | - |
| 1373 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1374 | Qt::BrushStyle style = d->brush.style(); executed (the execution status of this line is deduced): Qt::BrushStyle style = d->brush.style(); | - |
| 1375 | if (style == Qt::NoBrush) partially evaluated: style == Qt::NoBrush| yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
| 1376 | return; executed: return;Execution Count:22 | 22 |
| 1377 | | - |
| 1378 | bool specifyColor; never executed (the execution status of this line is deduced): bool specifyColor; | - |
| 1379 | int gStateObject = 0; never executed (the execution status of this line is deduced): int gStateObject = 0; | - |
| 1380 | int patternObject = d->addBrushPattern(d->stroker.matrix, &specifyColor, &gStateObject); never executed (the execution status of this line is deduced): int patternObject = d->addBrushPattern(d->stroker.matrix, &specifyColor, &gStateObject); | - |
| 1381 | | - |
| 1382 | *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs "); never executed (the execution status of this line is deduced): *d->currentPage << (patternObject ? "/PCSp cs " : "/CSp cs "); | - |
| 1383 | if (specifyColor) { never evaluated: specifyColor | 0 |
| 1384 | QColor rgba = d->brush.color(); never executed (the execution status of this line is deduced): QColor rgba = d->brush.color(); | - |
| 1385 | if (d->grayscale) { never evaluated: d->grayscale | 0 |
| 1386 | qreal gray = qGray(rgba.rgba())/255.; never executed (the execution status of this line is deduced): qreal gray = qGray(rgba.rgba())/255.; | - |
| 1387 | *d->currentPage << gray << gray << gray; never executed (the execution status of this line is deduced): *d->currentPage << gray << gray << gray; | - |
| 1388 | } else { | 0 |
| 1389 | *d->currentPage << rgba.redF() never executed (the execution status of this line is deduced): *d->currentPage << rgba.redF() | - |
| 1390 | << rgba.greenF() never executed (the execution status of this line is deduced): << rgba.greenF() | - |
| 1391 | << rgba.blueF(); never executed (the execution status of this line is deduced): << rgba.blueF(); | - |
| 1392 | } | 0 |
| 1393 | } | - |
| 1394 | if (patternObject) never evaluated: patternObject | 0 |
| 1395 | *d->currentPage << "/Pat" << patternObject; never executed: *d->currentPage << "/Pat" << patternObject; | 0 |
| 1396 | *d->currentPage << "scn\n"; never executed (the execution status of this line is deduced): *d->currentPage << "scn\n"; | - |
| 1397 | | - |
| 1398 | if (gStateObject) never evaluated: gStateObject | 0 |
| 1399 | *d->currentPage << "/GState" << gStateObject << "gs\n"; never executed: *d->currentPage << "/GState" << gStateObject << "gs\n"; | 0 |
| 1400 | else | - |
| 1401 | *d->currentPage << "/GSa gs\n"; never executed: *d->currentPage << "/GSa gs\n"; | 0 |
| 1402 | } | - |
| 1403 | | - |
| 1404 | | - |
| 1405 | bool QPdfEngine::newPage() | - |
| 1406 | { | - |
| 1407 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1408 | if (!isActive()) partially evaluated: !isActive()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1409 | return false; never executed: return false; | 0 |
| 1410 | d->newPage(); executed (the execution status of this line is deduced): d->newPage(); | - |
| 1411 | | - |
| 1412 | setupGraphicsState(DirtyBrush|DirtyPen|DirtyClipPath); executed (the execution status of this line is deduced): setupGraphicsState(DirtyBrush|DirtyPen|DirtyClipPath); | - |
| 1413 | QFile *outfile = qobject_cast<QFile*> (d->outDevice); executed (the execution status of this line is deduced): QFile *outfile = qobject_cast<QFile*> (d->outDevice); | - |
| 1414 | if (outfile && outfile->error() != QFile::NoError) partially evaluated: outfile| yes Evaluation Count:20 | no Evaluation Count:0 |
partially evaluated: outfile->error() != QFile::NoError| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1415 | return false; never executed: return false; | 0 |
| 1416 | return true; executed: return true;Execution Count:20 | 20 |
| 1417 | } | - |
| 1418 | | - |
| 1419 | QPaintEngine::Type QPdfEngine::type() const | - |
| 1420 | { | - |
| 1421 | return QPaintEngine::Pdf; executed: return QPaintEngine::Pdf;Execution Count:37 | 37 |
| 1422 | } | - |
| 1423 | | - |
| 1424 | | - |
| 1425 | | - |
| 1426 | int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const | - |
| 1427 | { | - |
| 1428 | Q_D(const QPdfEngine); executed (the execution status of this line is deduced): const QPdfEnginePrivate * const d = d_func(); | - |
| 1429 | int val; executed (the execution status of this line is deduced): int val; | - |
| 1430 | QRect r = d->pageRect(); executed (the execution status of this line is deduced): QRect r = d->pageRect(); | - |
| 1431 | switch (metricType) { | - |
| 1432 | case QPaintDevice::PdmWidth: | - |
| 1433 | val = r.width(); executed (the execution status of this line is deduced): val = r.width(); | - |
| 1434 | break; executed: break;Execution Count:20 | 20 |
| 1435 | case QPaintDevice::PdmHeight: | - |
| 1436 | val = r.height(); executed (the execution status of this line is deduced): val = r.height(); | - |
| 1437 | break; executed: break;Execution Count:20 | 20 |
| 1438 | case QPaintDevice::PdmDpiX: | - |
| 1439 | case QPaintDevice::PdmDpiY: | - |
| 1440 | val = d->resolution; executed (the execution status of this line is deduced): val = d->resolution; | - |
| 1441 | break; executed: break;Execution Count:74 | 74 |
| 1442 | case QPaintDevice::PdmPhysicalDpiX: | - |
| 1443 | case QPaintDevice::PdmPhysicalDpiY: | - |
| 1444 | val = 1200; never executed (the execution status of this line is deduced): val = 1200; | - |
| 1445 | break; | 0 |
| 1446 | case QPaintDevice::PdmWidthMM: | - |
| 1447 | val = qRound(r.width()*25.4/d->resolution); executed (the execution status of this line is deduced): val = qRound(r.width()*25.4/d->resolution); | - |
| 1448 | break; executed: break;Execution Count:18 | 18 |
| 1449 | case QPaintDevice::PdmHeightMM: | - |
| 1450 | val = qRound(r.height()*25.4/d->resolution); executed (the execution status of this line is deduced): val = qRound(r.height()*25.4/d->resolution); | - |
| 1451 | break; executed: break;Execution Count:18 | 18 |
| 1452 | case QPaintDevice::PdmNumColors: | - |
| 1453 | val = INT_MAX; never executed (the execution status of this line is deduced): val = 2147483647; | - |
| 1454 | break; | 0 |
| 1455 | case QPaintDevice::PdmDepth: | - |
| 1456 | val = 32; never executed (the execution status of this line is deduced): val = 32; | - |
| 1457 | break; | 0 |
| 1458 | default: | - |
| 1459 | qWarning("QPdfWriter::metric: Invalid metric command"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 1459, __PRETTY_FUNCTION__).warning("QPdfWriter::metric: Invalid metric command"); | - |
| 1460 | return 0; never executed: return 0; | 0 |
| 1461 | } | - |
| 1462 | return val; executed: return val;Execution Count:150 | 150 |
| 1463 | } | - |
| 1464 | | - |
| 1465 | #define Q_MM(n) int((n * 720 + 127) / 254) | - |
| 1466 | | - |
| 1467 | QPdfEnginePrivate::QPdfEnginePrivate() | - |
| 1468 | : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), | - |
| 1469 | outDevice(0), ownsDevice(false), | - |
| 1470 | fullPage(false), embedFonts(true), | - |
| 1471 | landscape(false), | - |
| 1472 | grayscale(false), | - |
| 1473 | paperSize(Q_MM(210), Q_MM(297)), // A4 | - |
| 1474 | leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm | - |
| 1475 | { | - |
| 1476 | resolution = 1200; executed (the execution status of this line is deduced): resolution = 1200; | - |
| 1477 | postscript = false; executed (the execution status of this line is deduced): postscript = false; | - |
| 1478 | currentObject = 1; executed (the execution status of this line is deduced): currentObject = 1; | - |
| 1479 | currentPage = 0; executed (the execution status of this line is deduced): currentPage = 0; | - |
| 1480 | stroker.stream = 0; executed (the execution status of this line is deduced): stroker.stream = 0; | - |
| 1481 | | - |
| 1482 | streampos = 0; executed (the execution status of this line is deduced): streampos = 0; | - |
| 1483 | | - |
| 1484 | stream = new QDataStream; executed (the execution status of this line is deduced): stream = new QDataStream; | - |
| 1485 | } executed: }Execution Count:234 | 234 |
| 1486 | | - |
| 1487 | bool QPdfEngine::begin(QPaintDevice *pdev) | - |
| 1488 | { | - |
| 1489 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1490 | d->pdev = pdev; executed (the execution status of this line is deduced): d->pdev = pdev; | - |
| 1491 | | - |
| 1492 | if (!d->outDevice) { partially evaluated: !d->outDevice| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1493 | if (!d->outputFileName.isEmpty()) { never evaluated: !d->outputFileName.isEmpty() | 0 |
| 1494 | QFile *file = new QFile(d->outputFileName); never executed (the execution status of this line is deduced): QFile *file = new QFile(d->outputFileName); | - |
| 1495 | if (!file->open(QFile::WriteOnly|QFile::Truncate)) { never evaluated: !file->open(QFile::WriteOnly|QFile::Truncate) | 0 |
| 1496 | delete file; never executed (the execution status of this line is deduced): delete file; | - |
| 1497 | return false; never executed: return false; | 0 |
| 1498 | } | - |
| 1499 | d->outDevice = file; never executed (the execution status of this line is deduced): d->outDevice = file; | - |
| 1500 | } else { | 0 |
| 1501 | return false; never executed: return false; | 0 |
| 1502 | } | - |
| 1503 | d->ownsDevice = true; never executed (the execution status of this line is deduced): d->ownsDevice = true; | - |
| 1504 | } | 0 |
| 1505 | | - |
| 1506 | d->postscript = false; executed (the execution status of this line is deduced): d->postscript = false; | - |
| 1507 | d->currentObject = 1; executed (the execution status of this line is deduced): d->currentObject = 1; | - |
| 1508 | | - |
| 1509 | d->currentPage = new QPdfPage; executed (the execution status of this line is deduced): d->currentPage = new QPdfPage; | - |
| 1510 | d->stroker.stream = d->currentPage; executed (the execution status of this line is deduced): d->stroker.stream = d->currentPage; | - |
| 1511 | d->opacity = 1.0; executed (the execution status of this line is deduced): d->opacity = 1.0; | - |
| 1512 | | - |
| 1513 | d->stream->setDevice(d->outDevice); executed (the execution status of this line is deduced): d->stream->setDevice(d->outDevice); | - |
| 1514 | | - |
| 1515 | d->streampos = 0; executed (the execution status of this line is deduced): d->streampos = 0; | - |
| 1516 | d->hasPen = true; executed (the execution status of this line is deduced): d->hasPen = true; | - |
| 1517 | d->hasBrush = false; executed (the execution status of this line is deduced): d->hasBrush = false; | - |
| 1518 | d->clipEnabled = false; executed (the execution status of this line is deduced): d->clipEnabled = false; | - |
| 1519 | d->allClipped = false; executed (the execution status of this line is deduced): d->allClipped = false; | - |
| 1520 | | - |
| 1521 | d->xrefPositions.clear(); executed (the execution status of this line is deduced): d->xrefPositions.clear(); | - |
| 1522 | d->pageRoot = 0; executed (the execution status of this line is deduced): d->pageRoot = 0; | - |
| 1523 | d->catalog = 0; executed (the execution status of this line is deduced): d->catalog = 0; | - |
| 1524 | d->info = 0; executed (the execution status of this line is deduced): d->info = 0; | - |
| 1525 | d->graphicsState = 0; executed (the execution status of this line is deduced): d->graphicsState = 0; | - |
| 1526 | d->patternColorSpace = 0; executed (the execution status of this line is deduced): d->patternColorSpace = 0; | - |
| 1527 | d->simplePen = false; executed (the execution status of this line is deduced): d->simplePen = false; | - |
| 1528 | | - |
| 1529 | d->pages.clear(); executed (the execution status of this line is deduced): d->pages.clear(); | - |
| 1530 | d->imageCache.clear(); executed (the execution status of this line is deduced): d->imageCache.clear(); | - |
| 1531 | d->alphaCache.clear(); executed (the execution status of this line is deduced): d->alphaCache.clear(); | - |
| 1532 | | - |
| 1533 | setActive(true); executed (the execution status of this line is deduced): setActive(true); | - |
| 1534 | d->writeHeader(); executed (the execution status of this line is deduced): d->writeHeader(); | - |
| 1535 | newPage(); executed (the execution status of this line is deduced): newPage(); | - |
| 1536 | | - |
| 1537 | return true; executed: return true;Execution Count:20 | 20 |
| 1538 | } | - |
| 1539 | | - |
| 1540 | bool QPdfEngine::end() | - |
| 1541 | { | - |
| 1542 | Q_D(QPdfEngine); executed (the execution status of this line is deduced): QPdfEnginePrivate * const d = d_func(); | - |
| 1543 | d->writeTail(); executed (the execution status of this line is deduced): d->writeTail(); | - |
| 1544 | | - |
| 1545 | d->stream->unsetDevice(); executed (the execution status of this line is deduced): d->stream->unsetDevice(); | - |
| 1546 | | - |
| 1547 | qDeleteAll(d->fonts); executed (the execution status of this line is deduced): qDeleteAll(d->fonts); | - |
| 1548 | d->fonts.clear(); executed (the execution status of this line is deduced): d->fonts.clear(); | - |
| 1549 | delete d->currentPage; executed (the execution status of this line is deduced): delete d->currentPage; | - |
| 1550 | d->currentPage = 0; executed (the execution status of this line is deduced): d->currentPage = 0; | - |
| 1551 | | - |
| 1552 | if (d->outDevice && d->ownsDevice) { partially evaluated: d->outDevice| yes Evaluation Count:20 | no Evaluation Count:0 |
partially evaluated: d->ownsDevice| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1553 | d->outDevice->close(); never executed (the execution status of this line is deduced): d->outDevice->close(); | - |
| 1554 | delete d->outDevice; never executed (the execution status of this line is deduced): delete d->outDevice; | - |
| 1555 | d->outDevice = 0; never executed (the execution status of this line is deduced): d->outDevice = 0; | - |
| 1556 | } | 0 |
| 1557 | | - |
| 1558 | setActive(false); executed (the execution status of this line is deduced): setActive(false); | - |
| 1559 | return true; executed: return true;Execution Count:20 | 20 |
| 1560 | } | - |
| 1561 | | - |
| 1562 | QPdfEnginePrivate::~QPdfEnginePrivate() | - |
| 1563 | { | - |
| 1564 | qDeleteAll(fonts); executed (the execution status of this line is deduced): qDeleteAll(fonts); | - |
| 1565 | delete currentPage; executed (the execution status of this line is deduced): delete currentPage; | - |
| 1566 | delete stream; executed (the execution status of this line is deduced): delete stream; | - |
| 1567 | } executed: }Execution Count:234 | 234 |
| 1568 | | - |
| 1569 | QRect QPdfEnginePrivate::paperRect() const | - |
| 1570 | { | - |
| 1571 | int w = qRound(paperSize.width()*resolution/72.); executed (the execution status of this line is deduced): int w = qRound(paperSize.width()*resolution/72.); | - |
| 1572 | int h = qRound(paperSize.height()*resolution/72.); executed (the execution status of this line is deduced): int h = qRound(paperSize.height()*resolution/72.); | - |
| 1573 | | - |
| 1574 | if (!landscape) evaluated: !landscape| yes Evaluation Count:239 | yes Evaluation Count:131 |
| 131-239 |
| 1575 | return QRect(0, 0, w, h); executed: return QRect(0, 0, w, h);Execution Count:239 | 239 |
| 1576 | else | - |
| 1577 | return QRect(0, 0, h, w); executed: return QRect(0, 0, h, w);Execution Count:131 | 131 |
| 1578 | } | - |
| 1579 | | - |
| 1580 | QRect QPdfEnginePrivate::pageRect() const | - |
| 1581 | { | - |
| 1582 | QRect r = paperRect(); executed (the execution status of this line is deduced): QRect r = paperRect(); | - |
| 1583 | | - |
| 1584 | if(!fullPage) evaluated: !fullPage| yes Evaluation Count:96 | yes Evaluation Count:96 |
| 96 |
| 1585 | r.adjust(qRound(leftMargin*(resolution/72.)), executed: r.adjust(qRound(leftMargin*(resolution/72.)), qRound(topMargin*(resolution/72.)), -qRound(rightMargin*(resolution/72.)), -qRound(bottomMargin*(resolution/72.)));Execution Count:96 | 96 |
| 1586 | qRound(topMargin*(resolution/72.)), executed: r.adjust(qRound(leftMargin*(resolution/72.)), qRound(topMargin*(resolution/72.)), -qRound(rightMargin*(resolution/72.)), -qRound(bottomMargin*(resolution/72.)));Execution Count:96 | 96 |
| 1587 | -qRound(rightMargin*(resolution/72.)), executed: r.adjust(qRound(leftMargin*(resolution/72.)), qRound(topMargin*(resolution/72.)), -qRound(rightMargin*(resolution/72.)), -qRound(bottomMargin*(resolution/72.)));Execution Count:96 | 96 |
| 1588 | -qRound(bottomMargin*(resolution/72.))); executed: r.adjust(qRound(leftMargin*(resolution/72.)), qRound(topMargin*(resolution/72.)), -qRound(rightMargin*(resolution/72.)), -qRound(bottomMargin*(resolution/72.)));Execution Count:96 | 96 |
| 1589 | | - |
| 1590 | return r; executed: return r;Execution Count:192 | 192 |
| 1591 | } | - |
| 1592 | | - |
| 1593 | | - |
| 1594 | void QPdfEnginePrivate::writeHeader() | - |
| 1595 | { | - |
| 1596 | addXrefEntry(0,false); executed (the execution status of this line is deduced): addXrefEntry(0,false); | - |
| 1597 | | - |
| 1598 | xprintf("%%PDF-1.4\n"); executed (the execution status of this line is deduced): xprintf("%%PDF-1.4\n"); | - |
| 1599 | | - |
| 1600 | writeInfo(); executed (the execution status of this line is deduced): writeInfo(); | - |
| 1601 | | - |
| 1602 | catalog = addXrefEntry(-1); executed (the execution status of this line is deduced): catalog = addXrefEntry(-1); | - |
| 1603 | pageRoot = requestObject(); executed (the execution status of this line is deduced): pageRoot = requestObject(); | - |
| 1604 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1605 | "/Type /Catalog\n" executed (the execution status of this line is deduced): "/Type /Catalog\n" | - |
| 1606 | "/Pages %d 0 R\n" executed (the execution status of this line is deduced): "/Pages %d 0 R\n" | - |
| 1607 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1608 | "endobj\n", pageRoot); executed (the execution status of this line is deduced): "endobj\n", pageRoot); | - |
| 1609 | | - |
| 1610 | // graphics state | - |
| 1611 | graphicsState = addXrefEntry(-1); executed (the execution status of this line is deduced): graphicsState = addXrefEntry(-1); | - |
| 1612 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1613 | "/Type /ExtGState\n" executed (the execution status of this line is deduced): "/Type /ExtGState\n" | - |
| 1614 | "/SA true\n" executed (the execution status of this line is deduced): "/SA true\n" | - |
| 1615 | "/SM 0.02\n" executed (the execution status of this line is deduced): "/SM 0.02\n" | - |
| 1616 | "/ca 1.0\n" executed (the execution status of this line is deduced): "/ca 1.0\n" | - |
| 1617 | "/CA 1.0\n" executed (the execution status of this line is deduced): "/CA 1.0\n" | - |
| 1618 | "/AIS false\n" executed (the execution status of this line is deduced): "/AIS false\n" | - |
| 1619 | "/SMask /None" executed (the execution status of this line is deduced): "/SMask /None" | - |
| 1620 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1621 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1622 | | - |
| 1623 | // color space for pattern | - |
| 1624 | patternColorSpace = addXrefEntry(-1); executed (the execution status of this line is deduced): patternColorSpace = addXrefEntry(-1); | - |
| 1625 | xprintf("[/Pattern /DeviceRGB]\n" executed (the execution status of this line is deduced): xprintf("[/Pattern /DeviceRGB]\n" | - |
| 1626 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1627 | } executed: }Execution Count:20 | 20 |
| 1628 | | - |
| 1629 | void QPdfEnginePrivate::writeInfo() | - |
| 1630 | { | - |
| 1631 | info = addXrefEntry(-1); executed (the execution status of this line is deduced): info = addXrefEntry(-1); | - |
| 1632 | xprintf("<<\n/Title "); executed (the execution status of this line is deduced): xprintf("<<\n/Title "); | - |
| 1633 | printString(title); executed (the execution status of this line is deduced): printString(title); | - |
| 1634 | xprintf("\n/Creator "); executed (the execution status of this line is deduced): xprintf("\n/Creator "); | - |
| 1635 | printString(creator); executed (the execution status of this line is deduced): printString(creator); | - |
| 1636 | xprintf("\n/Producer "); executed (the execution status of this line is deduced): xprintf("\n/Producer "); | - |
| 1637 | printString(QString::fromLatin1("Qt " QT_VERSION_STR " (C) 2012 Digia Plc and/or its subsidiary(-ies)")); executed (the execution status of this line is deduced): printString(QString::fromLatin1("Qt " "5.0.2" " (C) 2012 Digia Plc and/or its subsidiary(-ies)")); | - |
| 1638 | QDateTime now = QDateTime::currentDateTime().toUTC(); executed (the execution status of this line is deduced): QDateTime now = QDateTime::currentDateTime().toUTC(); | - |
| 1639 | QTime t = now.time(); executed (the execution status of this line is deduced): QTime t = now.time(); | - |
| 1640 | QDate d = now.date(); executed (the execution status of this line is deduced): QDate d = now.date(); | - |
| 1641 | xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", executed (the execution status of this line is deduced): xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", | - |
| 1642 | d.year(), executed (the execution status of this line is deduced): d.year(), | - |
| 1643 | d.month(), executed (the execution status of this line is deduced): d.month(), | - |
| 1644 | d.day(), executed (the execution status of this line is deduced): d.day(), | - |
| 1645 | t.hour(), executed (the execution status of this line is deduced): t.hour(), | - |
| 1646 | t.minute(), executed (the execution status of this line is deduced): t.minute(), | - |
| 1647 | t.second()); executed (the execution status of this line is deduced): t.second()); | - |
| 1648 | xprintf(">>\n" executed (the execution status of this line is deduced): xprintf(">>\n" | - |
| 1649 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1650 | } executed: }Execution Count:20 | 20 |
| 1651 | | - |
| 1652 | void QPdfEnginePrivate::writePageRoot() | - |
| 1653 | { | - |
| 1654 | addXrefEntry(pageRoot); executed (the execution status of this line is deduced): addXrefEntry(pageRoot); | - |
| 1655 | | - |
| 1656 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1657 | "/Type /Pages\n" executed (the execution status of this line is deduced): "/Type /Pages\n" | - |
| 1658 | "/Kids \n" executed (the execution status of this line is deduced): "/Kids \n" | - |
| 1659 | "[\n"); executed (the execution status of this line is deduced): "[\n"); | - |
| 1660 | int size = pages.size(); executed (the execution status of this line is deduced): int size = pages.size(); | - |
| 1661 | for (int i = 0; i < size; ++i) evaluated: i < size| yes Evaluation Count:20 | yes Evaluation Count:20 |
| 20 |
| 1662 | xprintf("%d 0 R\n", pages[i]); executed: xprintf("%d 0 R\n", pages[i]);Execution Count:20 | 20 |
| 1663 | xprintf("]\n"); executed (the execution status of this line is deduced): xprintf("]\n"); | - |
| 1664 | | - |
| 1665 | //xprintf("/Group <</S /Transparency /I true /K false>>\n"); | - |
| 1666 | xprintf("/Count %d\n", pages.size()); executed (the execution status of this line is deduced): xprintf("/Count %d\n", pages.size()); | - |
| 1667 | | - |
| 1668 | xprintf("/ProcSet [/PDF /Text /ImageB /ImageC]\n" executed (the execution status of this line is deduced): xprintf("/ProcSet [/PDF /Text /ImageB /ImageC]\n" | - |
| 1669 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1670 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1671 | } executed: }Execution Count:20 | 20 |
| 1672 | | - |
| 1673 | | - |
| 1674 | void QPdfEnginePrivate::embedFont(QFontSubset *font) | - |
| 1675 | { | - |
| 1676 | //qDebug() << "embedFont" << font->object_id; | - |
| 1677 | int fontObject = font->object_id; never executed (the execution status of this line is deduced): int fontObject = font->object_id; | - |
| 1678 | QByteArray fontData = font->toTruetype(); never executed (the execution status of this line is deduced): QByteArray fontData = font->toTruetype(); | - |
| 1679 | #ifdef FONT_DUMP | - |
| 1680 | static int i = 0; | - |
| 1681 | QString fileName("font%1.ttf"); | - |
| 1682 | fileName = fileName.arg(i++); | - |
| 1683 | QFile ff(fileName); | - |
| 1684 | ff.open(QFile::WriteOnly); | - |
| 1685 | ff.write(fontData); | - |
| 1686 | ff.close(); | - |
| 1687 | #endif | - |
| 1688 | | - |
| 1689 | int fontDescriptor = requestObject(); never executed (the execution status of this line is deduced): int fontDescriptor = requestObject(); | - |
| 1690 | int fontstream = requestObject(); never executed (the execution status of this line is deduced): int fontstream = requestObject(); | - |
| 1691 | int cidfont = requestObject(); never executed (the execution status of this line is deduced): int cidfont = requestObject(); | - |
| 1692 | int toUnicode = requestObject(); never executed (the execution status of this line is deduced): int toUnicode = requestObject(); | - |
| 1693 | | - |
| 1694 | QFontEngine::Properties properties = font->fontEngine->properties(); never executed (the execution status of this line is deduced): QFontEngine::Properties properties = font->fontEngine->properties(); | - |
| 1695 | | - |
| 1696 | { | - |
| 1697 | qreal scale = 1000/properties.emSquare.toReal(); never executed (the execution status of this line is deduced): qreal scale = 1000/properties.emSquare.toReal(); | - |
| 1698 | addXrefEntry(fontDescriptor); never executed (the execution status of this line is deduced): addXrefEntry(fontDescriptor); | - |
| 1699 | QByteArray descriptor; never executed (the execution status of this line is deduced): QByteArray descriptor; | - |
| 1700 | QPdf::ByteStream s(&descriptor); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&descriptor); | - |
| 1701 | s << "<< /Type /FontDescriptor\n" never executed (the execution status of this line is deduced): s << "<< /Type /FontDescriptor\n" | - |
| 1702 | "/FontName /Q"; never executed (the execution status of this line is deduced): "/FontName /Q"; | - |
| 1703 | int tag = fontDescriptor; never executed (the execution status of this line is deduced): int tag = fontDescriptor; | - |
| 1704 | for (int i = 0; i < 5; ++i) { | 0 |
| 1705 | s << (char)('A' + (tag % 26)); never executed (the execution status of this line is deduced): s << (char)('A' + (tag % 26)); | - |
| 1706 | tag /= 26; never executed (the execution status of this line is deduced): tag /= 26; | - |
| 1707 | } | 0 |
| 1708 | s << '+' << properties.postscriptName << "\n" never executed (the execution status of this line is deduced): s << '+' << properties.postscriptName << "\n" | - |
| 1709 | "/Flags " << 4 << "\n" never executed (the execution status of this line is deduced): "/Flags " << 4 << "\n" | - |
| 1710 | "/FontBBox [" never executed (the execution status of this line is deduced): "/FontBBox [" | - |
| 1711 | << properties.boundingBox.x()*scale never executed (the execution status of this line is deduced): << properties.boundingBox.x()*scale | - |
| 1712 | << -(properties.boundingBox.y() + properties.boundingBox.height())*scale never executed (the execution status of this line is deduced): << -(properties.boundingBox.y() + properties.boundingBox.height())*scale | - |
| 1713 | << (properties.boundingBox.x() + properties.boundingBox.width())*scale never executed (the execution status of this line is deduced): << (properties.boundingBox.x() + properties.boundingBox.width())*scale | - |
| 1714 | << -properties.boundingBox.y()*scale << "]\n" never executed (the execution status of this line is deduced): << -properties.boundingBox.y()*scale << "]\n" | - |
| 1715 | "/ItalicAngle " << properties.italicAngle.toReal() << "\n" never executed (the execution status of this line is deduced): "/ItalicAngle " << properties.italicAngle.toReal() << "\n" | - |
| 1716 | "/Ascent " << properties.ascent.toReal()*scale << "\n" never executed (the execution status of this line is deduced): "/Ascent " << properties.ascent.toReal()*scale << "\n" | - |
| 1717 | "/Descent " << -properties.descent.toReal()*scale << "\n" never executed (the execution status of this line is deduced): "/Descent " << -properties.descent.toReal()*scale << "\n" | - |
| 1718 | "/CapHeight " << properties.capHeight.toReal()*scale << "\n" never executed (the execution status of this line is deduced): "/CapHeight " << properties.capHeight.toReal()*scale << "\n" | - |
| 1719 | "/StemV " << properties.lineWidth.toReal()*scale << "\n" never executed (the execution status of this line is deduced): "/StemV " << properties.lineWidth.toReal()*scale << "\n" | - |
| 1720 | "/FontFile2 " << fontstream << "0 R\n" never executed (the execution status of this line is deduced): "/FontFile2 " << fontstream << "0 R\n" | - |
| 1721 | ">> endobj\n"; never executed (the execution status of this line is deduced): ">> endobj\n"; | - |
| 1722 | write(descriptor); never executed (the execution status of this line is deduced): write(descriptor); | - |
| 1723 | } | - |
| 1724 | { | - |
| 1725 | addXrefEntry(fontstream); never executed (the execution status of this line is deduced): addXrefEntry(fontstream); | - |
| 1726 | QByteArray header; never executed (the execution status of this line is deduced): QByteArray header; | - |
| 1727 | QPdf::ByteStream s(&header); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&header); | - |
| 1728 | | - |
| 1729 | int length_object = requestObject(); never executed (the execution status of this line is deduced): int length_object = requestObject(); | - |
| 1730 | s << "<<\n" never executed (the execution status of this line is deduced): s << "<<\n" | - |
| 1731 | "/Length1 " << fontData.size() << "\n" never executed (the execution status of this line is deduced): "/Length1 " << fontData.size() << "\n" | - |
| 1732 | "/Length " << length_object << "0 R\n"; never executed (the execution status of this line is deduced): "/Length " << length_object << "0 R\n"; | - |
| 1733 | if (do_compress) never evaluated: do_compress | 0 |
| 1734 | s << "/Filter /FlateDecode\n"; never executed: s << "/Filter /FlateDecode\n"; | 0 |
| 1735 | s << ">>\n" never executed (the execution status of this line is deduced): s << ">>\n" | - |
| 1736 | "stream\n"; never executed (the execution status of this line is deduced): "stream\n"; | - |
| 1737 | write(header); never executed (the execution status of this line is deduced): write(header); | - |
| 1738 | int len = writeCompressed(fontData); never executed (the execution status of this line is deduced): int len = writeCompressed(fontData); | - |
| 1739 | write("endstream\n" never executed (the execution status of this line is deduced): write("endstream\n" | - |
| 1740 | "endobj\n"); never executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1741 | addXrefEntry(length_object); never executed (the execution status of this line is deduced): addXrefEntry(length_object); | - |
| 1742 | xprintf("%d\n" never executed (the execution status of this line is deduced): xprintf("%d\n" | - |
| 1743 | "endobj\n", len); never executed (the execution status of this line is deduced): "endobj\n", len); | - |
| 1744 | } | - |
| 1745 | { | - |
| 1746 | addXrefEntry(cidfont); never executed (the execution status of this line is deduced): addXrefEntry(cidfont); | - |
| 1747 | QByteArray cid; never executed (the execution status of this line is deduced): QByteArray cid; | - |
| 1748 | QPdf::ByteStream s(&cid); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&cid); | - |
| 1749 | s << "<< /Type /Font\n" never executed (the execution status of this line is deduced): s << "<< /Type /Font\n" | - |
| 1750 | "/Subtype /CIDFontType2\n" never executed (the execution status of this line is deduced): "/Subtype /CIDFontType2\n" | - |
| 1751 | "/BaseFont /" << properties.postscriptName << "\n" never executed (the execution status of this line is deduced): "/BaseFont /" << properties.postscriptName << "\n" | - |
| 1752 | "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" never executed (the execution status of this line is deduced): "/CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>\n" | - |
| 1753 | "/FontDescriptor " << fontDescriptor << "0 R\n" never executed (the execution status of this line is deduced): "/FontDescriptor " << fontDescriptor << "0 R\n" | - |
| 1754 | "/CIDToGIDMap /Identity\n" never executed (the execution status of this line is deduced): "/CIDToGIDMap /Identity\n" | - |
| 1755 | << font->widthArray() << never executed (the execution status of this line is deduced): << font->widthArray() << | - |
| 1756 | ">>\n" never executed (the execution status of this line is deduced): ">>\n" | - |
| 1757 | "endobj\n"; never executed (the execution status of this line is deduced): "endobj\n"; | - |
| 1758 | write(cid); never executed (the execution status of this line is deduced): write(cid); | - |
| 1759 | } | - |
| 1760 | { | - |
| 1761 | addXrefEntry(toUnicode); never executed (the execution status of this line is deduced): addXrefEntry(toUnicode); | - |
| 1762 | QByteArray touc = font->createToUnicodeMap(); never executed (the execution status of this line is deduced): QByteArray touc = font->createToUnicodeMap(); | - |
| 1763 | xprintf("<< /Length %d >>\n" never executed (the execution status of this line is deduced): xprintf("<< /Length %d >>\n" | - |
| 1764 | "stream\n", touc.length()); never executed (the execution status of this line is deduced): "stream\n", touc.length()); | - |
| 1765 | write(touc); never executed (the execution status of this line is deduced): write(touc); | - |
| 1766 | write("endstream\n" never executed (the execution status of this line is deduced): write("endstream\n" | - |
| 1767 | "endobj\n"); never executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1768 | } | - |
| 1769 | { | - |
| 1770 | addXrefEntry(fontObject); never executed (the execution status of this line is deduced): addXrefEntry(fontObject); | - |
| 1771 | QByteArray font; never executed (the execution status of this line is deduced): QByteArray font; | - |
| 1772 | QPdf::ByteStream s(&font); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&font); | - |
| 1773 | s << "<< /Type /Font\n" never executed (the execution status of this line is deduced): s << "<< /Type /Font\n" | - |
| 1774 | "/Subtype /Type0\n" never executed (the execution status of this line is deduced): "/Subtype /Type0\n" | - |
| 1775 | "/BaseFont /" << properties.postscriptName << "\n" never executed (the execution status of this line is deduced): "/BaseFont /" << properties.postscriptName << "\n" | - |
| 1776 | "/Encoding /Identity-H\n" never executed (the execution status of this line is deduced): "/Encoding /Identity-H\n" | - |
| 1777 | "/DescendantFonts [" << cidfont << "0 R]\n" never executed (the execution status of this line is deduced): "/DescendantFonts [" << cidfont << "0 R]\n" | - |
| 1778 | "/ToUnicode " << toUnicode << "0 R" never executed (the execution status of this line is deduced): "/ToUnicode " << toUnicode << "0 R" | - |
| 1779 | ">>\n" never executed (the execution status of this line is deduced): ">>\n" | - |
| 1780 | "endobj\n"; never executed (the execution status of this line is deduced): "endobj\n"; | - |
| 1781 | write(font); never executed (the execution status of this line is deduced): write(font); | - |
| 1782 | } | - |
| 1783 | } | 0 |
| 1784 | | - |
| 1785 | | - |
| 1786 | void QPdfEnginePrivate::writeFonts() | - |
| 1787 | { | - |
| 1788 | for (QHash<QFontEngine::FaceId, QFontSubset *>::iterator it = fonts.begin(); it != fonts.end(); ++it) { partially evaluated: it != fonts.end()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1789 | embedFont(*it); never executed (the execution status of this line is deduced): embedFont(*it); | - |
| 1790 | delete *it; never executed (the execution status of this line is deduced): delete *it; | - |
| 1791 | } | 0 |
| 1792 | fonts.clear(); executed (the execution status of this line is deduced): fonts.clear(); | - |
| 1793 | } executed: }Execution Count:20 | 20 |
| 1794 | | - |
| 1795 | void QPdfEnginePrivate::writePage() | - |
| 1796 | { | - |
| 1797 | if (pages.empty()) evaluated: pages.empty()| yes Evaluation Count:20 | yes Evaluation Count:20 |
| 20 |
| 1798 | return; executed: return;Execution Count:20 | 20 |
| 1799 | | - |
| 1800 | *currentPage << "Q Q\n"; executed (the execution status of this line is deduced): *currentPage << "Q Q\n"; | - |
| 1801 | | - |
| 1802 | uint pageStream = requestObject(); executed (the execution status of this line is deduced): uint pageStream = requestObject(); | - |
| 1803 | uint pageStreamLength = requestObject(); executed (the execution status of this line is deduced): uint pageStreamLength = requestObject(); | - |
| 1804 | uint resources = requestObject(); executed (the execution status of this line is deduced): uint resources = requestObject(); | - |
| 1805 | uint annots = requestObject(); executed (the execution status of this line is deduced): uint annots = requestObject(); | - |
| 1806 | | - |
| 1807 | addXrefEntry(pages.last()); executed (the execution status of this line is deduced): addXrefEntry(pages.last()); | - |
| 1808 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1809 | "/Type /Page\n" executed (the execution status of this line is deduced): "/Type /Page\n" | - |
| 1810 | "/Parent %d 0 R\n" executed (the execution status of this line is deduced): "/Parent %d 0 R\n" | - |
| 1811 | "/Contents %d 0 R\n" executed (the execution status of this line is deduced): "/Contents %d 0 R\n" | - |
| 1812 | "/Resources %d 0 R\n" executed (the execution status of this line is deduced): "/Resources %d 0 R\n" | - |
| 1813 | "/Annots %d 0 R\n" executed (the execution status of this line is deduced): "/Annots %d 0 R\n" | - |
| 1814 | "/MediaBox [0 0 %d %d]\n" executed (the execution status of this line is deduced): "/MediaBox [0 0 %d %d]\n" | - |
| 1815 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1816 | "endobj\n", executed (the execution status of this line is deduced): "endobj\n", | - |
| 1817 | pageRoot, pageStream, resources, annots, executed (the execution status of this line is deduced): pageRoot, pageStream, resources, annots, | - |
| 1818 | // make sure we use the pagesize from when we started the page, since the user may have changed it executed (the execution status of this line is deduced): | - |
| 1819 | currentPage->pageSize.width(), currentPage->pageSize.height()); executed (the execution status of this line is deduced): currentPage->pageSize.width(), currentPage->pageSize.height()); | - |
| 1820 | | - |
| 1821 | addXrefEntry(resources); executed (the execution status of this line is deduced): addXrefEntry(resources); | - |
| 1822 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1823 | "/ColorSpace <<\n" executed (the execution status of this line is deduced): "/ColorSpace <<\n" | - |
| 1824 | "/PCSp %d 0 R\n" executed (the execution status of this line is deduced): "/PCSp %d 0 R\n" | - |
| 1825 | "/CSp /DeviceRGB\n" executed (the execution status of this line is deduced): "/CSp /DeviceRGB\n" | - |
| 1826 | "/CSpg /DeviceGray\n" executed (the execution status of this line is deduced): "/CSpg /DeviceGray\n" | - |
| 1827 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1828 | "/ExtGState <<\n" executed (the execution status of this line is deduced): "/ExtGState <<\n" | - |
| 1829 | "/GSa %d 0 R\n", executed (the execution status of this line is deduced): "/GSa %d 0 R\n", | - |
| 1830 | patternColorSpace, graphicsState); executed (the execution status of this line is deduced): patternColorSpace, graphicsState); | - |
| 1831 | | - |
| 1832 | for (int i = 0; i < currentPage->graphicStates.size(); ++i) partially evaluated: i < currentPage->graphicStates.size()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1833 | xprintf("/GState%d %d 0 R\n", currentPage->graphicStates.at(i), currentPage->graphicStates.at(i)); never executed: xprintf("/GState%d %d 0 R\n", currentPage->graphicStates.at(i), currentPage->graphicStates.at(i)); | 0 |
| 1834 | xprintf(">>\n"); executed (the execution status of this line is deduced): xprintf(">>\n"); | - |
| 1835 | | - |
| 1836 | xprintf("/Pattern <<\n"); executed (the execution status of this line is deduced): xprintf("/Pattern <<\n"); | - |
| 1837 | for (int i = 0; i < currentPage->patterns.size(); ++i) partially evaluated: i < currentPage->patterns.size()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1838 | xprintf("/Pat%d %d 0 R\n", currentPage->patterns.at(i), currentPage->patterns.at(i)); never executed: xprintf("/Pat%d %d 0 R\n", currentPage->patterns.at(i), currentPage->patterns.at(i)); | 0 |
| 1839 | xprintf(">>\n"); executed (the execution status of this line is deduced): xprintf(">>\n"); | - |
| 1840 | | - |
| 1841 | xprintf("/Font <<\n"); executed (the execution status of this line is deduced): xprintf("/Font <<\n"); | - |
| 1842 | for (int i = 0; i < currentPage->fonts.size();++i) partially evaluated: i < currentPage->fonts.size()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1843 | xprintf("/F%d %d 0 R\n", currentPage->fonts[i], currentPage->fonts[i]); never executed: xprintf("/F%d %d 0 R\n", currentPage->fonts[i], currentPage->fonts[i]); | 0 |
| 1844 | xprintf(">>\n"); executed (the execution status of this line is deduced): xprintf(">>\n"); | - |
| 1845 | | - |
| 1846 | xprintf("/XObject <<\n"); executed (the execution status of this line is deduced): xprintf("/XObject <<\n"); | - |
| 1847 | for (int i = 0; i<currentPage->images.size(); ++i) { partially evaluated: i<currentPage->images.size()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1848 | xprintf("/Im%d %d 0 R\n", currentPage->images.at(i), currentPage->images.at(i)); never executed (the execution status of this line is deduced): xprintf("/Im%d %d 0 R\n", currentPage->images.at(i), currentPage->images.at(i)); | - |
| 1849 | } | 0 |
| 1850 | xprintf(">>\n"); executed (the execution status of this line is deduced): xprintf(">>\n"); | - |
| 1851 | | - |
| 1852 | xprintf(">>\n" executed (the execution status of this line is deduced): xprintf(">>\n" | - |
| 1853 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1854 | | - |
| 1855 | addXrefEntry(annots); executed (the execution status of this line is deduced): addXrefEntry(annots); | - |
| 1856 | xprintf("[ "); executed (the execution status of this line is deduced): xprintf("[ "); | - |
| 1857 | for (int i = 0; i<currentPage->annotations.size(); ++i) { partially evaluated: i<currentPage->annotations.size()| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1858 | xprintf("%d 0 R ", currentPage->annotations.at(i)); never executed (the execution status of this line is deduced): xprintf("%d 0 R ", currentPage->annotations.at(i)); | - |
| 1859 | } | 0 |
| 1860 | xprintf("]\nendobj\n"); executed (the execution status of this line is deduced): xprintf("]\nendobj\n"); | - |
| 1861 | | - |
| 1862 | addXrefEntry(pageStream); executed (the execution status of this line is deduced): addXrefEntry(pageStream); | - |
| 1863 | xprintf("<<\n" executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 1864 | "/Length %d 0 R\n", pageStreamLength); // object number for stream length object executed (the execution status of this line is deduced): "/Length %d 0 R\n", pageStreamLength); | - |
| 1865 | if (do_compress) partially evaluated: do_compress| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 1866 | xprintf("/Filter /FlateDecode\n"); executed: xprintf("/Filter /FlateDecode\n");Execution Count:20 | 20 |
| 1867 | | - |
| 1868 | xprintf(">>\n"); executed (the execution status of this line is deduced): xprintf(">>\n"); | - |
| 1869 | xprintf("stream\n"); executed (the execution status of this line is deduced): xprintf("stream\n"); | - |
| 1870 | QIODevice *content = currentPage->stream(); executed (the execution status of this line is deduced): QIODevice *content = currentPage->stream(); | - |
| 1871 | int len = writeCompressed(content); executed (the execution status of this line is deduced): int len = writeCompressed(content); | - |
| 1872 | xprintf("endstream\n" executed (the execution status of this line is deduced): xprintf("endstream\n" | - |
| 1873 | "endobj\n"); executed (the execution status of this line is deduced): "endobj\n"); | - |
| 1874 | | - |
| 1875 | addXrefEntry(pageStreamLength); executed (the execution status of this line is deduced): addXrefEntry(pageStreamLength); | - |
| 1876 | xprintf("%d\nendobj\n",len); executed (the execution status of this line is deduced): xprintf("%d\nendobj\n",len); | - |
| 1877 | } executed: }Execution Count:20 | 20 |
| 1878 | | - |
| 1879 | void QPdfEnginePrivate::writeTail() | - |
| 1880 | { | - |
| 1881 | writePage(); executed (the execution status of this line is deduced): writePage(); | - |
| 1882 | writeFonts(); executed (the execution status of this line is deduced): writeFonts(); | - |
| 1883 | writePageRoot(); executed (the execution status of this line is deduced): writePageRoot(); | - |
| 1884 | addXrefEntry(xrefPositions.size(),false); executed (the execution status of this line is deduced): addXrefEntry(xrefPositions.size(),false); | - |
| 1885 | xprintf("xref\n" executed (the execution status of this line is deduced): xprintf("xref\n" | - |
| 1886 | "0 %d\n" executed (the execution status of this line is deduced): "0 %d\n" | - |
| 1887 | "%010d 65535 f \n", xrefPositions.size()-1, xrefPositions[0]); executed (the execution status of this line is deduced): "%010d 65535 f \n", xrefPositions.size()-1, xrefPositions[0]); | - |
| 1888 | | - |
| 1889 | for (int i = 1; i < xrefPositions.size()-1; ++i) evaluated: i < xrefPositions.size()-1| yes Evaluation Count:200 | yes Evaluation Count:20 |
| 20-200 |
| 1890 | xprintf("%010d 00000 n \n", xrefPositions[i]); executed: xprintf("%010d 00000 n \n", xrefPositions[i]);Execution Count:200 | 200 |
| 1891 | | - |
| 1892 | xprintf("trailer\n" executed (the execution status of this line is deduced): xprintf("trailer\n" | - |
| 1893 | "<<\n" executed (the execution status of this line is deduced): "<<\n" | - |
| 1894 | "/Size %d\n" executed (the execution status of this line is deduced): "/Size %d\n" | - |
| 1895 | "/Info %d 0 R\n" executed (the execution status of this line is deduced): "/Info %d 0 R\n" | - |
| 1896 | "/Root %d 0 R\n" executed (the execution status of this line is deduced): "/Root %d 0 R\n" | - |
| 1897 | ">>\n" executed (the execution status of this line is deduced): ">>\n" | - |
| 1898 | "startxref\n%d\n" executed (the execution status of this line is deduced): "startxref\n%d\n" | - |
| 1899 | "%%%%EOF\n", executed (the execution status of this line is deduced): "%%%%EOF\n", | - |
| 1900 | xrefPositions.size()-1, info, catalog, xrefPositions.last()); executed (the execution status of this line is deduced): xrefPositions.size()-1, info, catalog, xrefPositions.last()); | - |
| 1901 | } executed: }Execution Count:20 | 20 |
| 1902 | | - |
| 1903 | int QPdfEnginePrivate::addXrefEntry(int object, bool printostr) | - |
| 1904 | { | - |
| 1905 | if (object < 0) evaluated: object < 0| yes Evaluation Count:80 | yes Evaluation Count:160 |
| 80-160 |
| 1906 | object = requestObject(); executed: object = requestObject();Execution Count:80 | 80 |
| 1907 | | - |
| 1908 | if (object>=xrefPositions.size()) evaluated: object>=xrefPositions.size()| yes Evaluation Count:180 | yes Evaluation Count:60 |
| 60-180 |
| 1909 | xrefPositions.resize(object+1); executed: xrefPositions.resize(object+1);Execution Count:180 | 180 |
| 1910 | | - |
| 1911 | xrefPositions[object] = streampos; executed (the execution status of this line is deduced): xrefPositions[object] = streampos; | - |
| 1912 | if (printostr) evaluated: printostr| yes Evaluation Count:200 | yes Evaluation Count:40 |
| 40-200 |
| 1913 | xprintf("%d 0 obj\n",object); executed: xprintf("%d 0 obj\n",object);Execution Count:200 | 200 |
| 1914 | | - |
| 1915 | return object; executed: return object;Execution Count:240 | 240 |
| 1916 | } | - |
| 1917 | | - |
| 1918 | void QPdfEnginePrivate::printString(const QString &string) { | - |
| 1919 | // The 'text string' type in PDF is encoded either as PDFDocEncoding, or | - |
| 1920 | // Unicode UTF-16 with a Unicode byte order mark as the first character | - |
| 1921 | // (0xfeff), with the high-order byte first. | - |
| 1922 | QByteArray array("(\xfe\xff"); executed (the execution status of this line is deduced): QByteArray array("(\xfe\xff"); | - |
| 1923 | const ushort *utf16 = string.utf16(); executed (the execution status of this line is deduced): const ushort *utf16 = string.utf16(); | - |
| 1924 | | - |
| 1925 | for (int i=0; i < string.size(); ++i) { evaluated: i < string.size()| yes Evaluation Count:1106 | yes Evaluation Count:60 |
| 60-1106 |
| 1926 | char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)}; executed (the execution status of this line is deduced): char part[2] = {char((*(utf16 + i)) >> 8), char((*(utf16 + i)) & 0xff)}; | - |
| 1927 | for(int j=0; j < 2; ++j) { evaluated: j < 2| yes Evaluation Count:2212 | yes Evaluation Count:1106 |
| 1106-2212 |
| 1928 | if (part[j] == '(' || part[j] == ')' || part[j] == '\\') evaluated: part[j] == '('| yes Evaluation Count:41 | yes Evaluation Count:2171 |
evaluated: part[j] == ')'| yes Evaluation Count:41 | yes Evaluation Count:2130 |
evaluated: part[j] == '\\'| yes Evaluation Count:1 | yes Evaluation Count:2129 |
| 1-2171 |
| 1929 | array.append('\\'); executed: array.append('\\');Execution Count:83 | 83 |
| 1930 | array.append(part[j]); executed (the execution status of this line is deduced): array.append(part[j]); | - |
| 1931 | } executed: }Execution Count:2212 | 2212 |
| 1932 | } executed: }Execution Count:1106 | 1106 |
| 1933 | array.append(")"); executed (the execution status of this line is deduced): array.append(")"); | - |
| 1934 | write(array); executed (the execution status of this line is deduced): write(array); | - |
| 1935 | } executed: }Execution Count:60 | 60 |
| 1936 | | - |
| 1937 | | - |
| 1938 | // For strings up to 10000 bytes only ! | - |
| 1939 | void QPdfEnginePrivate::xprintf(const char* fmt, ...) | - |
| 1940 | { | - |
| 1941 | if (!stream) partially evaluated: !stream| no Evaluation Count:0 | yes Evaluation Count:1080 |
| 0-1080 |
| 1942 | return; | 0 |
| 1943 | | - |
| 1944 | const int msize = 10000; executed (the execution status of this line is deduced): const int msize = 10000; | - |
| 1945 | char buf[msize]; executed (the execution status of this line is deduced): char buf[msize]; | - |
| 1946 | | - |
| 1947 | va_list args; executed (the execution status of this line is deduced): va_list args; | - |
| 1948 | va_start(args, fmt); executed (the execution status of this line is deduced): __builtin_va_start(args,fmt); | - |
| 1949 | int bufsize = qvsnprintf(buf, msize, fmt, args); executed (the execution status of this line is deduced): int bufsize = qvsnprintf(buf, msize, fmt, args); | - |
| 1950 | | - |
| 1951 | Q_ASSERT(bufsize<msize); executed (the execution status of this line is deduced): qt_noop(); | - |
| 1952 | | - |
| 1953 | va_end(args); executed (the execution status of this line is deduced): __builtin_va_end(args); | - |
| 1954 | | - |
| 1955 | stream->writeRawData(buf, bufsize); executed (the execution status of this line is deduced): stream->writeRawData(buf, bufsize); | - |
| 1956 | streampos += bufsize; executed (the execution status of this line is deduced): streampos += bufsize; | - |
| 1957 | } executed: }Execution Count:1080 | 1080 |
| 1958 | | - |
| 1959 | int QPdfEnginePrivate::writeCompressed(QIODevice *dev) | - |
| 1960 | { | - |
| 1961 | #ifndef QT_NO_COMPRESS | - |
| 1962 | if (do_compress) { partially evaluated: do_compress| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 1963 | int size = QPdfPage::chunkSize(); executed (the execution status of this line is deduced): int size = QPdfPage::chunkSize(); | - |
| 1964 | int sum = 0; executed (the execution status of this line is deduced): int sum = 0; | - |
| 1965 | ::z_stream zStruct; executed (the execution status of this line is deduced): ::z_stream zStruct; | - |
| 1966 | zStruct.zalloc = Z_NULL; executed (the execution status of this line is deduced): zStruct.zalloc = 0; | - |
| 1967 | zStruct.zfree = Z_NULL; executed (the execution status of this line is deduced): zStruct.zfree = 0; | - |
| 1968 | zStruct.opaque = Z_NULL; executed (the execution status of this line is deduced): zStruct.opaque = 0; | - |
| 1969 | if (::deflateInit(&zStruct, Z_DEFAULT_COMPRESSION) != Z_OK) { partially evaluated: ::deflateInit_((&zStruct), ((-1)), "1.2.3.4", sizeof(z_stream)) != 0| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1970 | qWarning("QPdfStream::writeCompressed: Error in deflateInit()"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 1970, __PRETTY_FUNCTION__).warning("QPdfStream::writeCompressed: Error in deflateInit()"); | - |
| 1971 | return sum; never executed: return sum; | 0 |
| 1972 | } | - |
| 1973 | zStruct.avail_in = 0; executed (the execution status of this line is deduced): zStruct.avail_in = 0; | - |
| 1974 | QByteArray in, out; executed (the execution status of this line is deduced): QByteArray in, out; | - |
| 1975 | out.resize(size); executed (the execution status of this line is deduced): out.resize(size); | - |
| 1976 | while (!dev->atEnd() || zStruct.avail_in != 0) { evaluated: !dev->atEnd()| yes Evaluation Count:20 | yes Evaluation Count:20 |
partially evaluated: zStruct.avail_in != 0| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1977 | if (zStruct.avail_in == 0) { partially evaluated: zStruct.avail_in == 0| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 1978 | in = dev->read(size); executed (the execution status of this line is deduced): in = dev->read(size); | - |
| 1979 | zStruct.avail_in = in.size(); executed (the execution status of this line is deduced): zStruct.avail_in = in.size(); | - |
| 1980 | zStruct.next_in = reinterpret_cast<unsigned char*>(in.data()); executed (the execution status of this line is deduced): zStruct.next_in = reinterpret_cast<unsigned char*>(in.data()); | - |
| 1981 | if (in.size() <= 0) { partially evaluated: in.size() <= 0| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1982 | qWarning("QPdfStream::writeCompressed: Error in read()"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 1982, __PRETTY_FUNCTION__).warning("QPdfStream::writeCompressed: Error in read()"); | - |
| 1983 | ::deflateEnd(&zStruct); never executed (the execution status of this line is deduced): ::deflateEnd(&zStruct); | - |
| 1984 | return sum; never executed: return sum; | 0 |
| 1985 | } | - |
| 1986 | } executed: }Execution Count:20 | 20 |
| 1987 | zStruct.next_out = reinterpret_cast<unsigned char*>(out.data()); executed (the execution status of this line is deduced): zStruct.next_out = reinterpret_cast<unsigned char*>(out.data()); | - |
| 1988 | zStruct.avail_out = out.size(); executed (the execution status of this line is deduced): zStruct.avail_out = out.size(); | - |
| 1989 | if (::deflate(&zStruct, 0) != Z_OK) { partially evaluated: ::deflate(&zStruct, 0) != 0| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 1990 | qWarning("QPdfStream::writeCompressed: Error in deflate()"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 1990, __PRETTY_FUNCTION__).warning("QPdfStream::writeCompressed: Error in deflate()"); | - |
| 1991 | ::deflateEnd(&zStruct); never executed (the execution status of this line is deduced): ::deflateEnd(&zStruct); | - |
| 1992 | return sum; never executed: return sum; | 0 |
| 1993 | } | - |
| 1994 | int written = out.size() - zStruct.avail_out; executed (the execution status of this line is deduced): int written = out.size() - zStruct.avail_out; | - |
| 1995 | stream->writeRawData(out.constData(), written); executed (the execution status of this line is deduced): stream->writeRawData(out.constData(), written); | - |
| 1996 | streampos += written; executed (the execution status of this line is deduced): streampos += written; | - |
| 1997 | sum += written; executed (the execution status of this line is deduced): sum += written; | - |
| 1998 | } executed: }Execution Count:20 | 20 |
| 1999 | int ret; executed (the execution status of this line is deduced): int ret; | - |
| 2000 | do { | - |
| 2001 | zStruct.next_out = reinterpret_cast<unsigned char*>(out.data()); executed (the execution status of this line is deduced): zStruct.next_out = reinterpret_cast<unsigned char*>(out.data()); | - |
| 2002 | zStruct.avail_out = out.size(); executed (the execution status of this line is deduced): zStruct.avail_out = out.size(); | - |
| 2003 | ret = ::deflate(&zStruct, Z_FINISH); executed (the execution status of this line is deduced): ret = ::deflate(&zStruct, 4); | - |
| 2004 | if (ret != Z_OK && ret != Z_STREAM_END) { partially evaluated: ret != 0| yes Evaluation Count:20 | no Evaluation Count:0 |
partially evaluated: ret != 1| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 2005 | qWarning("QPdfStream::writeCompressed: Error in deflate()"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 2005, __PRETTY_FUNCTION__).warning("QPdfStream::writeCompressed: Error in deflate()"); | - |
| 2006 | ::deflateEnd(&zStruct); never executed (the execution status of this line is deduced): ::deflateEnd(&zStruct); | - |
| 2007 | return sum; never executed: return sum; | 0 |
| 2008 | } | - |
| 2009 | int written = out.size() - zStruct.avail_out; executed (the execution status of this line is deduced): int written = out.size() - zStruct.avail_out; | - |
| 2010 | stream->writeRawData(out.constData(), written); executed (the execution status of this line is deduced): stream->writeRawData(out.constData(), written); | - |
| 2011 | streampos += written; executed (the execution status of this line is deduced): streampos += written; | - |
| 2012 | sum += written; executed (the execution status of this line is deduced): sum += written; | - |
| 2013 | } while (ret == Z_OK); executed: }Execution Count:20 partially evaluated: ret == 0| no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
| 2014 | | - |
| 2015 | ::deflateEnd(&zStruct); executed (the execution status of this line is deduced): ::deflateEnd(&zStruct); | - |
| 2016 | | - |
| 2017 | return sum; executed: return sum;Execution Count:20 | 20 |
| 2018 | } else | - |
| 2019 | #endif | - |
| 2020 | { | - |
| 2021 | QByteArray arr; never executed (the execution status of this line is deduced): QByteArray arr; | - |
| 2022 | int sum = 0; never executed (the execution status of this line is deduced): int sum = 0; | - |
| 2023 | while (!dev->atEnd()) { never evaluated: !dev->atEnd() | 0 |
| 2024 | arr = dev->read(QPdfPage::chunkSize()); never executed (the execution status of this line is deduced): arr = dev->read(QPdfPage::chunkSize()); | - |
| 2025 | stream->writeRawData(arr.constData(), arr.size()); never executed (the execution status of this line is deduced): stream->writeRawData(arr.constData(), arr.size()); | - |
| 2026 | streampos += arr.size(); never executed (the execution status of this line is deduced): streampos += arr.size(); | - |
| 2027 | sum += arr.size(); never executed (the execution status of this line is deduced): sum += arr.size(); | - |
| 2028 | } | 0 |
| 2029 | return sum; never executed: return sum; | 0 |
| 2030 | } | - |
| 2031 | } | - |
| 2032 | | - |
| 2033 | int QPdfEnginePrivate::writeCompressed(const char *src, int len) | - |
| 2034 | { | - |
| 2035 | #ifndef QT_NO_COMPRESS | - |
| 2036 | if(do_compress) { never evaluated: do_compress | 0 |
| 2037 | uLongf destLen = len + len/100 + 13; // zlib requirement never executed (the execution status of this line is deduced): uLongf destLen = len + len/100 + 13; | - |
| 2038 | Bytef* dest = new Bytef[destLen]; never executed (the execution status of this line is deduced): Bytef* dest = new Bytef[destLen]; | - |
| 2039 | if (Z_OK == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len)) { never evaluated: 0 == ::compress(dest, &destLen, (const Bytef*) src, (uLongf)len) | 0 |
| 2040 | stream->writeRawData((const char*)dest, destLen); never executed (the execution status of this line is deduced): stream->writeRawData((const char*)dest, destLen); | - |
| 2041 | } else { | 0 |
| 2042 | qWarning("QPdfStream::writeCompressed: Error in compress()"); never executed (the execution status of this line is deduced): QMessageLogger("painting/qpdf.cpp", 2042, __PRETTY_FUNCTION__).warning("QPdfStream::writeCompressed: Error in compress()"); | - |
| 2043 | destLen = 0; never executed (the execution status of this line is deduced): destLen = 0; | - |
| 2044 | } | 0 |
| 2045 | delete [] dest; never executed (the execution status of this line is deduced): delete [] dest; | - |
| 2046 | len = destLen; never executed (the execution status of this line is deduced): len = destLen; | - |
| 2047 | } else | 0 |
| 2048 | #endif | - |
| 2049 | { | - |
| 2050 | stream->writeRawData(src,len); never executed (the execution status of this line is deduced): stream->writeRawData(src,len); | - |
| 2051 | } | 0 |
| 2052 | streampos += len; never executed (the execution status of this line is deduced): streampos += len; | - |
| 2053 | return len; never executed: return len; | 0 |
| 2054 | } | - |
| 2055 | | - |
| 2056 | int QPdfEnginePrivate::writeImage(const QByteArray &data, int width, int height, int depth, | - |
| 2057 | int maskObject, int softMaskObject, bool dct) | - |
| 2058 | { | - |
| 2059 | int image = addXrefEntry(-1); never executed (the execution status of this line is deduced): int image = addXrefEntry(-1); | - |
| 2060 | xprintf("<<\n" never executed (the execution status of this line is deduced): xprintf("<<\n" | - |
| 2061 | "/Type /XObject\n" never executed (the execution status of this line is deduced): "/Type /XObject\n" | - |
| 2062 | "/Subtype /Image\n" never executed (the execution status of this line is deduced): "/Subtype /Image\n" | - |
| 2063 | "/Width %d\n" never executed (the execution status of this line is deduced): "/Width %d\n" | - |
| 2064 | "/Height %d\n", width, height); never executed (the execution status of this line is deduced): "/Height %d\n", width, height); | - |
| 2065 | | - |
| 2066 | if (depth == 1) { never evaluated: depth == 1 | 0 |
| 2067 | xprintf("/ImageMask true\n" never executed (the execution status of this line is deduced): xprintf("/ImageMask true\n" | - |
| 2068 | "/Decode [1 0]\n"); never executed (the execution status of this line is deduced): "/Decode [1 0]\n"); | - |
| 2069 | } else { | 0 |
| 2070 | xprintf("/BitsPerComponent 8\n" never executed (the execution status of this line is deduced): xprintf("/BitsPerComponent 8\n" | - |
| 2071 | "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); never executed (the execution status of this line is deduced): "/ColorSpace %s\n", (depth == 32) ? "/DeviceRGB" : "/DeviceGray"); | - |
| 2072 | } | 0 |
| 2073 | if (maskObject > 0) never evaluated: maskObject > 0 | 0 |
| 2074 | xprintf("/Mask %d 0 R\n", maskObject); never executed: xprintf("/Mask %d 0 R\n", maskObject); | 0 |
| 2075 | if (softMaskObject > 0) never evaluated: softMaskObject > 0 | 0 |
| 2076 | xprintf("/SMask %d 0 R\n", softMaskObject); never executed: xprintf("/SMask %d 0 R\n", softMaskObject); | 0 |
| 2077 | | - |
| 2078 | int lenobj = requestObject(); never executed (the execution status of this line is deduced): int lenobj = requestObject(); | - |
| 2079 | xprintf("/Length %d 0 R\n", lenobj); never executed (the execution status of this line is deduced): xprintf("/Length %d 0 R\n", lenobj); | - |
| 2080 | if (interpolateImages) never evaluated: interpolateImages | 0 |
| 2081 | xprintf("/Interpolate true\n"); never executed: xprintf("/Interpolate true\n"); | 0 |
| 2082 | int len = 0; never executed (the execution status of this line is deduced): int len = 0; | - |
| 2083 | if (dct) { | 0 |
| 2084 | //qDebug() << "DCT"; | - |
| 2085 | xprintf("/Filter /DCTDecode\n>>\nstream\n"); never executed (the execution status of this line is deduced): xprintf("/Filter /DCTDecode\n>>\nstream\n"); | - |
| 2086 | write(data); never executed (the execution status of this line is deduced): write(data); | - |
| 2087 | len = data.length(); never executed (the execution status of this line is deduced): len = data.length(); | - |
| 2088 | } else { | 0 |
| 2089 | if (do_compress) never evaluated: do_compress | 0 |
| 2090 | xprintf("/Filter /FlateDecode\n>>\nstream\n"); never executed: xprintf("/Filter /FlateDecode\n>>\nstream\n"); | 0 |
| 2091 | else | - |
| 2092 | xprintf(">>\nstream\n"); never executed: xprintf(">>\nstream\n"); | 0 |
| 2093 | len = writeCompressed(data); never executed (the execution status of this line is deduced): len = writeCompressed(data); | - |
| 2094 | } | 0 |
| 2095 | xprintf("endstream\n" never executed (the execution status of this line is deduced): xprintf("endstream\n" | - |
| 2096 | "endobj\n"); never executed (the execution status of this line is deduced): "endobj\n"); | - |
| 2097 | addXrefEntry(lenobj); never executed (the execution status of this line is deduced): addXrefEntry(lenobj); | - |
| 2098 | xprintf("%d\n" never executed (the execution status of this line is deduced): xprintf("%d\n" | - |
| 2099 | "endobj\n", len); never executed (the execution status of this line is deduced): "endobj\n", len); | - |
| 2100 | return image; never executed: return image; | 0 |
| 2101 | } | - |
| 2102 | | - |
| 2103 | #ifdef USE_NATIVE_GRADIENTS | - |
| 2104 | int QPdfEnginePrivate::gradientBrush(const QBrush &b, const QMatrix &matrix, int *gStateObject) | - |
| 2105 | { | - |
| 2106 | const QGradient *gradient = b.gradient(); | - |
| 2107 | if (!gradient) | - |
| 2108 | return 0; | - |
| 2109 | | - |
| 2110 | QTransform inv = matrix.inverted(); | - |
| 2111 | QPointF page_rect[4] = { inv.map(QPointF(0, 0)), | - |
| 2112 | inv.map(QPointF(width_, 0)), | - |
| 2113 | inv.map(QPointF(0, height_)), | - |
| 2114 | inv.map(QPointF(width_, height_)) }; | - |
| 2115 | | - |
| 2116 | bool opaque = b.isOpaque(); | - |
| 2117 | | - |
| 2118 | QByteArray shader; | - |
| 2119 | QByteArray alphaShader; | - |
| 2120 | if (gradient->type() == QGradient::LinearGradient) { | - |
| 2121 | const QLinearGradient *lg = static_cast<const QLinearGradient *>(gradient); | - |
| 2122 | shader = QPdf::generateLinearGradientShader(lg, page_rect); | - |
| 2123 | if (!opaque) | - |
| 2124 | alphaShader = QPdf::generateLinearGradientShader(lg, page_rect, true); | - |
| 2125 | } else { | - |
| 2126 | // ############# | - |
| 2127 | return 0; | - |
| 2128 | } | - |
| 2129 | int shaderObject = addXrefEntry(-1); | - |
| 2130 | write(shader); | - |
| 2131 | | - |
| 2132 | QByteArray str; | - |
| 2133 | QPdf::ByteStream s(&str); | - |
| 2134 | s << "<<\n" | - |
| 2135 | "/Type /Pattern\n" | - |
| 2136 | "/PatternType 2\n" | - |
| 2137 | "/Shading " << shaderObject << "0 R\n" | - |
| 2138 | "/Matrix [" | - |
| 2139 | << matrix.m11() | - |
| 2140 | << matrix.m12() | - |
| 2141 | << matrix.m21() | - |
| 2142 | << matrix.m22() | - |
| 2143 | << matrix.dx() | - |
| 2144 | << matrix.dy() << "]\n"; | - |
| 2145 | s << ">>\n" | - |
| 2146 | "endobj\n"; | - |
| 2147 | | - |
| 2148 | int patternObj = addXrefEntry(-1); | - |
| 2149 | write(str); | - |
| 2150 | currentPage->patterns.append(patternObj); | - |
| 2151 | | - |
| 2152 | if (!opaque) { | - |
| 2153 | bool ca = true; | - |
| 2154 | QGradientStops stops = gradient->stops(); | - |
| 2155 | int a = stops.at(0).second.alpha(); | - |
| 2156 | for (int i = 1; i < stops.size(); ++i) { | - |
| 2157 | if (stops.at(i).second.alpha() != a) { | - |
| 2158 | ca = false; | - |
| 2159 | break; | - |
| 2160 | } | - |
| 2161 | } | - |
| 2162 | if (ca) { | - |
| 2163 | *gStateObject = addConstantAlphaObject(stops.at(0).second.alpha()); | - |
| 2164 | } else { | - |
| 2165 | int alphaShaderObject = addXrefEntry(-1); | - |
| 2166 | write(alphaShader); | - |
| 2167 | | - |
| 2168 | QByteArray content; | - |
| 2169 | QPdf::ByteStream c(&content); | - |
| 2170 | c << "/Shader" << alphaShaderObject << "sh\n"; | - |
| 2171 | | - |
| 2172 | QByteArray form; | - |
| 2173 | QPdf::ByteStream f(&form); | - |
| 2174 | f << "<<\n" | - |
| 2175 | "/Type /XObject\n" | - |
| 2176 | "/Subtype /Form\n" | - |
| 2177 | "/BBox [0 0 " << width_ << height_ << "]\n" | - |
| 2178 | "/Group <</S /Transparency >>\n" | - |
| 2179 | "/Resources <<\n" | - |
| 2180 | "/Shading << /Shader" << alphaShaderObject << alphaShaderObject << "0 R >>\n" | - |
| 2181 | ">>\n"; | - |
| 2182 | | - |
| 2183 | f << "/Length " << content.length() << "\n" | - |
| 2184 | ">>\n" | - |
| 2185 | "stream\n" | - |
| 2186 | << content | - |
| 2187 | << "endstream\n" | - |
| 2188 | "endobj\n"; | - |
| 2189 | | - |
| 2190 | int softMaskFormObject = addXrefEntry(-1); | - |
| 2191 | write(form); | - |
| 2192 | *gStateObject = addXrefEntry(-1); | - |
| 2193 | xprintf("<< /SMask << /S /Alpha /G %d 0 R >> >>\n" | - |
| 2194 | "endobj\n", softMaskFormObject); | - |
| 2195 | currentPage->graphicStates.append(*gStateObject); | - |
| 2196 | } | - |
| 2197 | } | - |
| 2198 | | - |
| 2199 | return patternObj; | - |
| 2200 | } | - |
| 2201 | #endif | - |
| 2202 | | - |
| 2203 | int QPdfEnginePrivate::addConstantAlphaObject(int brushAlpha, int penAlpha) | - |
| 2204 | { | - |
| 2205 | if (brushAlpha == 255 && penAlpha == 255) never evaluated: brushAlpha == 255 never evaluated: penAlpha == 255 | 0 |
| 2206 | return 0; never executed: return 0; | 0 |
| 2207 | int object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0); never executed (the execution status of this line is deduced): int object = alphaCache.value(QPair<uint, uint>(brushAlpha, penAlpha), 0); | - |
| 2208 | if (!object) { | 0 |
| 2209 | object = addXrefEntry(-1); never executed (the execution status of this line is deduced): object = addXrefEntry(-1); | - |
| 2210 | QByteArray alphaDef; never executed (the execution status of this line is deduced): QByteArray alphaDef; | - |
| 2211 | QPdf::ByteStream s(&alphaDef); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&alphaDef); | - |
| 2212 | s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n'; never executed (the execution status of this line is deduced): s << "<<\n/ca " << (brushAlpha/qreal(255.)) << '\n'; | - |
| 2213 | s << "/CA " << (penAlpha/qreal(255.)) << "\n>>"; never executed (the execution status of this line is deduced): s << "/CA " << (penAlpha/qreal(255.)) << "\n>>"; | - |
| 2214 | xprintf("%s\nendobj\n", alphaDef.constData()); never executed (the execution status of this line is deduced): xprintf("%s\nendobj\n", alphaDef.constData()); | - |
| 2215 | alphaCache.insert(QPair<uint, uint>(brushAlpha, penAlpha), object); never executed (the execution status of this line is deduced): alphaCache.insert(QPair<uint, uint>(brushAlpha, penAlpha), object); | - |
| 2216 | } | 0 |
| 2217 | if (currentPage->graphicStates.indexOf(object) < 0) never evaluated: currentPage->graphicStates.indexOf(object) < 0 | 0 |
| 2218 | currentPage->graphicStates.append(object); never executed: currentPage->graphicStates.append(object); | 0 |
| 2219 | | - |
| 2220 | return object; never executed: return object; | 0 |
| 2221 | } | - |
| 2222 | | - |
| 2223 | int QPdfEnginePrivate::addBrushPattern(const QTransform &m, bool *specifyColor, int *gStateObject) | - |
| 2224 | { | - |
| 2225 | int paintType = 2; // Uncolored tiling never executed (the execution status of this line is deduced): int paintType = 2; | - |
| 2226 | int w = 8; never executed (the execution status of this line is deduced): int w = 8; | - |
| 2227 | int h = 8; never executed (the execution status of this line is deduced): int h = 8; | - |
| 2228 | | - |
| 2229 | *specifyColor = true; never executed (the execution status of this line is deduced): *specifyColor = true; | - |
| 2230 | *gStateObject = 0; never executed (the execution status of this line is deduced): *gStateObject = 0; | - |
| 2231 | | - |
| 2232 | QTransform matrix = m; never executed (the execution status of this line is deduced): QTransform matrix = m; | - |
| 2233 | matrix.translate(brushOrigin.x(), brushOrigin.y()); never executed (the execution status of this line is deduced): matrix.translate(brushOrigin.x(), brushOrigin.y()); | - |
| 2234 | matrix = matrix * pageMatrix(); never executed (the execution status of this line is deduced): matrix = matrix * pageMatrix(); | - |
| 2235 | //qDebug() << brushOrigin << matrix; | - |
| 2236 | | - |
| 2237 | Qt::BrushStyle style = brush.style(); never executed (the execution status of this line is deduced): Qt::BrushStyle style = brush.style(); | - |
| 2238 | if (style == Qt::LinearGradientPattern) {// && style <= Qt::ConicalGradientPattern) { never evaluated: style == Qt::LinearGradientPattern | 0 |
| 2239 | #ifdef USE_NATIVE_GRADIENTS | - |
| 2240 | *specifyColor = false; | - |
| 2241 | return gradientBrush(b, matrix, gStateObject); | - |
| 2242 | #else | - |
| 2243 | return 0; never executed: return 0; | 0 |
| 2244 | #endif | - |
| 2245 | } | - |
| 2246 | | - |
| 2247 | if ((!brush.isOpaque() && brush.style() < Qt::LinearGradientPattern) || opacity != 1.0) never evaluated: !brush.isOpaque() never evaluated: brush.style() < Qt::LinearGradientPattern never evaluated: opacity != 1.0 | 0 |
| 2248 | *gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity), never executed: *gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity), qRound(pen.color().alpha() * opacity)); | 0 |
| 2249 | qRound(pen.color().alpha() * opacity)); never executed: *gStateObject = addConstantAlphaObject(qRound(brush.color().alpha() * opacity), qRound(pen.color().alpha() * opacity)); | 0 |
| 2250 | | - |
| 2251 | int imageObject = -1; never executed (the execution status of this line is deduced): int imageObject = -1; | - |
| 2252 | QByteArray pattern = QPdf::patternForBrush(brush); never executed (the execution status of this line is deduced): QByteArray pattern = QPdf::patternForBrush(brush); | - |
| 2253 | if (pattern.isEmpty()) { never evaluated: pattern.isEmpty() | 0 |
| 2254 | if (brush.style() != Qt::TexturePattern) never evaluated: brush.style() != Qt::TexturePattern | 0 |
| 2255 | return 0; never executed: return 0; | 0 |
| 2256 | QImage image = brush.texture().toImage(); never executed (the execution status of this line is deduced): QImage image = brush.texture().toImage(); | - |
| 2257 | bool bitmap = true; never executed (the execution status of this line is deduced): bool bitmap = true; | - |
| 2258 | imageObject = addImage(image, &bitmap, brush.texture().cacheKey()); never executed (the execution status of this line is deduced): imageObject = addImage(image, &bitmap, brush.texture().cacheKey()); | - |
| 2259 | if (imageObject != -1) { never evaluated: imageObject != -1 | 0 |
| 2260 | QImage::Format f = image.format(); never executed (the execution status of this line is deduced): QImage::Format f = image.format(); | - |
| 2261 | if (f != QImage::Format_MonoLSB && f != QImage::Format_Mono) { never evaluated: f != QImage::Format_MonoLSB never evaluated: f != QImage::Format_Mono | 0 |
| 2262 | paintType = 1; // Colored tiling never executed (the execution status of this line is deduced): paintType = 1; | - |
| 2263 | *specifyColor = false; never executed (the execution status of this line is deduced): *specifyColor = false; | - |
| 2264 | } | 0 |
| 2265 | w = image.width(); never executed (the execution status of this line is deduced): w = image.width(); | - |
| 2266 | h = image.height(); never executed (the execution status of this line is deduced): h = image.height(); | - |
| 2267 | QTransform m(w, 0, 0, -h, 0, h); never executed (the execution status of this line is deduced): QTransform m(w, 0, 0, -h, 0, h); | - |
| 2268 | QPdf::ByteStream s(&pattern); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&pattern); | - |
| 2269 | s << QPdf::generateMatrix(m); never executed (the execution status of this line is deduced): s << QPdf::generateMatrix(m); | - |
| 2270 | s << "/Im" << imageObject << " Do\n"; never executed (the execution status of this line is deduced): s << "/Im" << imageObject << " Do\n"; | - |
| 2271 | } | 0 |
| 2272 | } | 0 |
| 2273 | | - |
| 2274 | QByteArray str; never executed (the execution status of this line is deduced): QByteArray str; | - |
| 2275 | QPdf::ByteStream s(&str); never executed (the execution status of this line is deduced): QPdf::ByteStream s(&str); | - |
| 2276 | s << "<<\n" never executed (the execution status of this line is deduced): s << "<<\n" | - |
| 2277 | "/Type /Pattern\n" never executed (the execution status of this line is deduced): "/Type /Pattern\n" | - |
| 2278 | "/PatternType 1\n" never executed (the execution status of this line is deduced): "/PatternType 1\n" | - |
| 2279 | "/PaintType " << paintType << "\n" never executed (the execution status of this line is deduced): "/PaintType " << paintType << "\n" | - |
| 2280 | "/TilingType 1\n" never executed (the execution status of this line is deduced): "/TilingType 1\n" | - |
| 2281 | "/BBox [0 0 " << w << h << "]\n" never executed (the execution status of this line is deduced): "/BBox [0 0 " << w << h << "]\n" | - |
| 2282 | "/XStep " << w << "\n" never executed (the execution status of this line is deduced): "/XStep " << w << "\n" | - |
| 2283 | "/YStep " << h << "\n" never executed (the execution status of this line is deduced): "/YStep " << h << "\n" | - |
| 2284 | "/Matrix [" never executed (the execution status of this line is deduced): "/Matrix [" | - |
| 2285 | << matrix.m11() never executed (the execution status of this line is deduced): << matrix.m11() | - |
| 2286 | << matrix.m12() never executed (the execution status of this line is deduced): << matrix.m12() | - |
| 2287 | << matrix.m21() never executed (the execution status of this line is deduced): << matrix.m21() | - |
| 2288 | << matrix.m22() never executed (the execution status of this line is deduced): << matrix.m22() | - |
| 2289 | << matrix.dx() never executed (the execution status of this line is deduced): << matrix.dx() | - |
| 2290 | << matrix.dy() << "]\n" never executed (the execution status of this line is deduced): << matrix.dy() << "]\n" | - |
| 2291 | "/Resources \n<< "; // open resource tree never executed (the execution status of this line is deduced): "/Resources \n<< "; | - |
| 2292 | if (imageObject > 0) { never evaluated: imageObject > 0 | 0 |
| 2293 | s << "/XObject << /Im" << imageObject << ' ' << imageObject << "0 R >> "; never executed (the execution status of this line is deduced): s << "/XObject << /Im" << imageObject << ' ' << imageObject << "0 R >> "; | - |
| 2294 | } | 0 |
| 2295 | s << ">>\n" never executed (the execution status of this line is deduced): s << ">>\n" | - |
| 2296 | "/Length " << pattern.length() << "\n" never executed (the execution status of this line is deduced): "/Length " << pattern.length() << "\n" | - |
| 2297 | ">>\n" never executed (the execution status of this line is deduced): ">>\n" | - |
| 2298 | "stream\n" never executed (the execution status of this line is deduced): "stream\n" | - |
| 2299 | << pattern never executed (the execution status of this line is deduced): << pattern | - |
| 2300 | << "endstream\n" never executed (the execution status of this line is deduced): << "endstream\n" | - |
| 2301 | "endobj\n"; never executed (the execution status of this line is deduced): "endobj\n"; | - |
| 2302 | | - |
| 2303 | int patternObj = addXrefEntry(-1); never executed (the execution status of this line is deduced): int patternObj = addXrefEntry(-1); | - |
| 2304 | write(str); never executed (the execution status of this line is deduced): write(str); | - |
| 2305 | currentPage->patterns.append(patternObj); never executed (the execution status of this line is deduced): currentPage->patterns.append(patternObj); | - |
| 2306 | return patternObj; never executed: return patternObj; | 0 |
| 2307 | } | - |
| 2308 | | - |
| 2309 | /*! | - |
| 2310 | * Adds an image to the pdf and return the pdf-object id. Returns -1 if adding the image failed. | - |
| 2311 | */ | - |
| 2312 | int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_no) | - |
| 2313 | { | - |
| 2314 | if (img.isNull()) never evaluated: img.isNull() | 0 |
| 2315 | return -1; never executed: return -1; | 0 |
| 2316 | | - |
| 2317 | int object = imageCache.value(serial_no); never executed (the execution status of this line is deduced): int object = imageCache.value(serial_no); | - |
| 2318 | if(object) | 0 |
| 2319 | return object; never executed: return object; | 0 |
| 2320 | | - |
| 2321 | QImage image = img; never executed (the execution status of this line is deduced): QImage image = img; | - |
| 2322 | QImage::Format format = image.format(); never executed (the execution status of this line is deduced): QImage::Format format = image.format(); | - |
| 2323 | if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 never evaluated: image.depth() == 1 never evaluated: *bitmap never evaluated: img.colorTable().size() == 2 | 0 |
| 2324 | && img.colorTable().at(0) == QColor(Qt::black).rgba() never evaluated: img.colorTable().at(0) == QColor(Qt::black).rgba() | 0 |
| 2325 | && img.colorTable().at(1) == QColor(Qt::white).rgba()) never evaluated: img.colorTable().at(1) == QColor(Qt::white).rgba() | 0 |
| 2326 | { | - |
| 2327 | if (format == QImage::Format_MonoLSB) never evaluated: format == QImage::Format_MonoLSB | 0 |
| 2328 | image = image.convertToFormat(QImage::Format_Mono); never executed: image = image.convertToFormat(QImage::Format_Mono); | 0 |
| 2329 | format = QImage::Format_Mono; never executed (the execution status of this line is deduced): format = QImage::Format_Mono; | - |
| 2330 | } else { | 0 |
| 2331 | *bitmap = false; never executed (the execution status of this line is deduced): *bitmap = false; | - |
| 2332 | if (format != QImage::Format_RGB32 && format != QImage::Format_ARGB32) { never evaluated: format != QImage::Format_RGB32 never evaluated: format != QImage::Format_ARGB32 | 0 |
| 2333 | image = image.convertToFormat(QImage::Format_ARGB32); never executed (the execution status of this line is deduced): image = image.convertToFormat(QImage::Format_ARGB32); | - |
| 2334 | format = QImage::Format_ARGB32; never executed (the execution status of this line is deduced): format = QImage::Format_ARGB32; | - |
| 2335 | } | 0 |
| 2336 | } | 0 |
| 2337 | | - |
| 2338 | int w = image.width(); never executed (the execution status of this line is deduced): int w = image.width(); | - |
| 2339 | int h = image.height(); never executed (the execution status of this line is deduced): int h = image.height(); | - |
| 2340 | int d = image.depth(); never executed (the execution status of this line is deduced): int d = image.depth(); | - |
| 2341 | | - |
| 2342 | if (format == QImage::Format_Mono) { never evaluated: format == QImage::Format_Mono | 0 |
| 2343 | int bytesPerLine = (w + 7) >> 3; never executed (the execution status of this line is deduced): int bytesPerLine = (w + 7) >> 3; | - |
| 2344 | QByteArray data; never executed (the execution status of this line is deduced): QByteArray data; | - |
| 2345 | data.resize(bytesPerLine * h); never executed (the execution status of this line is deduced): data.resize(bytesPerLine * h); | - |
| 2346 | char *rawdata = data.data(); never executed (the execution status of this line is deduced): char *rawdata = data.data(); | - |
| 2347 | for (int y = 0; y < h; ++y) { | 0 |
| 2348 | memcpy(rawdata, image.scanLine(y), bytesPerLine); never executed (the execution status of this line is deduced): memcpy(rawdata, image.scanLine(y), bytesPerLine); | - |
| 2349 | rawdata += bytesPerLine; never executed (the execution status of this line is deduced): rawdata += bytesPerLine; | - |
| 2350 | } | 0 |
| 2351 | object = writeImage(data, w, h, d, 0, 0); never executed (the execution status of this line is deduced): object = writeImage(data, w, h, d, 0, 0); | - |
| 2352 | } else { | 0 |
| 2353 | QByteArray softMaskData; never executed (the execution status of this line is deduced): QByteArray softMaskData; | - |
| 2354 | bool dct = false; never executed (the execution status of this line is deduced): bool dct = false; | - |
| 2355 | QByteArray imageData; never executed (the execution status of this line is deduced): QByteArray imageData; | - |
| 2356 | bool hasAlpha = false; never executed (the execution status of this line is deduced): bool hasAlpha = false; | - |
| 2357 | bool hasMask = false; never executed (the execution status of this line is deduced): bool hasMask = false; | - |
| 2358 | | - |
| 2359 | if (QImageWriter::supportedImageFormats().contains("jpeg") && !grayscale) { never evaluated: QImageWriter::supportedImageFormats().contains("jpeg") never evaluated: !grayscale | 0 |
| 2360 | QBuffer buffer(&imageData); never executed (the execution status of this line is deduced): QBuffer buffer(&imageData); | - |
| 2361 | QImageWriter writer(&buffer, "jpeg"); never executed (the execution status of this line is deduced): QImageWriter writer(&buffer, "jpeg"); | - |
| 2362 | writer.setQuality(94); never executed (the execution status of this line is deduced): writer.setQuality(94); | - |
| 2363 | writer.write(image); never executed (the execution status of this line is deduced): writer.write(image); | - |
| 2364 | dct = true; never executed (the execution status of this line is deduced): dct = true; | - |
| 2365 | | - |
| 2366 | if (format != QImage::Format_RGB32) { never evaluated: format != QImage::Format_RGB32 | 0 |
| 2367 | softMaskData.resize(w * h); never executed (the execution status of this line is deduced): softMaskData.resize(w * h); | - |
| 2368 | uchar *sdata = (uchar *)softMaskData.data(); never executed (the execution status of this line is deduced): uchar *sdata = (uchar *)softMaskData.data(); | - |
| 2369 | for (int y = 0; y < h; ++y) { | 0 |
| 2370 | const QRgb *rgb = (const QRgb *)image.scanLine(y); never executed (the execution status of this line is deduced): const QRgb *rgb = (const QRgb *)image.scanLine(y); | - |
| 2371 | for (int x = 0; x < w; ++x) { | 0 |
| 2372 | uchar alpha = qAlpha(*rgb); never executed (the execution status of this line is deduced): uchar alpha = qAlpha(*rgb); | - |
| 2373 | *sdata++ = alpha; never executed (the execution status of this line is deduced): *sdata++ = alpha; | - |
| 2374 | hasMask |= (alpha < 255); never executed (the execution status of this line is deduced): hasMask |= (alpha < 255); | - |
| 2375 | hasAlpha |= (alpha != 0 && alpha != 255); never evaluated: alpha != 0 never evaluated: alpha != 255 | 0 |
| 2376 | ++rgb; never executed (the execution status of this line is deduced): ++rgb; | - |
| 2377 | } | 0 |
| 2378 | } | 0 |
| 2379 | } | 0 |
| 2380 | } else { | 0 |
| 2381 | imageData.resize(grayscale ? w * h : 3 * w * h); never executed (the execution status of this line is deduced): imageData.resize(grayscale ? w * h : 3 * w * h); | - |
| 2382 | uchar *data = (uchar *)imageData.data(); never executed (the execution status of this line is deduced): uchar *data = (uchar *)imageData.data(); | - |
| 2383 | softMaskData.resize(w * h); never executed (the execution status of this line is deduced): softMaskData.resize(w * h); | - |
| 2384 | uchar *sdata = (uchar *)softMaskData.data(); never executed (the execution status of this line is deduced): uchar *sdata = (uchar *)softMaskData.data(); | - |
| 2385 | for (int y = 0; y < h; ++y) { | 0 |
| 2386 | const QRgb *rgb = (const QRgb *)image.scanLine(y); never executed (the execution status of this line is deduced): const QRgb *rgb = (const QRgb *)image.scanLine(y); | - |
| 2387 | if (grayscale) { never evaluated: grayscale | 0 |
| 2388 | for (int x = 0; x < w; ++x) { | 0 |
| 2389 | *(data++) = qGray(*rgb); never executed (the execution status of this line is deduced): *(data++) = qGray(*rgb); | - |
| 2390 | uchar alpha = qAlpha(*rgb); never executed (the execution status of this line is deduced): uchar alpha = qAlpha(*rgb); | - |
| 2391 | *sdata++ = alpha; never executed (the execution status of this line is deduced): *sdata++ = alpha; | - |
| 2392 | hasMask |= (alpha < 255); never executed (the execution status of this line is deduced): hasMask |= (alpha < 255); | - |
| 2393 | hasAlpha |= (alpha != 0 && alpha != 255); never evaluated: alpha != 0 never evaluated: alpha != 255 | 0 |
| 2394 | ++rgb; never executed (the execution status of this line is deduced): ++rgb; | - |
| 2395 | } | 0 |
| 2396 | } else { | 0 |
| 2397 | for (int x = 0; x < w; ++x) { | 0 |
| 2398 | *(data++) = qRed(*rgb); never executed (the execution status of this line is deduced): *(data++) = qRed(*rgb); | - |
| 2399 | *(data++) = qGreen(*rgb); never executed (the execution status of this line is deduced): *(data++) = qGreen(*rgb); | - |
| 2400 | *(data++) = qBlue(*rgb); never executed (the execution status of this line is deduced): *(data++) = qBlue(*rgb); | - |
| 2401 | uchar alpha = qAlpha(*rgb); never executed (the execution status of this line is deduced): uchar alpha = qAlpha(*rgb); | - |
| 2402 | *sdata++ = alpha; never executed (the execution status of this line is deduced): *sdata++ = alpha; | - |
| 2403 | hasMask |= (alpha < 255); never executed (the execution status of this line is deduced): hasMask |= (alpha < 255); | - |
| 2404 | hasAlpha |= (alpha != 0 && alpha != 255); never evaluated: alpha != 0 never evaluated: alpha != 255 | 0 |
| 2405 | ++rgb; never executed (the execution status of this line is deduced): ++rgb; | - |
| 2406 | } | 0 |
| 2407 | } | 0 |
| 2408 | } | - |
| 2409 | if (format == QImage::Format_RGB32) never evaluated: format == QImage::Format_RGB32 | 0 |
| 2410 | hasAlpha = hasMask = false; never executed: hasAlpha = hasMask = false; | 0 |
| 2411 | } | 0 |
| 2412 | int maskObject = 0; never executed (the execution status of this line is deduced): int maskObject = 0; | - |
| 2413 | int softMaskObject = 0; never executed (the execution status of this line is deduced): int softMaskObject = 0; | - |
| 2414 | if (hasAlpha) { never evaluated: hasAlpha | 0 |
| 2415 | softMaskObject = writeImage(softMaskData, w, h, 8, 0, 0); never executed (the execution status of this line is deduced): softMaskObject = writeImage(softMaskData, w, h, 8, 0, 0); | - |
| 2416 | } else if (hasMask) { never executed: } never evaluated: hasMask | 0 |
| 2417 | // dither the soft mask to 1bit and add it. This also helps PDF viewers | - |
| 2418 | // without transparency support | - |
| 2419 | int bytesPerLine = (w + 7) >> 3; never executed (the execution status of this line is deduced): int bytesPerLine = (w + 7) >> 3; | - |
| 2420 | QByteArray mask(bytesPerLine * h, 0); never executed (the execution status of this line is deduced): QByteArray mask(bytesPerLine * h, 0); | - |
| 2421 | uchar *mdata = (uchar *)mask.data(); never executed (the execution status of this line is deduced): uchar *mdata = (uchar *)mask.data(); | - |
| 2422 | const uchar *sdata = (const uchar *)softMaskData.constData(); never executed (the execution status of this line is deduced): const uchar *sdata = (const uchar *)softMaskData.constData(); | - |
| 2423 | for (int y = 0; y < h; ++y) { | 0 |
| 2424 | for (int x = 0; x < w; ++x) { | 0 |
| 2425 | if (*sdata) | 0 |
| 2426 | mdata[x>>3] |= (0x80 >> (x&7)); never executed: mdata[x>>3] |= (0x80 >> (x&7)); | 0 |
| 2427 | ++sdata; never executed (the execution status of this line is deduced): ++sdata; | - |
| 2428 | } | 0 |
| 2429 | mdata += bytesPerLine; never executed (the execution status of this line is deduced): mdata += bytesPerLine; | - |
| 2430 | } | 0 |
| 2431 | maskObject = writeImage(mask, w, h, 1, 0, 0); never executed (the execution status of this line is deduced): maskObject = writeImage(mask, w, h, 1, 0, 0); | - |
| 2432 | } | 0 |
| 2433 | object = writeImage(imageData, w, h, grayscale ? 8 : 32, never executed (the execution status of this line is deduced): object = writeImage(imageData, w, h, grayscale ? 8 : 32, | - |
| 2434 | maskObject, softMaskObject, dct); never executed (the execution status of this line is deduced): maskObject, softMaskObject, dct); | - |
| 2435 | } | 0 |
| 2436 | imageCache.insert(serial_no, object); never executed (the execution status of this line is deduced): imageCache.insert(serial_no, object); | - |
| 2437 | return object; never executed: return object; | 0 |
| 2438 | } | - |
| 2439 | | - |
| 2440 | void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) | - |
| 2441 | { | - |
| 2442 | Q_Q(QPdfEngine); never executed (the execution status of this line is deduced): QPdfEngine * const q = q_func(); | - |
| 2443 | | - |
| 2444 | if (ti.charFormat.isAnchor()) { never evaluated: ti.charFormat.isAnchor() | 0 |
| 2445 | qreal size = ti.fontEngine->fontDef.pixelSize; never executed (the execution status of this line is deduced): qreal size = ti.fontEngine->fontDef.pixelSize; | - |
| 2446 | int synthesized = ti.fontEngine->synthesized(); never executed (the execution status of this line is deduced): int synthesized = ti.fontEngine->synthesized(); | - |
| 2447 | qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.; never evaluated: synthesized & QFontEngine::SynthesizedStretch | 0 |
| 2448 | | - |
| 2449 | QTransform trans; never executed (the execution status of this line is deduced): QTransform trans; | - |
| 2450 | // Build text rendering matrix (Trm). We need it to map the text area to user | - |
| 2451 | // space units on the PDF page. | - |
| 2452 | trans = QTransform(size*stretch, 0, 0, size, 0, 0); never executed (the execution status of this line is deduced): trans = QTransform(size*stretch, 0, 0, size, 0, 0); | - |
| 2453 | // Apply text matrix (Tm). | - |
| 2454 | trans *= QTransform(1,0,0,-1,p.x(),p.y()); never executed (the execution status of this line is deduced): trans *= QTransform(1,0,0,-1,p.x(),p.y()); | - |
| 2455 | // Apply page displacement (Identity for first page). | - |
| 2456 | trans *= stroker.matrix; never executed (the execution status of this line is deduced): trans *= stroker.matrix; | - |
| 2457 | // Apply Current Transformation Matrix (CTM) | - |
| 2458 | trans *= pageMatrix(); never executed (the execution status of this line is deduced): trans *= pageMatrix(); | - |
| 2459 | qreal x1, y1, x2, y2; never executed (the execution status of this line is deduced): qreal x1, y1, x2, y2; | - |
| 2460 | trans.map(0, 0, &x1, &y1); never executed (the execution status of this line is deduced): trans.map(0, 0, &x1, &y1); | - |
| 2461 | trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2); never executed (the execution status of this line is deduced): trans.map(ti.width.toReal()/size, (ti.ascent.toReal()-ti.descent.toReal())/size, &x2, &y2); | - |
| 2462 | | - |
| 2463 | uint annot = addXrefEntry(-1); never executed (the execution status of this line is deduced): uint annot = addXrefEntry(-1); | - |
| 2464 | QByteArray x1s, y1s, x2s, y2s; never executed (the execution status of this line is deduced): QByteArray x1s, y1s, x2s, y2s; | - |
| 2465 | x1s.setNum(static_cast<double>(x1), 'f'); never executed (the execution status of this line is deduced): x1s.setNum(static_cast<double>(x1), 'f'); | - |
| 2466 | y1s.setNum(static_cast<double>(y1), 'f'); never executed (the execution status of this line is deduced): y1s.setNum(static_cast<double>(y1), 'f'); | - |
| 2467 | x2s.setNum(static_cast<double>(x2), 'f'); never executed (the execution status of this line is deduced): x2s.setNum(static_cast<double>(x2), 'f'); | - |
| 2468 | y2s.setNum(static_cast<double>(y2), 'f'); never executed (the execution status of this line is deduced): y2s.setNum(static_cast<double>(y2), 'f'); | - |
| 2469 | QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s; never executed (the execution status of this line is deduced): QByteArray rectData = x1s + ' ' + y1s + ' ' + x2s + ' ' + y2s; | - |
| 2470 | xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); never executed (the execution status of this line is deduced): xprintf("<<\n/Type /Annot\n/Subtype /Link\n/Rect ["); | - |
| 2471 | xprintf(rectData.constData()); never executed (the execution status of this line is deduced): xprintf(rectData.constData()); | - |
| 2472 | #ifdef Q_DEBUG_PDF_LINKS | - |
| 2473 | xprintf("]\n/Border [16 16 1]\n/A <<\n"); | - |
| 2474 | #else | - |
| 2475 | xprintf("]\n/Border [0 0 0]\n/A <<\n"); never executed (the execution status of this line is deduced): xprintf("]\n/Border [0 0 0]\n/A <<\n"); | - |
| 2476 | #endif | - |
| 2477 | xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", never executed (the execution status of this line is deduced): xprintf("/Type /Action\n/S /URI\n/URI (%s)\n", | - |
| 2478 | ti.charFormat.anchorHref().toLatin1().constData()); never executed (the execution status of this line is deduced): ti.charFormat.anchorHref().toLatin1().constData()); | - |
| 2479 | xprintf(">>\n>>\n"); never executed (the execution status of this line is deduced): xprintf(">>\n>>\n"); | - |
| 2480 | xprintf("endobj\n"); never executed (the execution status of this line is deduced): xprintf("endobj\n"); | - |
| 2481 | | - |
| 2482 | if (!currentPage->annotations.contains(annot)) { never evaluated: !currentPage->annotations.contains(annot) | 0 |
| 2483 | currentPage->annotations.append(annot); never executed (the execution status of this line is deduced): currentPage->annotations.append(annot); | - |
| 2484 | } | 0 |
| 2485 | } | 0 |
| 2486 | | - |
| 2487 | QFontEngine *fe = ti.fontEngine; never executed (the execution status of this line is deduced): QFontEngine *fe = ti.fontEngine; | - |
| 2488 | | - |
| 2489 | QFontEngine::FaceId face_id = fe->faceId(); never executed (the execution status of this line is deduced): QFontEngine::FaceId face_id = fe->faceId(); | - |
| 2490 | bool noEmbed = false; never executed (the execution status of this line is deduced): bool noEmbed = false; | - |
| 2491 | if (face_id.filename.isEmpty() never evaluated: face_id.filename.isEmpty() | 0 |
| 2492 | || (!postscript && ((fe->fsType & 0x200) /* bitmap embedding only */ never evaluated: !postscript never evaluated: (fe->fsType & 0x200) | 0 |
| 2493 | || (fe->fsType == 2) /* no embedding allowed */))) { never evaluated: (fe->fsType == 2) | 0 |
| 2494 | *currentPage << "Q\n"; never executed (the execution status of this line is deduced): *currentPage << "Q\n"; | - |
| 2495 | q->QPaintEngine::drawTextItem(p, ti); never executed (the execution status of this line is deduced): q->QPaintEngine::drawTextItem(p, ti); | - |
| 2496 | *currentPage << "q\n"; never executed (the execution status of this line is deduced): *currentPage << "q\n"; | - |
| 2497 | if (face_id.filename.isEmpty()) never evaluated: face_id.filename.isEmpty() | 0 |
| 2498 | return; | 0 |
| 2499 | noEmbed = true; never executed (the execution status of this line is deduced): noEmbed = true; | - |
| 2500 | } | 0 |
| 2501 | | - |
| 2502 | QFontSubset *font = fonts.value(face_id, 0); never executed (the execution status of this line is deduced): QFontSubset *font = fonts.value(face_id, 0); | - |
| 2503 | if (!font) { | 0 |
| 2504 | font = new QFontSubset(fe, requestObject()); never executed (the execution status of this line is deduced): font = new QFontSubset(fe, requestObject()); | - |
| 2505 | font->noEmbed = noEmbed; never executed (the execution status of this line is deduced): font->noEmbed = noEmbed; | - |
| 2506 | } | 0 |
| 2507 | fonts.insert(face_id, font); never executed (the execution status of this line is deduced): fonts.insert(face_id, font); | - |
| 2508 | | - |
| 2509 | if (!currentPage->fonts.contains(font->object_id)) never evaluated: !currentPage->fonts.contains(font->object_id) | 0 |
| 2510 | currentPage->fonts.append(font->object_id); never executed: currentPage->fonts.append(font->object_id); | 0 |
| 2511 | | - |
| 2512 | qreal size = ti.fontEngine->fontDef.pixelSize; never executed (the execution status of this line is deduced): qreal size = ti.fontEngine->fontDef.pixelSize; | - |
| 2513 | | - |
| 2514 | QVarLengthArray<glyph_t> glyphs; never executed (the execution status of this line is deduced): QVarLengthArray<glyph_t> glyphs; | - |
| 2515 | QVarLengthArray<QFixedPoint> positions; never executed (the execution status of this line is deduced): QVarLengthArray<QFixedPoint> positions; | - |
| 2516 | QTransform m = QTransform::fromTranslate(p.x(), p.y()); never executed (the execution status of this line is deduced): QTransform m = QTransform::fromTranslate(p.x(), p.y()); | - |
| 2517 | ti.fontEngine->getGlyphPositions(ti.glyphs, m, ti.flags, never executed (the execution status of this line is deduced): ti.fontEngine->getGlyphPositions(ti.glyphs, m, ti.flags, | - |
| 2518 | glyphs, positions); never executed (the execution status of this line is deduced): glyphs, positions); | - |
| 2519 | if (glyphs.size() == 0) never evaluated: glyphs.size() == 0 | 0 |
| 2520 | return; | 0 |
| 2521 | int synthesized = ti.fontEngine->synthesized(); never executed (the execution status of this line is deduced): int synthesized = ti.fontEngine->synthesized(); | - |
| 2522 | qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.; never evaluated: synthesized & QFontEngine::SynthesizedStretch | 0 |
| 2523 | | - |
| 2524 | *currentPage << "BT\n" never executed (the execution status of this line is deduced): *currentPage << "BT\n" | - |
| 2525 | << "/F" << font->object_id << size << "Tf " never executed (the execution status of this line is deduced): << "/F" << font->object_id << size << "Tf " | - |
| 2526 | << stretch << (synthesized & QFontEngine::SynthesizedItalic never executed (the execution status of this line is deduced): << stretch << (synthesized & QFontEngine::SynthesizedItalic | - |
| 2527 | ? "0 .3 -1 0 0 Tm\n" never executed (the execution status of this line is deduced): ? "0 .3 -1 0 0 Tm\n" | - |
| 2528 | : "0 0 -1 0 0 Tm\n"); never executed (the execution status of this line is deduced): : "0 0 -1 0 0 Tm\n"); | - |
| 2529 | | - |
| 2530 | | - |
| 2531 | #if 0 | - |
| 2532 | // #### implement actual text for complex languages | - |
| 2533 | const unsigned short *logClusters = ti.logClusters; | - |
| 2534 | int pos = 0; | - |
| 2535 | do { | - |
| 2536 | int end = pos + 1; | - |
| 2537 | while (end < ti.num_chars && logClusters[end] == logClusters[pos]) | - |
| 2538 | ++end; | - |
| 2539 | *currentPage << "/Span << /ActualText <FEFF"; | - |
| 2540 | for (int i = pos; i < end; ++i) { | - |
| 2541 | s << toHex((ushort)ti.chars[i].unicode(), buf); | - |
| 2542 | } | - |
| 2543 | *currentPage << "> >>\n" | - |
| 2544 | "BDC\n" | - |
| 2545 | "<"; | - |
| 2546 | int ge = end == ti.num_chars ? ti.num_glyphs : logClusters[end]; | - |
| 2547 | for (int gs = logClusters[pos]; gs < ge; ++gs) | - |
| 2548 | *currentPage << toHex((ushort)ti.glyphs[gs].glyph, buf); | - |
| 2549 | *currentPage << "> Tj\n" | - |
| 2550 | "EMC\n"; | - |
| 2551 | pos = end; | - |
| 2552 | } while (pos < ti.num_chars); | - |
| 2553 | #else | - |
| 2554 | qreal last_x = 0.; never executed (the execution status of this line is deduced): qreal last_x = 0.; | - |
| 2555 | qreal last_y = 0.; never executed (the execution status of this line is deduced): qreal last_y = 0.; | - |
| 2556 | for (int i = 0; i < glyphs.size(); ++i) { never evaluated: i < glyphs.size() | 0 |
| 2557 | qreal x = positions[i].x.toReal(); never executed (the execution status of this line is deduced): qreal x = positions[i].x.toReal(); | - |
| 2558 | qreal y = positions[i].y.toReal(); never executed (the execution status of this line is deduced): qreal y = positions[i].y.toReal(); | - |
| 2559 | if (synthesized & QFontEngine::SynthesizedItalic) never evaluated: synthesized & QFontEngine::SynthesizedItalic | 0 |
| 2560 | x += .3*y; never executed: x += .3*y; | 0 |
| 2561 | x /= stretch; never executed (the execution status of this line is deduced): x /= stretch; | - |
| 2562 | char buf[5]; never executed (the execution status of this line is deduced): char buf[5]; | - |
| 2563 | int g = font->addGlyph(glyphs[i]); never executed (the execution status of this line is deduced): int g = font->addGlyph(glyphs[i]); | - |
| 2564 | *currentPage << x - last_x << last_y - y << "Td <" never executed (the execution status of this line is deduced): *currentPage << x - last_x << last_y - y << "Td <" | - |
| 2565 | << QPdf::toHex((ushort)g, buf) << "> Tj\n"; never executed (the execution status of this line is deduced): << QPdf::toHex((ushort)g, buf) << "> Tj\n"; | - |
| 2566 | last_x = x; never executed (the execution status of this line is deduced): last_x = x; | - |
| 2567 | last_y = y; never executed (the execution status of this line is deduced): last_y = y; | - |
| 2568 | } | 0 |
| 2569 | if (synthesized & QFontEngine::SynthesizedBold) { never evaluated: synthesized & QFontEngine::SynthesizedBold | 0 |
| 2570 | *currentPage << stretch << (synthesized & QFontEngine::SynthesizedItalic never executed (the execution status of this line is deduced): *currentPage << stretch << (synthesized & QFontEngine::SynthesizedItalic | - |
| 2571 | ? "0 .3 -1 0 0 Tm\n" never executed (the execution status of this line is deduced): ? "0 .3 -1 0 0 Tm\n" | - |
| 2572 | : "0 0 -1 0 0 Tm\n"); never executed (the execution status of this line is deduced): : "0 0 -1 0 0 Tm\n"); | - |
| 2573 | *currentPage << "/Span << /ActualText <> >> BDC\n"; never executed (the execution status of this line is deduced): *currentPage << "/Span << /ActualText <> >> BDC\n"; | - |
| 2574 | last_x = 0.5*fe->lineThickness().toReal(); never executed (the execution status of this line is deduced): last_x = 0.5*fe->lineThickness().toReal(); | - |
| 2575 | last_y = 0.; never executed (the execution status of this line is deduced): last_y = 0.; | - |
| 2576 | for (int i = 0; i < glyphs.size(); ++i) { never evaluated: i < glyphs.size() | 0 |
| 2577 | qreal x = positions[i].x.toReal(); never executed (the execution status of this line is deduced): qreal x = positions[i].x.toReal(); | - |
| 2578 | qreal y = positions[i].y.toReal(); never executed (the execution status of this line is deduced): qreal y = positions[i].y.toReal(); | - |
| 2579 | if (synthesized & QFontEngine::SynthesizedItalic) never evaluated: synthesized & QFontEngine::SynthesizedItalic | 0 |
| 2580 | x += .3*y; never executed: x += .3*y; | 0 |
| 2581 | x /= stretch; never executed (the execution status of this line is deduced): x /= stretch; | - |
| 2582 | char buf[5]; never executed (the execution status of this line is deduced): char buf[5]; | - |
| 2583 | int g = font->addGlyph(glyphs[i]); never executed (the execution status of this line is deduced): int g = font->addGlyph(glyphs[i]); | - |
| 2584 | *currentPage << x - last_x << last_y - y << "Td <" never executed (the execution status of this line is deduced): *currentPage << x - last_x << last_y - y << "Td <" | - |
| 2585 | << QPdf::toHex((ushort)g, buf) << "> Tj\n"; never executed (the execution status of this line is deduced): << QPdf::toHex((ushort)g, buf) << "> Tj\n"; | - |
| 2586 | last_x = x; never executed (the execution status of this line is deduced): last_x = x; | - |
| 2587 | last_y = y; never executed (the execution status of this line is deduced): last_y = y; | - |
| 2588 | } | 0 |
| 2589 | *currentPage << "EMC\n"; never executed (the execution status of this line is deduced): *currentPage << "EMC\n"; | - |
| 2590 | } | 0 |
| 2591 | #endif | - |
| 2592 | | - |
| 2593 | *currentPage << "ET\n"; never executed (the execution status of this line is deduced): *currentPage << "ET\n"; | - |
| 2594 | } | 0 |
| 2595 | | - |
| 2596 | QTransform QPdfEnginePrivate::pageMatrix() const | - |
| 2597 | { | - |
| 2598 | qreal scale = 72./resolution; executed (the execution status of this line is deduced): qreal scale = 72./resolution; | - |
| 2599 | QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height()); executed (the execution status of this line is deduced): QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height()); | - |
| 2600 | if (!fullPage) { evaluated: !fullPage| yes Evaluation Count:18 | yes Evaluation Count:2 |
| 2-18 |
| 2601 | QRect r = pageRect(); executed (the execution status of this line is deduced): QRect r = pageRect(); | - |
| 2602 | tmp.translate(r.left(), r.top()); executed (the execution status of this line is deduced): tmp.translate(r.left(), r.top()); | - |
| 2603 | } executed: }Execution Count:18 | 18 |
| 2604 | return tmp; executed: return tmp;Execution Count:20 | 20 |
| 2605 | } | - |
| 2606 | | - |
| 2607 | void QPdfEnginePrivate::newPage() | - |
| 2608 | { | - |
| 2609 | if (currentPage && currentPage->pageSize.isEmpty()) partially evaluated: currentPage| yes Evaluation Count:20 | no Evaluation Count:0 |
partially evaluated: currentPage->pageSize.isEmpty()| yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
| 2610 | currentPage->pageSize = QSize(width(), height()); executed: currentPage->pageSize = QSize(width(), height());Execution Count:20 | 20 |
| 2611 | writePage(); executed (the execution status of this line is deduced): writePage(); | - |
| 2612 | | - |
| 2613 | delete currentPage; executed (the execution status of this line is deduced): delete currentPage; | - |
| 2614 | currentPage = new QPdfPage; executed (the execution status of this line is deduced): currentPage = new QPdfPage; | - |
| 2615 | currentPage->pageSize = QSize(width(), height()); executed (the execution status of this line is deduced): currentPage->pageSize = QSize(width(), height()); | - |
| 2616 | stroker.stream = currentPage; executed (the execution status of this line is deduced): stroker.stream = currentPage; | - |
| 2617 | pages.append(requestObject()); executed (the execution status of this line is deduced): pages.append(requestObject()); | - |
| 2618 | | - |
| 2619 | *currentPage << "/GSa gs /CSp cs /CSp CS\n" executed (the execution status of this line is deduced): *currentPage << "/GSa gs /CSp cs /CSp CS\n" | - |
| 2620 | << QPdf::generateMatrix(pageMatrix()) executed (the execution status of this line is deduced): << QPdf::generateMatrix(pageMatrix()) | - |
| 2621 | << "q q\n"; executed (the execution status of this line is deduced): << "q q\n"; | - |
| 2622 | } executed: }Execution Count:20 | 20 |
| 2623 | | - |
| 2624 | | - |
| 2625 | QT_END_NAMESPACE | - |
| 2626 | | - |
| | |