OpenCoverage

qquickimageprovider.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickimageprovider.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qquickimageprovider.h"-
41-
42#include "qquickimageprovider_p.h"-
43#include "qquickpixmapcache_p.h"-
44#include <QtQuick/private/qsgcontext_p.h>-
45#include <private/qqmlglobal_p.h>-
46-
47QT_BEGIN_NAMESPACE-
48-
49/*!-
50 \class QQuickTextureFactory-
51 \since 5.0-
52 \brief The QQuickTextureFactory class provides an interface for loading custom textures from QML.-
53 \inmodule QtQuick-
54-
55 The purpose of the texture factory is to provide a placeholder for a image-
56 data that can be converted into an OpenGL texture.-
57-
58 Creating a texture directly is not possible as there is rarely an OpenGL context-
59 available in the thread that is responsible for loading the image data.-
60*/-
61-
62/*!-
63 Constructs a texture factory. Since QQuickTextureFactory is abstract, it-
64 cannot be instantiated directly.-
65*/-
66-
67QQuickTextureFactory::QQuickTextureFactory()-
68{-
69}-
70-
71/*!-
72 Destroys the texture factory.-
73*/-
74-
75QQuickTextureFactory::~QQuickTextureFactory()-
76{-
77}-
78-
79/*!-
80 \fn int QQuickTextureFactory::textureByteCount() const-
81-
82 Returns the number of bytes of memory the texture consumes.-
83*/-
84-
85/*!-
86 \fn QImage QQuickTextureFactory::image() const-
87-
88 Returns an image version of this texture.-
89-
90 The lifespan of the returned image is unknown, so the implementation should-
91 return a self contained QImage, not make use of the QImage(uchar *, ...)-
92 constructor.-
93-
94 This function is not commonly used and is expected to be slow.-
95 */-
96-
97QImage QQuickTextureFactory::image() const-
98{-
99 return QImage();
never executed: return QImage();
0
100}-
101-
102/*!-
103 Returns a QQuickTextureFactory holding the given \a image.-
104-
105 This is typically used as a helper in QQuickImageResponse::textureFactory.-
106-
107 \since 5.6-
108 */-
109-
110QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage &image)-
111{-
112 if (image.isNull())
image.isNull()Description
TRUEevaluated 22 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_qquicktextedit
FALSEevaluated 8874 times by 37 tests
Evaluated by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • ...
22-8874
113 return nullptr;
executed 22 times by 6 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qquickborderimage
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_qquicktextedit
22
114 QQuickTextureFactory *texture = QSGContext::createTextureFactoryFromImage(image);-
115 if (texture)
textureDescription
TRUEnever evaluated
FALSEevaluated 8874 times by 37 tests
Evaluated by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • ...
0-8874
116 return texture;
never executed: return texture;
0
117 return new QQuickDefaultTextureFactory(image);
executed 8874 times by 37 tests: return new QQuickDefaultTextureFactory(image);
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • ...
8874
118}-
119-
120-
121-
122/*!-
123 \fn QSGTexture *QQuickTextureFactory::createTexture(QQuickWindow *window) const-
124-
125 This function is called on the scene graph rendering thread to create a QSGTexture-
126 instance from the factory. \a window provides the context which this texture is-
127 created in.-
128-
129 QML will internally cache the returned texture as needed. Each call to this-
130 function should return a unique instance.-
131-
132 The OpenGL context used for rendering is bound when this function is called.-
133 */-
134-
135/*!-
136 \fn QSize QQuickTextureFactory::textureSize() const-
137-
138 Returns the size of the texture. This function will be called from arbitrary threads-
139 and should not rely on an OpenGL context bound.-
140 */-
141-
142-
143/*!-
144 \class QQuickImageResponse-
145 \since 5.6-
146 \brief The QQuickImageResponse class provides an interface for asynchronous image loading in QQuickAsyncImageProvider.-
147 \inmodule QtQuick-
148-
149 The purpose of an image response is to provide a way for image provider jobs to be executed-
150 in an asynchronous way.-
151-
152 Responses are deleted via \l deleteLater once the finished() signal has been emitted.-
153 If you are using QRunnable as base for your QQuickImageResponse-
154 ensure automatic deletion is disabled.-
155-
156 See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.-
157-
158 \sa QQuickImageProvider-
159*/-
160-
161/*!-
162 Constructs the image response-
163*/-
164QQuickImageResponse::QQuickImageResponse()-
165 : QObject(*(new QQuickImageResponsePrivate))-
166{-
167 qmlobject_connect(this, QQuickImageResponse, SIGNAL(finished()),
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickimageprovider
executed 2 times by 1 test: methodIdx = QQuickImageResponse::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_qquickimageprovider
never executed: methodIdx = QQuickImageResponse::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
methodIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
code == 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
FALSEnever evaluated
0-14
168 this, QQuickImageResponse, SLOT(_q_finished()));-
169}
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickimageprovider
16
170-
171/*!-
172 Destructs the image response-
173*/-
174QQuickImageResponse::~QQuickImageResponse()-
175{-
176}-
177-
178/*!-
179 Returns the error string for the job execution. An empty string means no error.-
180*/-
181QString QQuickImageResponse::errorString() const-
182{-
183 return QString();
executed 16 times by 1 test: return QString();
Executed by:
  • tst_qquickimageprovider
16
184}-
185-
186/*!-
187 This method is used to communicate that the response is no longer required by the engine.-
188-
189 It may be reimplemented to cancel a request in the provider side, however, it is not mandatory.-
190-
191 A cancelled QQuickImageResponse still needs to emit finished() so that the-
192 engine may clean up the QQuickImageResponse.-
193-
194 \note finished() should not be emitted until the response is complete,-
195 regardless of whether or not cancel() was called. If it is called prematurely,-
196 the engine may destroy the response while it is still active, leading to a crash.-
197*/-
198void QQuickImageResponse::cancel()-
199{-
200}-
201-
202/*!-
203 \fn void QQuickImageResponse::finished()-
204-
205 Signals that the job execution has finished (be it successfully, because an-
206 error happened or because it was cancelled).-
207-
208 \note Emission of this signal must be the final action the response performs:-
209 once the signal is received, the response will subsequently be destroyed by-
210 the engine.-
211 */-
212-
213/*!-
214 \fn QQuickTextureFactory *QQuickImageResponse::textureFactory() const-
215-
216 Returns the texture factory for the job. You can use QQuickTextureFactory::textureFactoryForImage-
217 if your provider works with QImage. The engine takes ownership of the returned QQuickTextureFactory.-
218-
219 \note This method will be called only when needed. For example, it may not be called if there is an-
220 error or the job is cancelled. Therefore, allocate the QQuickTextureFactory instance only in this-
221 method or otherwise ensure its deletion.-
222 */-
223-
224-
225/*!-
226 \class QQuickImageProvider-
227 \since 5.0-
228 \inmodule QtQuick-
229 \brief The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image requests in QML.-
230-
231 QQuickImageProvider is used to provide advanced image loading features-
232 in QML applications. It allows images in QML to be:-
233-
234 \list-
235 \li Loaded using QPixmaps rather than actual image files-
236 \li Loaded asynchronously in a separate thread-
237 \endlist-
238-
239 To specify that an image should be loaded by an image provider, use the-
240 \b {"image:"} scheme for the URL source of the image, followed by the-
241 identifiers of the image provider and the requested image. For example:-
242-
243 \qml-
244 Image { source: "image://myimageprovider/image.png" }-
245 \endqml-
246-
247 This specifies that the image should be loaded by the image provider named-
248 "myimageprovider", and the image to be loaded is named "image.png". The QML engine-
249 invokes the appropriate image provider according to the providers that have-
250 been registered through QQmlEngine::addImageProvider().-
251-
252 Note that the identifiers are case-insensitive, but the rest of the URL will be passed on with-
253 preserved case. For example, the below snippet would still specify that the image is loaded by the-
254 image provider named "myimageprovider", but it would request a different image than the above snippet-
255 ("Image.png" instead of "image.png").-
256 \qml-
257 Image { source: "image://MyImageProvider/Image.png" }-
258 \endqml-
259-
260 If you want the rest of the URL to be case insensitive, you will have to take care-
261 of that yourself inside your image provider.-
262-
263 \section2 An Example-
264-
265 Here are two images. Their \c source values indicate they should be loaded by-
266 an image provider named "colors", and the images to be loaded are "yellow"-
267 and "red", respectively:-
268-
269 \snippet imgprovider/imageprovider-example.qml 0-
270-
271 When these images are loaded by QML, it looks for a matching image provider-
272 and calls its requestImage() or requestPixmap() method (depending on its-
273 imageType()) to load the image. The method is called with the \c id-
274 parameter set to "yellow" for the first image, and "red" for the second.-
275-
276 Here is an image provider implementation that can load the images-
277 requested by the above QML. This implementation dynamically-
278 generates QPixmap images that are filled with the requested color:-
279-
280 \snippet imgprovider/imageprovider.cpp 0-
281-
282 To make this provider accessible to QML, it is registered with the QML engine-
283 with a "colors" identifier:-
284-
285 \snippet imgprovider/imageprovider.cpp 1-
286 \codeline-
287 \snippet imgprovider/imageprovider.cpp 2-
288-
289 Now the images can be successfully loaded in QML:-
290-
291 \image imageprovider.png-
292-
293 See the \l {imageprovider}{Image Provider Example} for the complete implementation.-
294 Note that the example registers the provider via a \l{QQmlExtensionPlugin}{plugin}-
295 instead of registering it in the application \c main() function as shown above.-
296-
297-
298 \section2 Asynchronous Image Loading-
299-
300 Image providers that support QImage or Texture loading automatically include support-
301 for asychronous loading of images. To enable asynchronous loading for an-
302 image source, set the \c asynchronous property to \c true for the relevant-
303 \l Image, \l BorderImage or \l AnimatedImage object. When this is enabled,-
304 the image request to the provider is run in a low priority thread,-
305 allowing image loading to be executed in the background, and reducing the-
306 performance impact on the user interface.-
307-
308 To force asynchronous image loading, even for image sources that do not-
309 have the \c asynchronous property set to \c true, you may pass the-
310 \c QQmlImageProviderBase::ForceAsynchronousImageLoading flag to the image-
311 provider constructor. This ensures that all image requests for the-
312 provider are handled in a separate thread.-
313-
314 Asynchronous loading for image providers that provide QPixmap is only supported-
315 in platforms that have the ThreadedPixmaps feature, in platforms where-
316 pixmaps can only be created in the main thread (i.e. ThreadedPixmaps is not supported)-
317 if \l {Image::}{asynchronous} is set to \c true, the value is ignored-
318 and the image is loaded synchronously.-
319-
320 Asynchronous image loading for providers of type other than ImageResponse are-
321 executed on a single thread per engine basis. That means that a slow image provider-
322 will block the loading of any other request. To avoid that we suggest using QQuickAsyncImageProvider-
323 and implement threading on the provider side via a \c QThreadPool or similar.-
324 See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.-
325-
326-
327 \section2 Image Caching-
328-
329 Images returned by a QQuickImageProvider are automatically cached,-
330 similar to any image loaded by the QML engine. When an image with a-
331 "image://" prefix is loaded from cache, requestImage() and requestPixmap()-
332 will not be called for the relevant image provider. If an image should always-
333 be fetched from the image provider, and should not be cached at all, set the-
334 \c cache property to \c false for the relevant \l Image, \l BorderImage or-
335 \l AnimatedImage object.-
336-
337 The \l {Qt Quick 1} version of this class is named QDeclarativeImageProvider.-
338-
339 \sa QQmlEngine::addImageProvider()-
340*/-
341-
342/*!-
343 Creates an image provider that will provide images of the given \a type and-
344 behave according to the given \a flags.-
345*/-
346QQuickImageProvider::QQuickImageProvider(ImageType type, Flags flags)-
347 : d(new QQuickImageProviderPrivate)-
348{-
349 d->type = type;-
350 d->flags = flags;-
351 d->isProviderWithOptions = false;-
352}
executed 116 times by 5 tests: end of block
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
116
353-
354/*!-
355 Destroys the QQuickImageProvider-
356-
357 \note The destructor of your derived class need to be thread safe.-
358*/-
359QQuickImageProvider::~QQuickImageProvider()-
360{-
361 delete d;-
362}
executed 116 times by 5 tests: end of block
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
116
363-
364/*!-
365 Returns the image type supported by this provider.-
366*/-
367QQuickImageProvider::ImageType QQuickImageProvider::imageType() const-
368{-
369 return d->type;
executed 8116 times by 5 tests: return d->type;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
8116
370}-
371-
372/*!-
373 Returns the flags set for this provider.-
374*/-
375QQuickImageProvider::Flags QQuickImageProvider::flags() const-
376{-
377 return d->flags;
executed 8182 times by 5 tests: return d->flags;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
8182
378}-
379-
380/*!-
381 Implement this method to return the image with \a id. The default-
382 implementation returns an empty image.-
383-
384 The \a id is the requested image source, with the "image:" scheme and-
385 provider identifier removed. For example, if the image \l{Image::}{source}-
386 was "image://myprovider/icons/home", the given \a id would be "icons/home".-
387-
388 The \a requestedSize corresponds to the \l {Image::sourceSize} requested by-
389 an Image item. If \a requestedSize is a valid size, the image-
390 returned should be of that size.-
391-
392 In all cases, \a size must be set to the original size of the image. This-
393 is used to set the \l {Item::}{width} and \l {Item::}{height} of the-
394 relevant \l Image if these values have not been set explicitly.-
395-
396 \note this method may be called by multiple threads, so ensure the-
397 implementation of this method is reentrant.-
398*/-
399QImage QQuickImageProvider::requestImage(const QString &id, QSize *size, const QSize& requestedSize)-
400{-
401 Q_UNUSED(id);-
402 Q_UNUSED(size);-
403 Q_UNUSED(requestedSize);-
404 if (d->type == Image)
d->type == ImageDescription
TRUEnever evaluated
FALSEnever evaluated
0
405 qWarning("ImageProvider supports Image type but has not implemented requestImage()");
never executed: QMessageLogger(__FILE__, 405, __PRETTY_FUNCTION__).warning("ImageProvider supports Image type but has not implemented requestImage()");
0
406 return QImage();
never executed: return QImage();
0
407}-
408-
409/*!-
410 Implement this method to return the pixmap with \a id. The default-
411 implementation returns an empty pixmap.-
412-
413 The \a id is the requested image source, with the "image:" scheme and-
414 provider identifier removed. For example, if the image \l{Image::}{source}-
415 was "image://myprovider/icons/home", the given \a id would be "icons/home".-
416-
417 The \a requestedSize corresponds to the \l {Image::sourceSize} requested by-
418 an Image item. If \a requestedSize is a valid size, the image-
419 returned should be of that size.-
420-
421 In all cases, \a size must be set to the original size of the image. This-
422 is used to set the \l {Item::}{width} and \l {Item::}{height} of the-
423 relevant \l Image if these values have not been set explicitly.-
424-
425 \note this method may be called by multiple threads, so ensure the-
426 implementation of this method is reentrant.-
427*/-
428QPixmap QQuickImageProvider::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)-
429{-
430 Q_UNUSED(id);-
431 Q_UNUSED(size);-
432 Q_UNUSED(requestedSize);-
433 if (d->type == Pixmap)
d->type == PixmapDescription
TRUEnever evaluated
FALSEnever evaluated
0
434 qWarning("ImageProvider supports Pixmap type but has not implemented requestPixmap()");
never executed: QMessageLogger(__FILE__, 434, __PRETTY_FUNCTION__).warning("ImageProvider supports Pixmap type but has not implemented requestPixmap()");
0
435 return QPixmap();
never executed: return QPixmap();
0
436}-
437-
438-
439/*!-
440 Implement this method to return the texture with \a id. The default-
441 implementation returns 0.-
442-
443 The \a id is the requested image source, with the "image:" scheme and-
444 provider identifier removed. For example, if the image \l{Image::}{source}-
445 was "image://myprovider/icons/home", the given \a id would be "icons/home".-
446-
447 The \a requestedSize corresponds to the \l {Image::sourceSize} requested by-
448 an Image item. If \a requestedSize is a valid size, the image-
449 returned should be of that size.-
450-
451 In all cases, \a size must be set to the original size of the image. This-
452 is used to set the \l {Item::}{width} and \l {Item::}{height} of the-
453 relevant \l Image if these values have not been set explicitly.-
454-
455 \note this method may be called by multiple threads, so ensure the-
456 implementation of this method is reentrant.-
457*/-
458-
459QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize)-
460{-
461 Q_UNUSED(id);-
462 Q_UNUSED(size);-
463 Q_UNUSED(requestedSize);-
464 if (d->type == Texture)
d->type == TextureDescription
TRUEnever evaluated
FALSEnever evaluated
0
465 qWarning("ImageProvider supports Texture type but has not implemented requestTexture()");
never executed: QMessageLogger(__FILE__, 465, __PRETTY_FUNCTION__).warning("ImageProvider supports Texture type but has not implemented requestTexture()");
0
466 return nullptr;
never executed: return nullptr;
0
467}-
468-
469/*!-
470 \class QQuickAsyncImageProvider-
471 \since 5.6-
472 \inmodule QtQuick-
473 \brief The QQuickAsyncImageProvider class provides an interface for for asynchronous control of QML image requests.-
474-
475 See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation.-
476-
477 \sa QQuickImageProvider-
478*/-
479QQuickAsyncImageProvider::QQuickAsyncImageProvider()-
480 : QQuickImageProvider(ImageResponse, ForceAsynchronousImageLoading)-
481 , d(nullptr) // just as a placeholder in case we need it for the future-
482{-
483 Q_UNUSED(d);-
484}
executed 20 times by 2 tests: end of block
Executed by:
  • tst_qquickimageprovider
  • tst_sharedimage
