From 466d6d9f421eeef770b125f4097ef3aed9b3cefa Mon Sep 17 00:00:00 2001 From: spillerrec Date: Sun, 20 Sep 2015 19:03:04 +0200 Subject: [PATCH] FIX: Crash when trying to use indexed images as input --- src/Image.hpp | 5 ++++- src/main.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Image.hpp b/src/Image.hpp index 21c4c5d..9b12928 100644 --- a/src/Image.hpp +++ b/src/Image.hpp @@ -37,8 +37,11 @@ class Image { * \param [in] img The image data */ Image( QPoint pos, QImage img ) : pos(pos), img(img) { } + /** \param [in] img QImage which will be converted to ARGB32 and positioned at {0,0} */ + Image( QImage img ) : Image( {0,0}, img.convertToFormat(QImage::Format_ARGB32) ) { } + /** \param [in] path Load the image at **path** on the file system */ - Image( QString path ) : Image( {0,0}, QImage(path).convertToFormat(QImage::Format_ARGB32) ) { } + Image( QString path ) : Image( QImage(path) ) { } private: Image( QPoint pos, QImage img, QImage mask ) : pos(pos), img(img), mask(mask) { } diff --git a/src/main.cpp b/src/main.cpp index e759d3d..b2224e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -147,7 +147,7 @@ int main( int argc, char* argv[] ){ MultiImage multi_img( format ); for( auto image : images ) - multi_img.append( Image( {0,0}, image.second ) ); + multi_img.append( Image( image.second ) ); doMultiImg( multi_img, name ); } @@ -175,7 +175,7 @@ int main( int argc, char* argv[] ){ if( options.contains( "--auto" ) && !last.isNull() && !isSimilar( current, last ) ) break; - multi_img.append( Image( {0,0}, current ) ); + multi_img.append( Image( current ) ); last = current; }