aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickimageprovider.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2012-11-23 12:44:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-23 17:13:33 +0100
commit597df98c542601ff2d286c79a8002a9ae995c98b (patch)
treef5399fc3c84a2324bad56ee448892b734e55b03c /src/quick/util/qquickimageprovider.cpp
parentcef169a9eb12a860b3c0ccb1bf50b2c8cfaff9f8 (diff)
Support requestPixmap if platform has ThreadedPixmaps feature
As discussed with Samuel enable the use of requestPixmap in a thread for async requests if the platform support ThreadedPixmaps Task-number: 28138 Change-Id: I106cf0123430115464b0a75071c7e6129a98d22b Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/quick/util/qquickimageprovider.cpp')
-rw-r--r--src/quick/util/qquickimageprovider.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index 94a753f92e..3c5610f995 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -136,7 +136,7 @@ QImage QQuickTextureFactory::image() const
\list
\li Loaded using QPixmaps rather than actual image files
- \li Loaded asynchronously in a separate thread, if imageType() is \l{QQuickImageProvider::ImageType}{ImageType::Image}
+ \li Loaded asynchronously in a separate thread
\endlist
To specify that an image should be loaded by an image provider, use the
@@ -211,7 +211,7 @@ QImage QQuickTextureFactory::image() const
\section2 Asynchronous image loading
- Image providers that support QImage loading automatically include support
+ Image providers that support QImage or Texture loading automatically include support
for asychronous loading of images. To enable asynchronous loading for an
image source, set the \c asynchronous property to \c true for the relevant
\l Image, \l BorderImage or \l AnimatedImage object. When this is enabled,
@@ -225,11 +225,11 @@ QImage QQuickTextureFactory::image() const
provider constructor. This ensures that all image requests for the
provider are handled in a separate thread.
- Asynchronous loading is not supported for image providers that provide
- QPixmap rather than QImage values, as pixmaps can only be created in the
- main thread. In this case, if \l {Image::}{asynchronous} is set to
- \c true, the value is ignored and the image is loaded
- synchronously.
+ Asynchronous loading for image providers that provide QPixmap is only supported
+ in platforms that have the ThreadedPixmaps feature, in platforms where
+ pixmaps can only be created in the main thread (i.e. ThreadedPixmaps is not supported)
+ if \l {Image::}{asynchronous} is set to \c true, the value is ignored
+ and the image is loaded synchronously.
\section2 Image caching
@@ -328,6 +328,9 @@ QImage QQuickImageProvider::requestImage(const QString &id, QSize *size, const Q
In all cases, \a size must be set to the original size of the image. This
is used to set the \l {Item::}{width} and \l {Item::}{height} of the
relevant \l Image if these values have not been set explicitly.
+
+ \note this method may be called by multiple threads, so ensure the
+ implementation of this method is reentrant.
*/
QPixmap QQuickImageProvider::requestPixmap(const QString &id, QSize *size, const QSize& requestedSize)
{