mirror of
https://github.com/YACReader/yacreader
synced 2025-07-17 20:44:32 -04:00
Reader: Add option to stop enlarging images in fit to width and height
This commit is contained in:
@ -316,24 +316,27 @@ void Viewer::updateContentSize()
|
||||
{
|
||||
//there is an image to resize
|
||||
if (currentPage != nullptr && !currentPage->isNull()) {
|
||||
QSize pagefit;
|
||||
QSize pagefit = currentPage->size();
|
||||
bool stretchImages = Configuration::getConfiguration().getSettings()->value(ENLARGE_IMAGES).toBool();
|
||||
YACReader::FitMode fitmode = Configuration::getConfiguration().getFitMode();
|
||||
switch (fitmode) {
|
||||
case YACReader::FitMode::FullRes:
|
||||
pagefit = currentPage->size();
|
||||
break;
|
||||
case YACReader::FitMode::ToWidth:
|
||||
pagefit = currentPage->size();
|
||||
if (!stretchImages && width() > pagefit.width()) {
|
||||
break;
|
||||
}
|
||||
pagefit.scale(width(), 0, Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
case YACReader::FitMode::ToHeight:
|
||||
pagefit = currentPage->size();
|
||||
if (!stretchImages && height() > pagefit.height()) {
|
||||
break;
|
||||
}
|
||||
pagefit.scale(0, height(), Qt::KeepAspectRatioByExpanding);
|
||||
break;
|
||||
//if everything fails showing the full page is a good idea
|
||||
case YACReader::FitMode::FullPage:
|
||||
default:
|
||||
pagefit = currentPage->size();
|
||||
pagefit.scale(size(), Qt::KeepAspectRatio);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user