summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 11:06:19 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-06-15 12:33:51 (GMT)
commitdf55141aa260c8a10c06aa990b6f20d6fb4718f3 (patch)
tree90b6e5c168b83232187ce61cc4e5ffbf530d6118 /src/plugins
parentc28efecdcfdd5fa0049bf482cb102814338c0d99 (diff)
downloadQt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.zip
Qt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.tar.gz
Qt-df55141aa260c8a10c06aa990b6f20d6fb4718f3.tar.bz2
Fixed QImageReader::format() inconsistency.
If state is set to ReadHeader before canRead() then setFormat("png") never gets called. We should make sure that setFormat() gets set whenever canRead() returns true. Task-number: QTBUG-2263 Reviewed-by: Kent Hansen
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp10
-rw-r--r--src/plugins/imageformats/mng/qmnghandler.cpp8
3 files changed, 12 insertions, 10 deletions
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 8abc2d1..5e2157e 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -1061,12 +1061,12 @@ bool QGifHandler::imageIsComing() const
bool QGifHandler::canRead() const
{
- if (!nextDelay && canRead(device())) {
+ if (!nextDelay && canRead(device()) || imageIsComing()) {
setFormat("gif");
return true;
}
- return imageIsComing();
+ return false;
}
bool QGifHandler::canRead(QIODevice *device)
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 72dde15..60e7cce 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -802,13 +802,15 @@ QJpegHandler::~QJpegHandler()
bool QJpegHandler::canRead() const
{
- if(d->state == QJpegHandlerPrivate::Ready) {
- if (!canRead(device()))
- return false;
+ if(d->state == QJpegHandlerPrivate::Ready && !canRead(device()))
+ return false;
+
+ if (d->state != QJpegHandlerPrivate::Error) {
setFormat("jpeg");
return true;
}
- return d->state != QJpegHandlerPrivate::Error;
+
+ return false;
}
bool QJpegHandler::canRead(QIODevice *device)
diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/plugins/imageformats/mng/qmnghandler.cpp
index d408e6c..c134fd6 100644
--- a/src/plugins/imageformats/mng/qmnghandler.cpp
+++ b/src/plugins/imageformats/mng/qmnghandler.cpp
@@ -381,10 +381,10 @@ QMngHandler::~QMngHandler()
bool QMngHandler::canRead() const
{
Q_D(const QMngHandler);
- if (!d->haveReadNone)
- return (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount)));
-
- if (canRead(device())) {
+ if ((!d->haveReadNone
+ && (!d->haveReadAll || (d->haveReadAll && (d->nextIndex < d->frameCount))))
+ || canRead(device()))
+ {
setFormat("mng");
return true;
}