20
485-
486QQuickAsyncImageProvider::~QQuickAsyncImageProvider()-
487{-
488}-
489-
490/*!-
491 \fn QQuickImageResponse *QQuickAsyncImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize)-
492-
493 Implement this method to return the job that will provide the texture with \a id.-
494-
495 The \a id is the requested image source, with the "image:" scheme and-
496 provider identifier removed. For example, if the image \l{Image::}{source}-
497 was "image://myprovider/icons/home", the given \a id would be "icons/home".-
498-
499 The \a requestedSize corresponds to the \l {Image::sourceSize} requested by-
500 an Image item. If \a requestedSize is a valid size, the image-
501 returned should be of that size.-
502-
503 \note this method may be called by multiple threads, so ensure the-
504 implementation of this method is reentrant.-
505*/-
506-
507-
508class QQuickImageProviderOptionsPrivate : public QSharedData-
509{-
510public:-
511 QQuickImageProviderOptionsPrivate()-
512 {-
513 }-
514-
515 QQuickImageProviderOptions::AutoTransform autoTransform = QQuickImageProviderOptions::UsePluginDefaultTransform;-
516 bool preserveAspectRatioCrop = false;-
517 bool preserveAspectRatioFit = false;-
518};-
519-
520/*!-
521 \class QQuickImageProviderOptions-
522 \brief The QQuickImageProviderOptions class provides options for QQuickImageProviderWithOptions image requests.-
523 \inmodule QtQuick-
524 \internal-
525-
526 \sa QQuickImageProviderWithOptions-
527*/-
528-
529/*!-
530 \enum QQuickImageProviderOptions::AutoTransform-
531-
532 Whether the image provider should apply transformation metadata on read().-
533-
534 \value UsePluginDefaultTransform Image provider should do its default behavior on whether applying transformation metadata on read or not-
535 \value ApplyTransform Image provider should apply transformation metadata on read-
536 \value DoNotApplyTransform Image provider should not apply transformation metadata on read-
537*/-
538-
539QQuickImageProviderOptions::QQuickImageProviderOptions()-
540 : d(new QQuickImageProviderOptionsPrivate())-
541{-
542}
executed 16891 times by 42 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlinfo
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • ...
16891
543-
544QQuickImageProviderOptions::~QQuickImageProviderOptions()-
545{-
546}-
547-
548QQuickImageProviderOptions::QQuickImageProviderOptions(const QQuickImageProviderOptions &other)-
549 : d(other.d)-
550{-
551}
executed 63745 times by 40 tests: end of block
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • ...
63745
552-
553QQuickImageProviderOptions& QQuickImageProviderOptions::operator=(const QQuickImageProviderOptions &other)-
554{-
555 d = other.d;-
556 return *this;
executed 16 times by 1 test: return *this;
Executed by:
  • tst_sharedimage
16
557}-
558-
559bool QQuickImageProviderOptions::operator==(const QQuickImageProviderOptions &other) const-
560{-
561 return d->autoTransform == other.d->autoTransform &&
executed 16503 times by 39 tests: return d->autoTransform == other.d->autoTransform && d->preserveAspectRatioCrop == other.d->preserveAspectRatioCrop && d->preserveAspectRatioFit == other.d->preserveAspectRatioFit;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • ...
16503
562 d->preserveAspectRatioCrop == other.d->preserveAspectRatioCrop &&
executed 16503 times by 39 tests: return d->autoTransform == other.d->autoTransform && d->preserveAspectRatioCrop == other.d->preserveAspectRatioCrop && d->preserveAspectRatioFit == other.d->preserveAspectRatioFit;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • ...
16503
563 d->preserveAspectRatioFit == other.d->preserveAspectRatioFit;
executed 16503 times by 39 tests: return d->autoTransform == other.d->autoTransform && d->preserveAspectRatioCrop == other.d->preserveAspectRatioCrop && d->preserveAspectRatioFit == other.d->preserveAspectRatioFit;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • ...
16503
564}-
565-
566/*!-
567 Returns whether the image provider should apply transformation metadata on read().-
568*/-
569QQuickImageProviderOptions::AutoTransform QQuickImageProviderOptions::autoTransform() const-
570{-
571 return d->autoTransform;
executed 45645 times by 40 tests: return d->autoTransform;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qquickage
  • tst_qquickanchors
  • tst_qquickangleddirection
  • tst_qquickanimatedimage
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickimageprovider
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • ...
45645
572}-
573-
574void QQuickImageProviderOptions::setAutoTransform(QQuickImageProviderOptions::AutoTransform autoTransform)-
575{-
576 d->autoTransform = autoTransform;-
577}
never executed: end of block
0
578-
579/*!-
580 Returns whether the image request is for a PreserveAspectCrop Image.-
581 This allows the provider to better optimize the size of the returned image.-
582*/-
583bool QQuickImageProviderOptions::preserveAspectRatioCrop() const-
584{-
585 return d->preserveAspectRatioCrop;
executed 152 times by 5 tests: return d->preserveAspectRatioCrop;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
152
586}-
587-
588void QQuickImageProviderOptions::setPreserveAspectRatioCrop(bool preserveAspectRatioCrop)-
589{-
590 d->preserveAspectRatioCrop = preserveAspectRatioCrop;-
591}
executed 26 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
26
592-
593/*!-
594 Returns whether the image request is for a PreserveAspectFit Image.-
595 This allows the provider to better optimize the size of the returned image.-
596*/-
597bool QQuickImageProviderOptions::preserveAspectRatioFit() const-
598{-
599 return d->preserveAspectRatioFit;
executed 126 times by 5 tests: return d->preserveAspectRatioFit;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
126
600}-
601-
602void QQuickImageProviderOptions::setPreserveAspectRatioFit(bool preserveAspectRatioFit)-
603{-
604 d->preserveAspectRatioFit = preserveAspectRatioFit;-
605}
executed 28 times by 2 tests: end of block
Executed by:
  • tst_qquickimage
  • tst_sharedimage
