| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickborderimage.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | QQuickBorderImage::QQuickBorderImage(QQuickItem *parent) | - | ||||||||||||||||||
| 8 | : QQuickImageBase(*(new QQuickBorderImagePrivate), parent) | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | } executed 138 times by 2 tests: end of blockExecuted by:
| 138 | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | QQuickBorderImage::~QQuickBorderImage() | - | ||||||||||||||||||
| 13 | { | - | ||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 16 | if (d->sciReply
| 2-136 | ||||||||||||||||||
| 17 | d->sciReply->deleteLater(); executed 2 times by 1 test: d->sciReply->deleteLater();Executed by:
| 2 | ||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | } executed 138 times by 2 tests: end of blockExecuted by:
| 138 | ||||||||||||||||||
| 20 | void QQuickBorderImage::setSource(const QUrl &url) | - | ||||||||||||||||||
| 21 | { | - | ||||||||||||||||||
| 22 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | if (url == d->url
| 14-156 | ||||||||||||||||||
| 25 | return; executed 14 times by 1 test: return;Executed by:
| 14 | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | if (d->sciReply
| 0-156 | ||||||||||||||||||
| 29 | d->sciReply->deleteLater(); | - | ||||||||||||||||||
| 30 | d->sciReply = nullptr; | - | ||||||||||||||||||
| 31 | } never executed: end of block | 0 | ||||||||||||||||||
| 32 | - | |||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | d->url = url; | - | ||||||||||||||||||
| 35 | d->sciurl = QUrl(); | - | ||||||||||||||||||
| 36 | sourceChanged(d->url); | - | ||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | if (isComponentComplete()
| 32-124 | ||||||||||||||||||
| 39 | load(); executed 32 times by 1 test: load();Executed by:
| 32 | ||||||||||||||||||
| 40 | } executed 156 times by 2 tests: end of blockExecuted by:
| 156 | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | void QQuickBorderImage::load() | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | if (d->url.isEmpty()
| 8-148 | ||||||||||||||||||
| 47 | d->pix.clear(this); | - | ||||||||||||||||||
| 48 | d->status = Null; | - | ||||||||||||||||||
| 49 | setImplicitSize(0, 0); | - | ||||||||||||||||||
| 50 | statusChanged(d->status); | - | ||||||||||||||||||
| 51 | if (d->progress != 0.0
| 0-8 | ||||||||||||||||||
| 52 | d->progress = 0.0; | - | ||||||||||||||||||
| 53 | progressChanged(d->progress); | - | ||||||||||||||||||
| 54 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 55 | if (sourceSize() != d->oldSourceSize
| 0-8 | ||||||||||||||||||
| 56 | d->oldSourceSize = sourceSize(); | - | ||||||||||||||||||
| 57 | sourceSizeChanged(); | - | ||||||||||||||||||
| 58 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 59 | pixmapChange(); | - | ||||||||||||||||||
| 60 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||
| 61 | } else { | - | ||||||||||||||||||
| 62 | if (d->url.path().endsWith(QLatin1String("sci"))
| 30-118 | ||||||||||||||||||
| 63 | QString lf = QQmlFile::urlToLocalFileOrQrc(d->url); | - | ||||||||||||||||||
| 64 | if (!lf.isEmpty()
| 10-20 | ||||||||||||||||||
| 65 | QFile file(lf); | - | ||||||||||||||||||
| 66 | file.open(QIODevice::ReadOnly); | - | ||||||||||||||||||
| 67 | setGridScaledImage(QQuickGridScaledImage(&file)); | - | ||||||||||||||||||
| 68 | return; executed 20 times by 2 tests: return;Executed by:
| 20 | ||||||||||||||||||
| 69 | } else { | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | if (d->progress != 0.0
| 0-10 | ||||||||||||||||||
| 72 | d->progress = 0.0; | - | ||||||||||||||||||
| 73 | progressChanged(d->progress); | - | ||||||||||||||||||
| 74 | } never executed: end of block | 0 | ||||||||||||||||||
| 75 | d->status = Loading; | - | ||||||||||||||||||
| 76 | QNetworkRequest req(d->url); | - | ||||||||||||||||||
| 77 | d->sciReply = qmlEngine(this)->networkAccessManager()->get(req); | - | ||||||||||||||||||
| 78 | { QNetworkReply *sender = (d->sciReply); QQuickBorderImage *receiver = (this); const char *signal = (qFlagLocation("2""finished()" "\0" __FILE__ ":" "330")); const char *method = (qFlagLocation("1""sciRequestFinished()" "\0" __FILE__ ":" "330")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 2-8 | ||||||||||||||||||
| 79 | __FILE__ | - | ||||||||||||||||||
| 80 | , | - | ||||||||||||||||||
| 81 | 330 | - | ||||||||||||||||||
| 82 | )); signalIdx = QNetworkReply::staticMetaObject.indexOfSignal(signal+1); } executed 2 times by 1 test: if (methodIdx < 0end of blockExecuted by:
| 2-8 | ||||||||||||||||||
| 83 | __FILE__ | - | ||||||||||||||||||
| 84 | , | - | ||||||||||||||||||
| 85 | 330 | - | ||||||||||||||||||
| 86 | )); if (code == 1
executed 2 times by 1 test: else methodIdx = QQuickBorderImage::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickBorderImage::staticMetaObject.indexOfSlot(method+1);Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickBorderImage::staticMetaObject.indexOfSignal(method+1); | 0-2 | ||||||||||||||||||
| 87 | __FILE__ | - | ||||||||||||||||||
| 88 | , | - | ||||||||||||||||||
| 89 | 330 | - | ||||||||||||||||||
| 90 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 94 | } else { | - | ||||||||||||||||||
| 95 | QQuickPixmap::Options options; | - | ||||||||||||||||||
| 96 | if (d->async
| 0-118 | ||||||||||||||||||
| 97 | options |= QQuickPixmap::Asynchronous; never executed: options |= QQuickPixmap::Asynchronous; | 0 | ||||||||||||||||||
| 98 | if (d->cache
| 0-118 | ||||||||||||||||||
| 99 | options |= QQuickPixmap::Cache; executed 118 times by 2 tests: options |= QQuickPixmap::Cache;Executed by:
| 118 | ||||||||||||||||||
| 100 | d->pix.clear(this); | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | const qreal targetDevicePixelRatio = (window()
| 46-72 | ||||||||||||||||||
| 103 | d->devicePixelRatio = 1.0; | - | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | QUrl loadUrl = d->url; | - | ||||||||||||||||||
| 106 | resolve2xLocalFile(d->url, targetDevicePixelRatio, &loadUrl, &d->devicePixelRatio); | - | ||||||||||||||||||
| 107 | d->pix.load(qmlEngine(this), loadUrl, d->sourcesize * d->devicePixelRatio, options); | - | ||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | if (d->pix.isLoading()
| 20-98 | ||||||||||||||||||
| 110 | if (d->progress != 0.0
| 6-14 | ||||||||||||||||||
| 111 | d->progress = 0.0; | - | ||||||||||||||||||
| 112 | progressChanged(d->progress); | - | ||||||||||||||||||
| 113 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 114 | d->status = Loading; | - | ||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | static int thisRequestProgress = -1; | - | ||||||||||||||||||
| 117 | static int thisRequestFinished = -1; | - | ||||||||||||||||||
| 118 | if (thisRequestProgress == -1
| 2-18 | ||||||||||||||||||
| 119 | thisRequestProgress = | - | ||||||||||||||||||
| 120 | QQuickImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)"); | - | ||||||||||||||||||
| 121 | thisRequestFinished = | - | ||||||||||||||||||
| 122 | QQuickImageBase::staticMetaObject.indexOfSlot("requestFinished()"); | - | ||||||||||||||||||
| 123 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 124 | d->pix.connectFinished(this, thisRequestFinished); | - | ||||||||||||||||||
| 125 | d->pix.connectDownloadProgress(this, thisRequestProgress); | - | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | update(); | - | ||||||||||||||||||
| 128 | } executed 20 times by 1 test: else {end of blockExecuted by:
| 20 | ||||||||||||||||||
| 129 | requestFinished(); | - | ||||||||||||||||||
| 130 | return; executed 98 times by 2 tests: return;Executed by:
| 98 | ||||||||||||||||||
| 131 | } | - | ||||||||||||||||||
| 132 | } | - | ||||||||||||||||||
| 133 | } | - | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | statusChanged(d->status); | - | ||||||||||||||||||
| 136 | } executed 30 times by 1 test: end of blockExecuted by:
| 30 | ||||||||||||||||||
| 137 | QQuickScaleGrid *QQuickBorderImage::border() | - | ||||||||||||||||||
| 138 | { | - | ||||||||||||||||||
| 139 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 140 | return executed 138 times by 2 tests: d->getScaleGrid();return d->getScaleGrid();Executed by:
executed 138 times by 2 tests: return d->getScaleGrid();Executed by:
| 138 | ||||||||||||||||||
| 141 | } | - | ||||||||||||||||||
| 142 | QQuickBorderImage::TileMode QQuickBorderImage::horizontalTileMode() const | - | ||||||||||||||||||
| 143 | { | - | ||||||||||||||||||
| 144 | const QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 145 | return executed 32 times by 1 test: d->horizontalTileMode;return d->horizontalTileMode;Executed by:
executed 32 times by 1 test: return d->horizontalTileMode;Executed by:
| 32 | ||||||||||||||||||
| 146 | } | - | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | void QQuickBorderImage::setHorizontalTileMode(TileMode t) | - | ||||||||||||||||||
| 149 | { | - | ||||||||||||||||||
| 150 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 151 | if (t != d->horizontalTileMode
| 2-6 | ||||||||||||||||||
| 152 | d->horizontalTileMode = t; | - | ||||||||||||||||||
| 153 | horizontalTileModeChanged(); | - | ||||||||||||||||||
| 154 | update(); | - | ||||||||||||||||||
| 155 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 156 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | QQuickBorderImage::TileMode QQuickBorderImage::verticalTileMode() const | - | ||||||||||||||||||
| 159 | { | - | ||||||||||||||||||
| 160 | const QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 161 | return executed 32 times by 1 test: d->verticalTileMode;return d->verticalTileMode;Executed by:
executed 32 times by 1 test: return d->verticalTileMode;Executed by:
| 32 | ||||||||||||||||||
| 162 | } | - | ||||||||||||||||||
| 163 | - | |||||||||||||||||||
| 164 | void QQuickBorderImage::setVerticalTileMode(TileMode t) | - | ||||||||||||||||||
| 165 | { | - | ||||||||||||||||||
| 166 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 167 | if (t != d->verticalTileMode
| 2-6 | ||||||||||||||||||
| 168 | d->verticalTileMode = t; | - | ||||||||||||||||||
| 169 | verticalTileModeChanged(); | - | ||||||||||||||||||
| 170 | update(); | - | ||||||||||||||||||
| 171 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 172 | } executed 8 times by 2 tests: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 173 | - | |||||||||||||||||||
| 174 | void QQuickBorderImage::setGridScaledImage(const QQuickGridScaledImage& sci) | - | ||||||||||||||||||
| 175 | { | - | ||||||||||||||||||
| 176 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 177 | if (!sci.isValid()
| 4-22 | ||||||||||||||||||
| 178 | d->status = Error; | - | ||||||||||||||||||
| 179 | statusChanged(d->status); | - | ||||||||||||||||||
| 180 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||
| 181 | QQuickScaleGrid *sg = border(); | - | ||||||||||||||||||
| 182 | sg->setTop(sci.gridTop()); | - | ||||||||||||||||||
| 183 | sg->setBottom(sci.gridBottom()); | - | ||||||||||||||||||
| 184 | sg->setLeft(sci.gridLeft()); | - | ||||||||||||||||||
| 185 | sg->setRight(sci.gridRight()); | - | ||||||||||||||||||
| 186 | d->horizontalTileMode = sci.horizontalTileRule(); | - | ||||||||||||||||||
| 187 | d->verticalTileMode = sci.verticalTileRule(); | - | ||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl())); | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | QQuickPixmap::Options options; | - | ||||||||||||||||||
| 192 | if (d->async
| 0-22 | ||||||||||||||||||
| 193 | options |= QQuickPixmap::Asynchronous; never executed: options |= QQuickPixmap::Asynchronous; | 0 | ||||||||||||||||||
| 194 | if (d->cache
| 0-22 | ||||||||||||||||||
| 195 | options |= QQuickPixmap::Cache; executed 22 times by 2 tests: options |= QQuickPixmap::Cache;Executed by:
| 22 | ||||||||||||||||||
| 196 | d->pix.clear(this); | - | ||||||||||||||||||
| 197 | d->pix.load(qmlEngine(this), d->sciurl, options); | - | ||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | if (d->pix.isLoading()
| 6-16 | ||||||||||||||||||
| 200 | if (d->progress != 0.0
| 0-6 | ||||||||||||||||||
| 201 | d->progress = 0.0; | - | ||||||||||||||||||
| 202 | progressChanged(d->progress); | - | ||||||||||||||||||
| 203 | } never executed: end of block | 0 | ||||||||||||||||||
| 204 | if (d->status != Loading
| 0-6 | ||||||||||||||||||
| 205 | d->status = Loading; | - | ||||||||||||||||||
| 206 | statusChanged(d->status); | - | ||||||||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||||||||
| 208 | static int thisRequestProgress = -1; | - | ||||||||||||||||||
| 209 | static int thisRequestFinished = -1; | - | ||||||||||||||||||
| 210 | if (thisRequestProgress == -1
| 2-4 | ||||||||||||||||||
| 211 | thisRequestProgress = | - | ||||||||||||||||||
| 212 | QQuickBorderImage::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)"); | - | ||||||||||||||||||
| 213 | thisRequestFinished = | - | ||||||||||||||||||
| 214 | QQuickBorderImage::staticMetaObject.indexOfSlot("requestFinished()"); | - | ||||||||||||||||||
| 215 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | d->pix.connectFinished(this, thisRequestFinished); | - | ||||||||||||||||||
| 218 | d->pix.connectDownloadProgress(this, thisRequestProgress); | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | } executed 6 times by 1 test: else {end of blockExecuted by:
| 6 | ||||||||||||||||||
| 221 | requestFinished(); | - | ||||||||||||||||||
| 222 | } executed 16 times by 2 tests: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 223 | } | - | ||||||||||||||||||
| 224 | } | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | void QQuickBorderImage::requestFinished() | - | ||||||||||||||||||
| 227 | { | - | ||||||||||||||||||
| 228 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | QSize impsize = d->pix.implicitSize(); | - | ||||||||||||||||||
| 231 | if (d->pix.isError()
| 16-116 | ||||||||||||||||||
| 232 | d->status = Error; | - | ||||||||||||||||||
| 233 | qmlWarning(this) << d->pix.error(); | - | ||||||||||||||||||
| 234 | if (d->progress != 0
| 0-16 | ||||||||||||||||||
| 235 | d->progress = 0; | - | ||||||||||||||||||
| 236 | progressChanged(d->progress); | - | ||||||||||||||||||
| 237 | } never executed: end of block | 0 | ||||||||||||||||||
| 238 | } executed 16 times by 2 tests: else {end of blockExecuted by:
| 16 | ||||||||||||||||||
| 239 | d->status = Ready; | - | ||||||||||||||||||
| 240 | if (d->progress != 1.0
| 22-94 | ||||||||||||||||||
| 241 | d->progress = 1.0; | - | ||||||||||||||||||
| 242 | progressChanged(d->progress); | - | ||||||||||||||||||
| 243 | } executed 94 times by 2 tests: end of blockExecuted by:
| 94 | ||||||||||||||||||
| 244 | } executed 116 times by 2 tests: end of blockExecuted by:
| 116 | ||||||||||||||||||
| 245 | - | |||||||||||||||||||
| 246 | setImplicitSize(impsize.width() / d->devicePixelRatio, impsize.height() / d->devicePixelRatio); | - | ||||||||||||||||||
| 247 | statusChanged(d->status); | - | ||||||||||||||||||
| 248 | if (sourceSize() != d->oldSourceSize
| 4-128 | ||||||||||||||||||
| 249 | d->oldSourceSize = sourceSize(); | - | ||||||||||||||||||
| 250 | sourceSizeChanged(); | - | ||||||||||||||||||
| 251 | } executed 128 times by 2 tests: end of blockExecuted by:
| 128 | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | pixmapChange(); | - | ||||||||||||||||||
| 254 | } executed 132 times by 2 tests: end of blockExecuted by:
| 132 | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | void QQuickBorderImage::sciRequestFinished() | - | ||||||||||||||||||
| 260 | { | - | ||||||||||||||||||
| 261 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | d->redirectCount++; | - | ||||||||||||||||||
| 264 | if (d->redirectCount < 16
| 0-8 | ||||||||||||||||||
| 265 | QVariant redirect = d->sciReply->attribute(QNetworkRequest::RedirectionTargetAttribute); | - | ||||||||||||||||||
| 266 | if (redirect.isValid()
| 0-8 | ||||||||||||||||||
| 267 | QUrl url = d->sciReply->url().resolved(redirect.toUrl()); | - | ||||||||||||||||||
| 268 | setSource(url); | - | ||||||||||||||||||
| 269 | return; never executed: return; | 0 | ||||||||||||||||||
| 270 | } | - | ||||||||||||||||||
| 271 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 272 | d->redirectCount=0; | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | if (d->sciReply->error() != QNetworkReply::NoError
| 2-6 | ||||||||||||||||||
| 275 | d->status = Error; | - | ||||||||||||||||||
| 276 | d->sciReply->deleteLater(); | - | ||||||||||||||||||
| 277 | d->sciReply = nullptr; | - | ||||||||||||||||||
| 278 | statusChanged(d->status); | - | ||||||||||||||||||
| 279 | } executed 2 times by 1 test: else {end of blockExecuted by:
| 2 | ||||||||||||||||||
| 280 | QQuickGridScaledImage sci(d->sciReply); | - | ||||||||||||||||||
| 281 | d->sciReply->deleteLater(); | - | ||||||||||||||||||
| 282 | d->sciReply = nullptr; | - | ||||||||||||||||||
| 283 | setGridScaledImage(sci); | - | ||||||||||||||||||
| 284 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 285 | } | - | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | void QQuickBorderImage::doUpdate() | - | ||||||||||||||||||
| 289 | { | - | ||||||||||||||||||
| 290 | update(); | - | ||||||||||||||||||
| 291 | } executed 376 times by 2 tests: end of blockExecuted by:
| 376 | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | void QQuickBorderImagePrivate::calculateRects(const QQuickScaleGrid *border, | - | ||||||||||||||||||
| 294 | const QSize &sourceSize, | - | ||||||||||||||||||
| 295 | const QSizeF &targetSize, | - | ||||||||||||||||||
| 296 | int horizontalTileMode, | - | ||||||||||||||||||
| 297 | int verticalTileMode, | - | ||||||||||||||||||
| 298 | qreal devicePixelRatio, | - | ||||||||||||||||||
| 299 | QRectF *targetRect, | - | ||||||||||||||||||
| 300 | QRectF *innerTargetRect, | - | ||||||||||||||||||
| 301 | QRectF *innerSourceRect, | - | ||||||||||||||||||
| 302 | QRectF *subSourceRect) | - | ||||||||||||||||||
| 303 | { | - | ||||||||||||||||||
| 304 | *innerSourceRect = QRectF(0, 0, 1, 1); | - | ||||||||||||||||||
| 305 | *targetRect = QRectF(0, 0, targetSize.width(), targetSize.height()); | - | ||||||||||||||||||
| 306 | *innerTargetRect = *targetRect; | - | ||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | if (border
| 0-72 | ||||||||||||||||||
| 309 | *innerSourceRect = QRectF(border->left() * devicePixelRatio / qreal(sourceSize.width()), | - | ||||||||||||||||||
| 310 | border->top() * devicePixelRatio / qreal(sourceSize.height()), | - | ||||||||||||||||||
| 311 | qMax<qreal>(0, sourceSize.width() - (border->right() + border->left()) * devicePixelRatio) / sourceSize.width(), | - | ||||||||||||||||||
| 312 | qMax<qreal>(0, sourceSize.height() - (border->bottom() + border->top()) * devicePixelRatio) / sourceSize.height()); | - | ||||||||||||||||||
| 313 | *innerTargetRect = QRectF(border->left(), | - | ||||||||||||||||||
| 314 | border->top(), | - | ||||||||||||||||||
| 315 | qMax<qreal>(0, targetSize.width() - (border->right() + border->left())), | - | ||||||||||||||||||
| 316 | qMax<qreal>(0, targetSize.height() - (border->bottom() + border->top()))); | - | ||||||||||||||||||
| 317 | } executed 72 times by 2 tests: end of blockExecuted by:
| 72 | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | qreal hTiles = 1; | - | ||||||||||||||||||
| 320 | qreal vTiles = 1; | - | ||||||||||||||||||
| 321 | const QSizeF innerTargetSize = innerTargetRect->size() * devicePixelRatio; | - | ||||||||||||||||||
| 322 | if (innerSourceRect->width() != 0
| 0-72 | ||||||||||||||||||
| 323 | && horizontalTileMode != QQuickBorderImage::Stretch
| 0-72 | ||||||||||||||||||
| 324 | hTiles = innerTargetSize.width() / qreal(innerSourceRect->width() * sourceSize.width()); | - | ||||||||||||||||||
| 325 | if (horizontalTileMode == QQuickBorderImage::Round
| 0 | ||||||||||||||||||
| 326 | hTiles = qCeil(hTiles); never executed: hTiles = qCeil(hTiles); | 0 | ||||||||||||||||||
| 327 | } never executed: end of block | 0 | ||||||||||||||||||
| 328 | if (innerSourceRect->height() != 0
| 0-72 | ||||||||||||||||||
| 329 | && verticalTileMode != QQuickBorderImage::Stretch
| 0-72 | ||||||||||||||||||
| 330 | vTiles = innerTargetSize.height() / qreal(innerSourceRect->height() * sourceSize.height()); | - | ||||||||||||||||||
| 331 | if (verticalTileMode == QQuickBorderImage::Round
| 0 | ||||||||||||||||||
| 332 | vTiles = qCeil(vTiles); never executed: vTiles = qCeil(vTiles); | 0 | ||||||||||||||||||
| 333 | } never executed: end of block | 0 | ||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | *subSourceRect = QRectF(0, 0, hTiles, vTiles); | - | ||||||||||||||||||
| 336 | } executed 72 times by 2 tests: end of blockExecuted by:
| 72 | ||||||||||||||||||
| 337 | - | |||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) | - | ||||||||||||||||||
| 340 | { | - | ||||||||||||||||||
| 341 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 342 | - | |||||||||||||||||||
| 343 | QSGTexture *texture = d->sceneGraphRenderContext()->textureForFactory(d->pix.textureFactory(), window()); | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | if (!texture
| 0-70 | ||||||||||||||||||
| 346 | delete oldNode; | - | ||||||||||||||||||
| 347 | return executed 10 times by 1 test: nullptr;return nullptr;Executed by:
executed 10 times by 1 test: return nullptr;Executed by:
| 10 | ||||||||||||||||||
| 348 | } | - | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); | - | ||||||||||||||||||
| 351 | - | |||||||||||||||||||
| 352 | bool updatePixmap = d->pixmapChanged; | - | ||||||||||||||||||
| 353 | d->pixmapChanged = false; | - | ||||||||||||||||||
| 354 | if (!node
| 0-70 | ||||||||||||||||||
| 355 | node = d->sceneGraphContext()->createInternalImageNode(); | - | ||||||||||||||||||
| 356 | updatePixmap = true; | - | ||||||||||||||||||
| 357 | } executed 70 times by 2 tests: end of blockExecuted by:
| 70 | ||||||||||||||||||
| 358 | - | |||||||||||||||||||
| 359 | if (updatePixmap
| 0-70 | ||||||||||||||||||
| 360 | node->setTexture(texture); executed 70 times by 2 tests: node->setTexture(texture);Executed by:
| 70 | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | QRectF targetRect; | - | ||||||||||||||||||
| 364 | QRectF innerTargetRect; | - | ||||||||||||||||||
| 365 | QRectF innerSourceRect; | - | ||||||||||||||||||
| 366 | QRectF subSourceRect; | - | ||||||||||||||||||
| 367 | d->calculateRects(d->border, | - | ||||||||||||||||||
| 368 | QSize(d->pix.width(), d->pix.height()), QSizeF(width(), height()), | - | ||||||||||||||||||
| 369 | d->horizontalTileMode, d->verticalTileMode, d->devicePixelRatio, | - | ||||||||||||||||||
| 370 | &targetRect, &innerTargetRect, | - | ||||||||||||||||||
| 371 | &innerSourceRect, &subSourceRect); | - | ||||||||||||||||||
| 372 | - | |||||||||||||||||||
| 373 | node->setTargetRect(targetRect); | - | ||||||||||||||||||
| 374 | node->setInnerSourceRect(innerSourceRect); | - | ||||||||||||||||||
| 375 | node->setInnerTargetRect(innerTargetRect); | - | ||||||||||||||||||
| 376 | node->setSubSourceRect(subSourceRect); | - | ||||||||||||||||||
| 377 | node->setMirror(d->mirror); | - | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | node->setMipmapFiltering(QSGTexture::None); | - | ||||||||||||||||||
| 380 | node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest); | - | ||||||||||||||||||
| 381 | if (innerSourceRect == QRectF(0, 0, 1, 1)
| 0-70 | ||||||||||||||||||
| 382 | node->setHorizontalWrapMode(QSGTexture::Repeat); | - | ||||||||||||||||||
| 383 | node->setVerticalWrapMode(QSGTexture::Repeat); | - | ||||||||||||||||||
| 384 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 385 | node->setHorizontalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||||||||
| 386 | node->setVerticalWrapMode(QSGTexture::ClampToEdge); | - | ||||||||||||||||||
| 387 | } executed 70 times by 2 tests: end of blockExecuted by:
| 70 | ||||||||||||||||||
| 388 | node->setAntialiasing(d->antialiasing); | - | ||||||||||||||||||
| 389 | node->update(); | - | ||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | return executed 70 times by 2 tests: node;return node;Executed by:
executed 70 times by 2 tests: return node;Executed by:
| 70 | ||||||||||||||||||
| 392 | } | - | ||||||||||||||||||
| 393 | - | |||||||||||||||||||
| 394 | void QQuickBorderImage::pixmapChange() | - | ||||||||||||||||||
| 395 | { | - | ||||||||||||||||||
| 396 | QQuickBorderImagePrivate * const d = d_func(); | - | ||||||||||||||||||
| 397 | d->pixmapChanged = true; | - | ||||||||||||||||||
| 398 | update(); | - | ||||||||||||||||||
| 399 | } executed 140 times by 2 tests: end of blockExecuted by:
| 140 | ||||||||||||||||||
| 400 | - | |||||||||||||||||||
| 401 | - | |||||||||||||||||||
| 402 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |