[vlc-commits] qt: Don't trust image extensions
Hugo Beauzée-Luyssen
git at videolan.org
Fri Feb 3 13:40:07 CET 2017
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Feb 3 13:27:54 2017 +0100| [7cad95e2842fbc5f71de827d19b2714da7c60d7b] | committer: Hugo Beauzée-Luyssen
qt: Don't trust image extensions
Fix #17828
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7cad95e2842fbc5f71de827d19b2714da7c60d7b
---
modules/gui/qt/components/playlist/vlc_model.cpp | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/components/playlist/vlc_model.cpp b/modules/gui/qt/components/playlist/vlc_model.cpp
index e877b5d..e5df34d 100644
--- a/modules/gui/qt/components/playlist/vlc_model.cpp
+++ b/modules/gui/qt/components/playlist/vlc_model.cpp
@@ -25,6 +25,8 @@
#include "input_manager.hpp" /* THEMIM */
#include "pixmaps/types/type_unknown.xpm"
+#include <QImageReader>
+
VLCModelSubInterface::VLCModelSubInterface()
{
}
@@ -83,24 +85,26 @@ QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size )
if( !QPixmapCache::find( key, artPix ))
{
- if( artUrl.isEmpty() || !artPix.load( artUrl ) )
+ if( artUrl.isEmpty() == false )
{
- key = QString("noart%1%2").arg(size.width()).arg(size.height());
- if( !QPixmapCache::find( key, artPix ) )
+ QImageReader reader( artUrl );
+ reader.setDecideFormatFromContent( true );
+ artPix = QPixmap::fromImageReader( &reader ).scaled( size );
+ if ( artPix.isNull() == false )
{
- artPix = QPixmap( ":/noart" ).scaled( size,
- Qt::KeepAspectRatio,
- Qt::SmoothTransformation );
QPixmapCache::insert( key, artPix );
+ return artPix;
}
}
- else
+ key = QString("noart%1%2").arg(size.width()).arg(size.height());
+ if( !QPixmapCache::find( key, artPix ) )
{
- artPix = artPix.scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
+ artPix = QPixmap( ":/noart" ).scaled( size,
+ Qt::KeepAspectRatio,
+ Qt::SmoothTransformation );
QPixmapCache::insert( key, artPix );
}
}
-
return artPix;
}
More information about the vlc-commits
mailing list