Skip to content

Commit

Permalink
Use QImageReader to speed up image cache's originalSize function
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Dec 5, 2018
1 parent 1e4ad44 commit 9d1aaa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/qgsimagecache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ QImage QgsImageCache::pathAsImage( const QString &file, const QSize size, const
}
else
{
QgsDebugMsg( "HITTTTTTTTTTTTTTTTTTTTTTTTT!!!!!!!!!!!!!!" );
result = currentEntry->image;
}

Expand All @@ -145,7 +144,11 @@ QSize QgsImageCache::originalSize( const QString &path ) const
// direct read if path is a file -- maybe more efficient than going the bytearray route? (untested!)
if ( QFile::exists( path ) )
{
return QImage( path ).size();
QImageReader reader( path );
if ( reader.size().isValid() )
return reader.size();
else
return QImage( path ).size();
}
else
{
Expand Down

0 comments on commit 9d1aaa8

Please sign in to comment.