mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-17 17:11:19 +00:00
- implement vid_scalemode = 6 - sets absolute minimum scaling to fill entire screen - useful for speeding up software rendering
This commit is contained in:
parent
318da33e39
commit
a53652f36e
1 changed files with 30 additions and 2 deletions
|
@ -27,7 +27,7 @@
|
|||
#include "v_video.h"
|
||||
#include "templates.h"
|
||||
|
||||
#define NUMSCALEMODES 6
|
||||
#define NUMSCALEMODES 7
|
||||
|
||||
extern bool setsizeneeded;
|
||||
|
||||
|
@ -61,6 +61,33 @@ namespace
|
|||
bool isScaled43;
|
||||
bool isCustom;
|
||||
};
|
||||
|
||||
float v_MinimumToFill()
|
||||
{
|
||||
// sx = screen x dimension, sy = same for y
|
||||
float sx = (float)screen->GetClientWidth(), sy = (float)screen->GetClientHeight();
|
||||
static float lastsx = 0., lastsy = 0., result = 0.;
|
||||
if (lastsx != sx || lastsy != sy)
|
||||
{
|
||||
if (sx <= 0. || sy <= 0.)
|
||||
return 1.; // prevent x/0 error
|
||||
// set absolute minimum scale to fill the entire screen but get as close to 640x400 as possible
|
||||
float ssx = 640. / sx, ssy = 400. / sy;
|
||||
result = (ssx < ssy) ? ssy : ssx;
|
||||
lastsx = sx;
|
||||
lastsy = sy;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
inline uint32_t v_mfillX()
|
||||
{
|
||||
return screen ? (uint32_t)((float)screen->GetClientWidth() * v_MinimumToFill()) : 640;
|
||||
}
|
||||
inline uint32_t v_mfillY()
|
||||
{
|
||||
return screen ? (uint32_t)((float)screen->GetClientHeight() * v_MinimumToFill()) : 400;
|
||||
}
|
||||
|
||||
v_ScaleTable vScaleTable[NUMSCALEMODES] =
|
||||
{
|
||||
// isValid, isLinear, GetScaledWidth(), GetScaledHeight(), isScaled43, isCustom
|
||||
|
@ -68,8 +95,9 @@ namespace
|
|||
{ true, true, [](uint32_t Width)->uint32_t { return Width; }, [](uint32_t Height)->uint32_t { return Height; }, false, false }, // 1 - Native (Linear)
|
||||
{ true, false, [](uint32_t Width)->uint32_t { return 640; }, [](uint32_t Height)->uint32_t { return 400; }, true, false }, // 2 - 640x400 (formerly 320x200)
|
||||
{ true, true, [](uint32_t Width)->uint32_t { return 960; }, [](uint32_t Height)->uint32_t { return 600; }, true, false }, // 3 - 960x600 (formerly 640x400)
|
||||
{ true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true, false }, // 4 - 1280x800
|
||||
{ true, true, [](uint32_t Width)->uint32_t { return 1280; }, [](uint32_t Height)->uint32_t { return 800; }, true, false }, // 4 - 1280x800
|
||||
{ true, true, [](uint32_t Width)->uint32_t { return vid_scale_customwidth; }, [](uint32_t Height)->uint32_t { return vid_scale_customheight; }, true, true }, // 5 - Custom
|
||||
{ true, true, [](uint32_t Width)->uint32_t { return v_mfillX(); }, [](uint32_t Height)->uint32_t { return v_mfillY(); }, false, false }, // 6 - Minimum Scale to Fill Entire Screen
|
||||
};
|
||||
bool isOutOfBounds(int x)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue