[Scummvm-git-logs] scummvm master -> ea4d2d55d229da3451ed0be1c9c0c81aadd0aae9
criezy
criezy at scummvm.org
Wed Sep 8 21:23:13 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ea4d2d55d2 ENGINES: Scale ScummVM spash on HiDPI screens
Commit: ea4d2d55d229da3451ed0be1c9c0c81aadd0aae9
https://github.com/scummvm/scummvm/commit/ea4d2d55d229da3451ed0be1c9c0c81aadd0aae9
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2021-09-08T22:22:23+01:00
Commit Message:
ENGINES: Scale ScummVM spash on HiDPI screens
Changed paths:
engines/engine.cpp
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 6c82cea613..22dc482158 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -245,30 +245,47 @@ void splashScreen() {
}
g_system->showOverlay();
+ float scaleFactor = g_system->getHiDPIScreenFactor();
+ int16 overlayWidth = g_system->getOverlayWidth();
+ int16 overlayHeight = g_system->getOverlayHeight();
+ int16 scaledW = (int16)(overlayWidth / scaleFactor);
+ int16 scaledH = (int16)(overlayHeight / scaleFactor);
// Fill with orange
Graphics::Surface screen;
- screen.create(g_system->getOverlayWidth(), g_system->getOverlayHeight(), g_system->getOverlayFormat());
+ screen.create(scaledW, scaledH, g_system->getOverlayFormat());
screen.fillRect(Common::Rect(screen.w, screen.h), screen.format.ARGBToColor(0xff, 0xcc, 0x66, 0x00));
- // Load logo
- Graphics::Surface *logo = bitmap.getSurface()->convertTo(g_system->getOverlayFormat(), bitmap.getPalette());
- int lx = MAX((g_system->getOverlayWidth() - logo->w) / 2, 0);
- int ly = MAX((g_system->getOverlayHeight() - logo->h) / 2, 0);
-
// Print version information
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
int w = font->getStringWidth(gScummVMVersionDate);
- int x = g_system->getOverlayWidth() - w - 5; // lx + logo->w - w + 5;
- int y = g_system->getOverlayHeight() - font->getFontHeight() - 5; //ly + logo->h + 5;
+ int x = screen.w - w - 5;
+ int y = screen.h - font->getFontHeight() - 5;
font->drawString(&screen, gScummVMVersionDate, x, y, w, screen.format.ARGBToColor(0xff, 0, 0, 0));
- g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
+ // Scale if needed and copy to overlay
+ if (screen.w != overlayWidth) {
+ Graphics::Surface *scaledScreen = screen.scale(overlayWidth, overlayHeight, false);
+ g_system->copyRectToOverlay(scaledScreen->getPixels(), scaledScreen->pitch, 0, 0, scaledScreen->w, scaledScreen->h);
+ scaledScreen->free();
+ delete scaledScreen;
+ } else
+ g_system->copyRectToOverlay(screen.getPixels(), screen.pitch, 0, 0, screen.w, screen.h);
screen.free();
// Draw logo
- int lw = MIN<uint16>(logo->w, g_system->getOverlayWidth() - lx);
- int lh = MIN<uint16>(logo->h, g_system->getOverlayHeight() - ly);
+ Graphics::Surface *logo = bitmap.getSurface()->convertTo(g_system->getOverlayFormat(), bitmap.getPalette());
+ if (scaleFactor != 1.0f) {
+ Graphics::Surface *tmp = logo->scale(int16(logo->w * scaleFactor), int16(logo->h * scaleFactor), true);
+ logo->free();
+ delete logo;
+ logo = tmp;
+ }
+
+ int lx = MAX((overlayWidth - logo->w) / 2, 0);
+ int ly = MAX((overlayHeight - logo->h) / 2, 0);
+ int lw = MIN<uint16>(logo->w, overlayWidth - lx);
+ int lh = MIN<uint16>(logo->h, overlayHeight - ly);
g_system->copyRectToOverlay(logo->getPixels(), logo->pitch, lx, ly, lw, lh);
logo->free();
More information about the Scummvm-git-logs
mailing list