mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-21 02:51:37 +00:00
- enforce 160x100 minimum in actual scaling code
# Conflicts: # src/r_videoscale.cpp
This commit is contained in:
parent
3b432a99e8
commit
c42c4afeeb
1 changed files with 25 additions and 7 deletions
|
@ -28,11 +28,26 @@
|
|||
|
||||
#define NUMSCALEMODES 6
|
||||
|
||||
extern bool setsizeneeded;
|
||||
|
||||
EXTERN_CVAR(Int, vid_aspect)
|
||||
CVAR(Int, vid_scale_customwidth, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, vid_scale_customheight, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Int, vid_scale_customwidth, 320, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 160)
|
||||
self = 160;
|
||||
setsizeneeded = true;
|
||||
}
|
||||
CUSTOM_CVAR(Int, vid_scale_customheight, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 100)
|
||||
self = 100;
|
||||
setsizeneeded = true;
|
||||
}
|
||||
CVAR(Bool, vid_scale_customlinear, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, vid_scale_customstretched, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR(Bool, vid_scale_customstretched, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
setsizeneeded = true;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -57,8 +72,6 @@ namespace
|
|||
};
|
||||
bool isOutOfBounds(int x)
|
||||
{
|
||||
if (vScaleTable[x].isCustom)
|
||||
return ((vid_scale_customwidth < 160) || (vid_scale_customheight < 100));
|
||||
return (x < 0 || x >= NUMSCALEMODES || vScaleTable[x].isValid == false);
|
||||
}
|
||||
}
|
||||
|
@ -88,13 +101,18 @@ bool ViewportLinearScale()
|
|||
return (vid_scalefactor > 1.0) ? true : vScaleTable[vid_scalemode].isLinear;
|
||||
}
|
||||
|
||||
inline int max(int a, int b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
int ViewportScaledWidth(int width, int height)
|
||||
{
|
||||
if (isOutOfBounds(vid_scalemode))
|
||||
vid_scalemode = 0;
|
||||
if (vid_cropaspect && height > 0)
|
||||
width = ((float)width/height > ActiveRatio(width, height)) ? (int)(height * ActiveRatio(width, height)) : width;
|
||||
return vScaleTable[vid_scalemode].GetScaledWidth((int)((float)width * vid_scalefactor));
|
||||
return max(160, vScaleTable[vid_scalemode].GetScaledWidth((int)((float)width * vid_scalefactor)));
|
||||
}
|
||||
|
||||
int ViewportScaledHeight(int width, int height)
|
||||
|
@ -103,7 +121,7 @@ int ViewportScaledHeight(int width, int height)
|
|||
vid_scalemode = 0;
|
||||
if (vid_cropaspect && height > 0)
|
||||
height = ((float)width/height < ActiveRatio(width, height)) ? (int)(width / ActiveRatio(width, height)) : height;
|
||||
return vScaleTable[vid_scalemode].GetScaledHeight((int)((float)height * vid_scalefactor));
|
||||
return max(100, vScaleTable[vid_scalemode].GetScaledHeight((int)((float)height * vid_scalefactor)));
|
||||
}
|
||||
|
||||
bool ViewportIsScaled43()
|
||||
|
|
Loading…
Reference in a new issue