From 83b8a800d84d11d34461d462c6816e8b14ea1c3a Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sun, 18 Oct 2020 19:08:27 +0200 Subject: [PATCH] Fix issue #909, Have ratio correction first and then scale (#1047) --- include/utils/hyperion.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/utils/hyperion.h b/include/utils/hyperion.h index e930a71a..af650f63 100644 --- a/include/utils/hyperion.h +++ b/include/utils/hyperion.h @@ -234,12 +234,6 @@ namespace hyperion { midPointsY.erase(std::unique(midPointsY.begin(), midPointsY.end()), midPointsY.end()); QSize gridSize( midPointsX.size(), midPointsY.size() ); - //Debug(_log, "LED layout grid size: %dx%d", gridSize.width(), gridSize.height()); - - // Limit to 80px for performance reasons - const int pl = 80; - if(gridSize.width() > pl || gridSize.height() > pl) - gridSize.scale(pl, pl, Qt::KeepAspectRatio); // Correct the grid in case it is malformed in width vs height // Expected is at least 50% of width <-> height @@ -248,6 +242,13 @@ namespace hyperion { else if((gridSize.width() / gridSize.height()) < 0.5) gridSize.setWidth(qMax(1,gridSize.height()/2)); + // Limit to 80px for performance reasons + const int pl = 80; + if(gridSize.width() > pl || gridSize.height() > pl) + { + gridSize.scale(pl, pl, Qt::KeepAspectRatio); + } + return gridSize; } };