Skip to content

Commit

Permalink
Move splash screen resizing to makePixmap()
Browse files Browse the repository at this point in the history
  • Loading branch information
10110111 committed Jan 20, 2025
1 parent 0c5109b commit b505720
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/StelSplashScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ static constexpr int BASE_FONT_SIZE = 11;

SplashScreen::SplashScreenWidget* SplashScreen::instance;

static QPixmap makePixmap()
static QPixmap makePixmap(const double sizeRatio)
{
QPixmap pixmap(StelFileMgr::findFile("data/splash.png"));
pixmap = pixmap.scaledToHeight(std::lround(pixmap.height() * sizeRatio),
Qt::SmoothTransformation);
return pixmap;
}

void SplashScreen::present(const double sizeRatio)
{
Q_ASSERT(!instance);
instance=new SplashScreenWidget(makePixmap(), sizeRatio);
instance=new SplashScreenWidget(makePixmap(sizeRatio), sizeRatio);
instance->show();
instance->ensureFirstPaint();
}
Expand All @@ -63,8 +65,7 @@ void SplashScreen::clearMessage()
}

SplashScreen::SplashScreenWidget::SplashScreenWidget(QPixmap const& pixmap, const double sizeRatio)
: QSplashScreen(pixmap.scaledToHeight(std::lround(pixmap.height() * sizeRatio),
Qt::SmoothTransformation))
: QSplashScreen(pixmap)
{
splashFont.setPixelSize(std::lround(BASE_FONT_SIZE * sizeRatio));

Expand Down

0 comments on commit b505720

Please sign in to comment.