28
606-
607QQuickImageProviderWithOptions::QQuickImageProviderWithOptions(ImageType type, Flags flags)-
608 : QQuickAsyncImageProvider()-
609{-
610 QQuickImageProvider::d->type = type;-
611 QQuickImageProvider::d->flags = flags;-
612 QQuickImageProvider::d->isProviderWithOptions = true;-
613}
executed 16 times by 1 test: end of block
Executed by:
  • tst_sharedimage
16
614-
615QImage QQuickImageProviderWithOptions::requestImage(const QString &id, QSize *size, const QSize& requestedSize)-
616{-
617 return requestImage(id, size, requestedSize, QQuickImageProviderOptions());
never executed: return requestImage(id, size, requestedSize, QQuickImageProviderOptions());
0
618}-
619-
620QPixmap QQuickImageProviderWithOptions::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)-
621{-
622 return requestPixmap(id, size, requestedSize, QQuickImageProviderOptions());
never executed: return requestPixmap(id, size, requestedSize, QQuickImageProviderOptions());
0
623}-
624-
625QQuickTextureFactory *QQuickImageProviderWithOptions::requestTexture(const QString &id, QSize *size, const QSize &requestedSize)-
626{-
627 return requestTexture(id, size, requestedSize, QQuickImageProviderOptions());
never executed: return requestTexture(id, size, requestedSize, QQuickImageProviderOptions());
0
628}-
629-
630QImage QQuickImageProviderWithOptions::requestImage(const QString &id, QSize *size, const QSize& requestedSize, const QQuickImageProviderOptions &options)-
631{-
632 Q_UNUSED(options);-
633 return QQuickAsyncImageProvider::requestImage(id, size, requestedSize);
never executed: return QQuickAsyncImageProvider::requestImage(id, size, requestedSize);
0
634}-
635-
636QPixmap QQuickImageProviderWithOptions::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize, const QQuickImageProviderOptions &options)-
637{-
638 Q_UNUSED(options);-
639 return QQuickAsyncImageProvider::requestPixmap(id, size, requestedSize);
never executed: return QQuickAsyncImageProvider::requestPixmap(id, size, requestedSize);
0
640}-
641-
642QQuickTextureFactory *QQuickImageProviderWithOptions::requestTexture(const QString &id, QSize *size, const QSize &requestedSize, const QQuickImageProviderOptions &options)-
643{-
644 Q_UNUSED(options);-
645 return QQuickAsyncImageProvider::requestTexture(id, size, requestedSize);
never executed: return QQuickAsyncImageProvider::requestTexture(id, size, requestedSize);
0
646}-
647-
648QQuickImageResponse *QQuickImageProviderWithOptions::requestImageResponse(const QString &id, const QSize &requestedSize)-
649{-
650 Q_UNUSED(id);-
651 Q_UNUSED(requestedSize);-
652 if (imageType() == ImageResponse)
imageType() == ImageResponseDescription
TRUEnever evaluated
FALSEnever evaluated
0
653 qWarning("ImageProvider is of ImageResponse type but has not implemented requestImageResponse()");
never executed: QMessageLogger(__FILE__, 653, __PRETTY_FUNCTION__).warning("ImageProvider is of ImageResponse type but has not implemented requestImageResponse()");
0
654 return nullptr;
never executed: return nullptr;
0
655}-
656-
657QQuickImageResponse *QQuickImageProviderWithOptions::requestImageResponse(const QString &id, const QSize &requestedSize, const QQuickImageProviderOptions &options)-
658{-
659 Q_UNUSED(options);-
660 return requestImageResponse(id, requestedSize);
never executed: return requestImageResponse(id, requestedSize);
0
661}-
662-
663/*!-
664 Returns the recommended scaled image size for loading and storage. This is-
665 calculated according to the native pixel size of the image \a originalSize,-
666 the requested sourceSize \a requestedSize, the image file format \a format,-
667 and \a options. If the calculation otherwise concludes that scaled loading-
668 is not recommended, an invalid size is returned.-
669*/-
670QSize QQuickImageProviderWithOptions::loadSize(const QSize &originalSize, const QSize &requestedSize, const QByteArray &format, const QQuickImageProviderOptions &options)-
671{-
672 QSize res;-
673 if ((requestedSize.width() <= 0 && requestedSize.height() <= 0) || originalSize.isEmpty())
requestedSize.width() <= 0Description
TRUEevaluated 726 times by 35 tests
Evaluated by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • tst_qquickshadereffect
  • tst_qquickspritegoal
  • ...
FALSEevaluated 36 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
requestedSize.height() <= 0Description
TRUEevaluated 720 times by 35 tests
Evaluated by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • tst_qquickshadereffect
  • tst_qquickspritegoal
  • ...
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickimage
  • tst_qquickshadereffect
originalSize.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 42 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
0-726
674 return res;
executed 720 times by 35 tests: return res;
Executed by:
  • tst_examples
  • tst_qquickage
  • tst_qquickangleddirection
  • tst_qquickanimatedsprite
  • tst_qquickborderimage
  • tst_qquickcumulativedirection
  • tst_qquickcustomaffector
  • tst_qquickcustomparticle
  • tst_qquickellipseextruder
  • tst_qquickfriction
  • tst_qquickgravity
  • tst_qquickgroupgoal
  • tst_qquickimage
  • tst_qquickimageparticle
  • tst_qquickitemparticle
  • tst_qquicklineextruder
  • tst_qquickmaskextruder
  • tst_qquickparticlegroup
  • tst_qquickparticlesystem
  • tst_qquickpixmapcache
  • tst_qquickpointattractor
  • tst_qquickpointdirection
  • tst_qquickrectangleextruder
  • tst_qquickshadereffect
  • tst_qquickspritegoal
  • ...
720
675-
676 const bool preserveAspectCropOrFit = options.preserveAspectRatioCrop() || options.preserveAspectRatioFit();
options.preser...ectRatioCrop()Description
TRUEnever evaluated
FALSEevaluated 42 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
options.preser...pectRatioFit()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 38 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
0-42
677 const bool formatIsSvg = (format == "svg" || format == "svgz");
format == "svg"Description
TRUEnever evaluated
FALSEevaluated 42 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
format == "svgz"Description
TRUEnever evaluated
FALSEevaluated 42 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
0-42
678-
679 if (!preserveAspectCropOrFit && formatIsSvg && !requestedSize.isEmpty())
!preserveAspectCropOrFitDescription
TRUEevaluated 38 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
formatIsSvgDescription
TRUEnever evaluated
FALSEevaluated 38 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
!requestedSize.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0-38
680 return requestedSize;
never executed: return requestedSize;
0
681-
682 qreal ratio = 0.0;-
683 if (requestedSize.width() && (preserveAspectCropOrFit || formatIsSvg ||
requestedSize.width()Description
TRUEevaluated 36 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickimage
  • tst_qquickshadereffect
preserveAspectCropOrFitDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 32 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
formatIsSvgDescription
TRUEnever evaluated
FALSEevaluated 32 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
0-36
684 requestedSize.width() < originalSize.width())) {
requestedSize....alSize.width()Description
TRUEevaluated 30 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimage
2-30
685 ratio = qreal(requestedSize.width()) / originalSize.width();-
686 }
executed 34 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquicktext
  • tst_sharedimage
34
687 if (requestedSize.height() && (preserveAspectCropOrFit || formatIsSvg ||
requestedSize.height()Description
TRUEevaluated 40 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimage
preserveAspectCropOrFitDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 36 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
formatIsSvgDescription
TRUEnever evaluated
FALSEevaluated 36 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
0-40
688 requestedSize.height() < originalSize.height())) {
requestedSize....lSize.height()Description
TRUEevaluated 30 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickimage
  • tst_sharedimage
6-30
689 qreal hr = qreal(requestedSize.height()) / originalSize.height();-
690 if (ratio == 0.0)
ratio == 0.0Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_qquickimage
  • tst_qquickshadereffect
FALSEevaluated 28 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
  • tst_sharedimage
6-28
691 ratio = hr;
executed 6 times by 2 tests: ratio = hr;
Executed by:
  • tst_qquickimage
  • tst_qquickshadereffect
6
692 else if (!preserveAspectCropOrFit && (hr < ratio))
!preserveAspectCropOrFitDescription
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
(hr < ratio)Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
4-24
693 ratio = hr;
executed 20 times by 2 tests: ratio = hr;
Executed by:
  • tst_examples
  • tst_qquicktext
20
694 else if (preserveAspectCropOrFit && (hr > ratio))
preserveAspectCropOrFitDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquicktext
(hr > ratio)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEnever evaluated
0-4
695 ratio = hr;
executed 4 times by 1 test: ratio = hr;
Executed by:
  • tst_sharedimage
4
696 }
executed 34 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
34
697 if (ratio > 0.0) {
ratio > 0.0Description
TRUEevaluated 40 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickimage
2-40
698 res.setHeight(qRound(originalSize.height() * ratio));-
699 res.setWidth(qRound(originalSize.width() * ratio));-
700 }
executed 40 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
40
701 return res;
executed 42 times by 5 tests: return res;
Executed by:
  • tst_examples
  • tst_qquickimage
  • tst_qquickshadereffect
  • tst_qquicktext
  • tst_sharedimage
42
702}-
703-
704QQuickImageProviderWithOptions *QQuickImageProviderWithOptions::checkedCast(QQuickImageProvider *provider)-
705{-
706 if (provider && provider->d && provider->d->isProviderWithOptions)
providerDescription
TRUEevaluated 8116 times by 5 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickimageprovider
provider->dDescription
TRUEevaluated 8116 times by 5 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
  • tst_sharedimage
FALSEnever evaluated
provider->d->i...derWithOptionsDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_sharedimage
FALSEevaluated 8108 times by 4 tests
Evaluated by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
0-8116
707 return static_cast<QQuickImageProviderWithOptions *>(provider);
executed 8 times by 1 test: return static_cast<QQuickImageProviderWithOptions *>(provider);
Executed by:
  • tst_sharedimage
8
708-
709 return nullptr;
executed 8118 times by 4 tests: return nullptr;
Executed by:
  • tst_qquickanimatedsprite
  • tst_qquickimage
  • tst_qquickimageprovider
  • tst_qquickpixmapcache
8118
710}-
711-
712QT_END_NAMESPACE-
713-
714#include "moc_qquickimageprovider.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0