From 45563274160555abb31e6fb376e428fcc43d98fb Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 25 Nov 2020 19:43:46 +0100 Subject: [PATCH] Gui: [skip ci] when embedding app icon into thumbnail then only scale it if the offscreen image could be created from the active view --- src/Gui/Thumbnail.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index 9d5016e33e..a4a7bf7da0 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -99,14 +99,18 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const } // Get app icon and resize to half size to insert in topbottom position over the current view snapshot - QPixmap app_icon = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str()); - QPixmap px = app_icon.scaled(this->size / 4, this->size /4); + QPixmap appIcon = Gui::BitmapFactory().pixmap(App::Application::Config()["AppIcon"].c_str()); + QPixmap px = appIcon; if (!img.isNull()) { if (App::GetApplication().GetParameterGroupByPath - ("User parameter:BaseApp/Preferences/Document")->GetBool("AddThumbnailLogo",true)) - px = BitmapFactory().merge(QPixmap::fromImage(img),px,BitmapFactoryInst::BottomRight); - else + ("User parameter:BaseApp/Preferences/Document")->GetBool("AddThumbnailLogo",true)) { + // only scale app icon if an offscreen image could be created + appIcon = appIcon.scaled(this->size / 4, this->size /4); + px = BitmapFactory().merge(QPixmap::fromImage(img), appIcon, BitmapFactoryInst::BottomRight); + } + else { px = QPixmap::fromImage(img); + } } if (!px.isNull()) {