Skip to content
Permalink
Browse files

Use QImageReader to speed up image cache's originalSize function

  • Loading branch information
nirvn committed Dec 5, 2018
1 parent 1e4ad44 commit 9d1aaa83ab9b92efaac3f53892e32d8b0b629756
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/core/qgsimagecache.cpp
@@ -133,7 +133,6 @@ QImage QgsImageCache::pathAsImage( const QString &file, const QSize size, const
}
else
{
QgsDebugMsg( "HITTTTTTTTTTTTTTTTTTTTTTTTT!!!!!!!!!!!!!!" );
result = currentEntry->image;
}

@@ -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
{

0 comments on commit 9d1aaa8

Please sign in to comment.
You can’t perform that action at this time.