mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-14 23:38:14 +00:00
Fixed SDL_ScaleMode values for consistency
This commit is contained in:
@@ -925,7 +925,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
|
||||
|
||||
SDL_SetRenderViewport(renderer, NULL);
|
||||
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_MATCH, SDL_ScaleModeLinear);
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_MATCH, SDL_SCALEMODE_LINEAR);
|
||||
|
||||
SDL_AddEventWatch(SDL_RendererEventWatch, renderer);
|
||||
|
||||
@@ -1106,11 +1106,11 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return SDL_ScaleModeNearest;
|
||||
return SDL_SCALEMODE_NEAREST;
|
||||
} else if (SDL_strcasecmp(hint, "linear") == 0) {
|
||||
return SDL_ScaleModeLinear;
|
||||
return SDL_SCALEMODE_LINEAR;
|
||||
} else if (SDL_strcasecmp(hint, "best") == 0) {
|
||||
return SDL_ScaleModeBest;
|
||||
return SDL_SCALEMODE_BEST;
|
||||
} else {
|
||||
return (SDL_ScaleMode)SDL_atoi(hint);
|
||||
}
|
||||
@@ -2231,7 +2231,7 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_ScaleModeNearest);
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2271,7 +2271,7 @@ int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_R
|
||||
return UpdateLogicalPresentation(renderer);
|
||||
|
||||
error:
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_ScaleModeNearest);
|
||||
SDL_SetRenderLogicalPresentation(renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED, SDL_SCALEMODE_NEAREST);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -529,7 +529,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
if (texturedata == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
texturedata->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
|
||||
texture->driverdata = texturedata;
|
||||
|
||||
@@ -733,7 +733,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture
|
||||
return;
|
||||
}
|
||||
|
||||
texturedata->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
texturedata->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
}
|
||||
|
||||
static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
@@ -1070,7 +1070,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
|
||||
texture->driverdata = textureData;
|
||||
|
||||
@@ -1546,7 +1546,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
return;
|
||||
}
|
||||
|
||||
textureData->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
textureData->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3D11_FILTER_MIN_MAG_MIP_POINT : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
}
|
||||
|
||||
static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
@@ -1432,7 +1432,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
textureData->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
textureData->scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
|
||||
texture->driverdata = textureData;
|
||||
textureData->mainTextureFormat = textureFormat;
|
||||
@@ -2076,7 +2076,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
return;
|
||||
}
|
||||
|
||||
textureData->scaleMode = (scaleMode == SDL_ScaleModeNearest) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
textureData->scaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? D3D12_FILTER_MIN_MAG_MIP_POINT : D3D12_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
}
|
||||
|
||||
static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
@@ -621,7 +621,7 @@ METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
}
|
||||
#endif /* SDL_HAVE_YUV */
|
||||
texturedata = [[METAL_TextureData alloc] init];
|
||||
if (texture->scaleMode == SDL_ScaleModeNearest) {
|
||||
if (texture->scaleMode == SDL_SCALEMODE_NEAREST) {
|
||||
texturedata.mtlsampler = data.mtlsamplernearest;
|
||||
} else {
|
||||
texturedata.mtlsampler = data.mtlsamplerlinear;
|
||||
@@ -994,7 +994,7 @@ static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
|
||||
METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata;
|
||||
|
||||
if (scaleMode == SDL_ScaleModeNearest) {
|
||||
if (scaleMode == SDL_SCALEMODE_NEAREST) {
|
||||
texturedata.mtlsampler = data.mtlsamplernearest;
|
||||
} else {
|
||||
texturedata.mtlsampler = data.mtlsamplerlinear;
|
||||
|
@@ -525,7 +525,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
data->format = format;
|
||||
data->formattype = type;
|
||||
scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||
renderdata->glEnable(textype);
|
||||
renderdata->glBindTexture(textype, data->texture);
|
||||
renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, scaleMode);
|
||||
@@ -840,7 +840,7 @@ static void GL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata;
|
||||
const GLenum textype = renderdata->textype;
|
||||
GL_TextureData *data = (GL_TextureData *)texture->driverdata;
|
||||
GLenum glScaleMode = (scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||
|
||||
renderdata->glBindTexture(textype, data->texture);
|
||||
renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, glScaleMode);
|
||||
|
@@ -1463,7 +1463,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
data->texture_u = 0;
|
||||
data->texture_v = 0;
|
||||
#endif
|
||||
scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||
|
||||
/* Allocate a blob for image renderdata */
|
||||
if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
@@ -1824,7 +1824,7 @@ static void GLES2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
{
|
||||
GLES2_RenderData *renderdata = (GLES2_RenderData *)renderer->driverdata;
|
||||
GLES2_TextureData *data = (GLES2_TextureData *)texture->driverdata;
|
||||
GLenum glScaleMode = (scaleMode == SDL_ScaleModeNearest) ? GL_NEAREST : GL_LINEAR;
|
||||
GLenum glScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST) ? GL_NEAREST : GL_LINEAR;
|
||||
|
||||
#if SDL_HAVE_YUV
|
||||
if (data->yuv) {
|
||||
|
@@ -177,7 +177,7 @@ static void PS2_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture
|
||||
gskit scale mode is either GS_FILTER_NEAREST (good for tile-map)
|
||||
or GS_FILTER_LINEAR (good for scaling)
|
||||
*/
|
||||
uint32_t gsKitScaleMode = (scaleMode == SDL_ScaleModeNearest
|
||||
uint32_t gsKitScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST
|
||||
? GS_FILTER_NEAREST
|
||||
: GS_FILTER_LINEAR);
|
||||
ps2_texture->Filter = gsKitScaleMode;
|
||||
|
@@ -542,7 +542,7 @@ static int TextureShouldSwizzle(PSP_TextureData *psp_texture, SDL_Texture *textu
|
||||
static void TextureActivate(SDL_Texture *texture)
|
||||
{
|
||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
||||
int scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? GU_NEAREST : GU_LINEAR;
|
||||
int scaleMode = (texture->scaleMode == SDL_SCALEMODE_NEAREST) ? GU_NEAREST : GU_LINEAR;
|
||||
|
||||
/* Swizzling is useless with small textures. */
|
||||
if (TextureShouldSwizzle(psp_texture, texture)) {
|
||||
|
@@ -416,7 +416,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, center,
|
||||
&rect_dest, &cangle, &sangle);
|
||||
src_rotated = SDLgfx_rotateSurface(src_clone, angle,
|
||||
(texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL,
|
||||
(texture->scaleMode == SDL_SCALEMODE_NEAREST) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL,
|
||||
&rect_dest, cangle, sangle, center);
|
||||
if (src_rotated == NULL) {
|
||||
retval = -1;
|
||||
|
@@ -607,7 +607,7 @@ static void VITA_GXM_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *te
|
||||
or SCE_GXM_TEXTURE_FILTER_LINEAR (good for scaling)
|
||||
*/
|
||||
|
||||
int vitaScaleMode = (scaleMode == SDL_ScaleModeNearest
|
||||
int vitaScaleMode = (scaleMode == SDL_SCALEMODE_NEAREST
|
||||
? SCE_GXM_TEXTURE_FILTER_POINT
|
||||
: SCE_GXM_TEXTURE_FILTER_LINEAR);
|
||||
gxm_texture_set_filters(vita_texture->tex, vitaScaleMode, vitaScaleMode);
|
||||
|
Reference in New Issue
Block a user