mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Fixed SDL_ScaleMode values for consistency
This commit is contained in:
		| @@ -2388,3 +2388,15 @@ SDL_DisplayMode e; | |||||||
| - SDL_RenderLogicalToWindow | - SDL_RenderLogicalToWindow | ||||||
| + SDL_RenderCoordinatesToWindow | + SDL_RenderCoordinatesToWindow | ||||||
|   (...) |   (...) | ||||||
|  | @@ | ||||||
|  | @@ | ||||||
|  | - SDL_ScaleModeNearest | ||||||
|  | + SDL_SCALEMODE_NEAREST | ||||||
|  | @@ | ||||||
|  | @@ | ||||||
|  | - SDL_ScaleModeLinear | ||||||
|  | + SDL_SCALEMODE_LINEAR | ||||||
|  | @@ | ||||||
|  | @@ | ||||||
|  | - SDL_ScaleModeBest | ||||||
|  | + SDL_SCALEMODE_BEST | ||||||
|   | |||||||
| @@ -649,6 +649,11 @@ The following functions have been removed: | |||||||
| * SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE | * SDL_RenderSetIntegerScale() - this is now explicit with SDL_LOGICAL_PRESENTATION_INTEGER_SCALE | ||||||
| * SDL_RenderTargetSupported() - render targets are always supported | * SDL_RenderTargetSupported() - render targets are always supported | ||||||
|  |  | ||||||
|  | The following symbols have been renamed: | ||||||
|  | * SDL_ScaleModeBest => SDL_SCALEMODE_BEST | ||||||
|  | * SDL_ScaleModeLinear => SDL_SCALEMODE_LINEAR | ||||||
|  | * SDL_ScaleModeNearest => SDL_SCALEMODE_NEAREST | ||||||
|  |  | ||||||
| ## SDL_rwops.h | ## SDL_rwops.h | ||||||
|  |  | ||||||
| The following symbols have been renamed: | The following symbols have been renamed: | ||||||
|   | |||||||
| @@ -371,6 +371,9 @@ | |||||||
| #define SDL_RenderSetVSync SDL_SetRenderVSync | #define SDL_RenderSetVSync SDL_SetRenderVSync | ||||||
| #define SDL_RenderSetViewport SDL_SetRenderViewport | #define SDL_RenderSetViewport SDL_SetRenderViewport | ||||||
| #define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow | #define SDL_RenderWindowToLogical SDL_RenderCoordinatesFromWindow | ||||||
|  | #define SDL_ScaleModeBest SDL_SCALEMODE_BEST | ||||||
|  | #define SDL_ScaleModeLinear SDL_SCALEMODE_LINEAR | ||||||
|  | #define SDL_ScaleModeNearest SDL_SCALEMODE_NEAREST | ||||||
|  |  | ||||||
| /* ##SDL_rwops.h */ | /* ##SDL_rwops.h */ | ||||||
| #define RW_SEEK_CUR SDL_RW_SEEK_CUR | #define RW_SEEK_CUR SDL_RW_SEEK_CUR | ||||||
| @@ -757,6 +760,9 @@ | |||||||
| #define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync | #define SDL_RenderSetVSync SDL_RenderSetVSync_renamed_SDL_SetRenderVSync | ||||||
| #define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport | #define SDL_RenderSetViewport SDL_RenderSetViewport_renamed_SDL_SetRenderViewport | ||||||
| #define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow | #define SDL_RenderWindowToLogical SDL_RenderWindowToLogical_renamed_SDL_RenderCoordinatesFromWindow | ||||||
|  | #define SDL_ScaleModeBest SDL_ScaleModeBest_renamed_SDL_SCALEMODE_BEST | ||||||
|  | #define SDL_ScaleModeLinear SDL_ScaleModeLinear_renamed_SDL_SCALEMODE_LINEAR | ||||||
|  | #define SDL_ScaleModeNearest SDL_ScaleModeNearest_renamed_SDL_SCALEMODE_NEAREST | ||||||
|  |  | ||||||
| /* ##SDL_rwops.h */ | /* ##SDL_rwops.h */ | ||||||
| #define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR | #define RW_SEEK_CUR RW_SEEK_CUR_renamed_SDL_RW_SEEK_CUR | ||||||
|   | |||||||
| @@ -98,9 +98,9 @@ typedef struct SDL_Vertex | |||||||
|  */ |  */ | ||||||
| typedef enum | typedef enum | ||||||
| { | { | ||||||
|     SDL_ScaleModeNearest, /**< nearest pixel sampling */ |     SDL_SCALEMODE_NEAREST, /**< nearest pixel sampling */ | ||||||
|     SDL_ScaleModeLinear,  /**< linear filtering */ |     SDL_SCALEMODE_LINEAR,  /**< linear filtering */ | ||||||
|     SDL_ScaleModeBest     /**< anisotropic filtering */ |     SDL_SCALEMODE_BEST     /**< anisotropic filtering */ | ||||||
| } SDL_ScaleMode; | } SDL_ScaleMode; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
| @@ -925,7 +925,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl | |||||||
|  |  | ||||||
|     SDL_SetRenderViewport(renderer, NULL); |     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); |     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); |     const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); | ||||||
|  |  | ||||||
|     if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) { |     if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) { | ||||||
|         return SDL_ScaleModeNearest; |         return SDL_SCALEMODE_NEAREST; | ||||||
|     } else if (SDL_strcasecmp(hint, "linear") == 0) { |     } else if (SDL_strcasecmp(hint, "linear") == 0) { | ||||||
|         return SDL_ScaleModeLinear; |         return SDL_SCALEMODE_LINEAR; | ||||||
|     } else if (SDL_strcasecmp(hint, "best") == 0) { |     } else if (SDL_strcasecmp(hint, "best") == 0) { | ||||||
|         return SDL_ScaleModeBest; |         return SDL_SCALEMODE_BEST; | ||||||
|     } else { |     } else { | ||||||
|         return (SDL_ScaleMode)SDL_atoi(hint); |         return (SDL_ScaleMode)SDL_atoi(hint); | ||||||
|     } |     } | ||||||
| @@ -2231,7 +2231,7 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer) | |||||||
|     return 0; |     return 0; | ||||||
|  |  | ||||||
| error: | 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; |     return -1; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -2271,7 +2271,7 @@ int SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_R | |||||||
|     return UpdateLogicalPresentation(renderer); |     return UpdateLogicalPresentation(renderer); | ||||||
|  |  | ||||||
| error: | 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; |     return -1; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -529,7 +529,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) | |||||||
|     if (texturedata == NULL) { |     if (texturedata == NULL) { | ||||||
|         return SDL_OutOfMemory(); |         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; |     texture->driverdata = texturedata; | ||||||
|  |  | ||||||
| @@ -733,7 +733,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture | |||||||
|         return; |         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) | 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(); |         SDL_OutOfMemory(); | ||||||
|         return -1; |         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; |     texture->driverdata = textureData; | ||||||
|  |  | ||||||
| @@ -1546,7 +1546,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu | |||||||
|         return; |         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) | 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(); |         SDL_OutOfMemory(); | ||||||
|         return -1; |         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; |     texture->driverdata = textureData; | ||||||
|     textureData->mainTextureFormat = textureFormat; |     textureData->mainTextureFormat = textureFormat; | ||||||
| @@ -2076,7 +2076,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu | |||||||
|         return; |         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) | 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 */ | #endif /* SDL_HAVE_YUV */ | ||||||
|         texturedata = [[METAL_TextureData alloc] init]; |         texturedata = [[METAL_TextureData alloc] init]; | ||||||
|         if (texture->scaleMode == SDL_ScaleModeNearest) { |         if (texture->scaleMode == SDL_SCALEMODE_NEAREST) { | ||||||
|             texturedata.mtlsampler = data.mtlsamplernearest; |             texturedata.mtlsampler = data.mtlsamplernearest; | ||||||
|         } else { |         } else { | ||||||
|             texturedata.mtlsampler = data.mtlsamplerlinear; |             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_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata; | ||||||
|         METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; |         METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; | ||||||
|  |  | ||||||
|         if (scaleMode == SDL_ScaleModeNearest) { |         if (scaleMode == SDL_SCALEMODE_NEAREST) { | ||||||
|             texturedata.mtlsampler = data.mtlsamplernearest; |             texturedata.mtlsampler = data.mtlsamplernearest; | ||||||
|         } else { |         } else { | ||||||
|             texturedata.mtlsampler = data.mtlsamplerlinear; |             texturedata.mtlsampler = data.mtlsamplerlinear; | ||||||
|   | |||||||
| @@ -525,7 +525,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) | |||||||
|  |  | ||||||
|     data->format = format; |     data->format = format; | ||||||
|     data->formattype = type; |     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->glEnable(textype); | ||||||
|     renderdata->glBindTexture(textype, data->texture); |     renderdata->glBindTexture(textype, data->texture); | ||||||
|     renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, scaleMode); |     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; |     GL_RenderData *renderdata = (GL_RenderData *)renderer->driverdata; | ||||||
|     const GLenum textype = renderdata->textype; |     const GLenum textype = renderdata->textype; | ||||||
|     GL_TextureData *data = (GL_TextureData *)texture->driverdata; |     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->glBindTexture(textype, data->texture); | ||||||
|     renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER, glScaleMode); |     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_u = 0; | ||||||
|     data->texture_v = 0; |     data->texture_v = 0; | ||||||
| #endif | #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 */ |     /* Allocate a blob for image renderdata */ | ||||||
|     if (texture->access == SDL_TEXTUREACCESS_STREAMING) { |     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_RenderData *renderdata = (GLES2_RenderData *)renderer->driverdata; | ||||||
|     GLES2_TextureData *data = (GLES2_TextureData *)texture->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 SDL_HAVE_YUV | ||||||
|     if (data->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) |      gskit scale mode is either GS_FILTER_NEAREST (good for tile-map) | ||||||
|      or GS_FILTER_LINEAR (good for scaling) |      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_NEAREST | ||||||
|                                    : GS_FILTER_LINEAR); |                                    : GS_FILTER_LINEAR); | ||||||
|     ps2_texture->Filter = gsKitScaleMode; |     ps2_texture->Filter = gsKitScaleMode; | ||||||
|   | |||||||
| @@ -542,7 +542,7 @@ static int TextureShouldSwizzle(PSP_TextureData *psp_texture, SDL_Texture *textu | |||||||
| static void TextureActivate(SDL_Texture *texture) | static void TextureActivate(SDL_Texture *texture) | ||||||
| { | { | ||||||
|     PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata; |     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. */ |     /* Swizzling is useless with small textures. */ | ||||||
|     if (TextureShouldSwizzle(psp_texture, texture)) { |     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, |         SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, center, | ||||||
|                                        &rect_dest, &cangle, &sangle); |                                        &rect_dest, &cangle, &sangle); | ||||||
|         src_rotated = SDLgfx_rotateSurface(src_clone, angle, |         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); |                                            &rect_dest, cangle, sangle, center); | ||||||
|         if (src_rotated == NULL) { |         if (src_rotated == NULL) { | ||||||
|             retval = -1; |             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) |      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_POINT | ||||||
|                              : SCE_GXM_TEXTURE_FILTER_LINEAR); |                              : SCE_GXM_TEXTURE_FILTER_LINEAR); | ||||||
|     gxm_texture_set_filters(vita_texture->tex, vitaScaleMode, vitaScaleMode); |     gxm_texture_set_filters(vita_texture->tex, vitaScaleMode, vitaScaleMode); | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags) | |||||||
|     state->window_w = DEFAULT_WINDOW_WIDTH; |     state->window_w = DEFAULT_WINDOW_WIDTH; | ||||||
|     state->window_h = DEFAULT_WINDOW_HEIGHT; |     state->window_h = DEFAULT_WINDOW_HEIGHT; | ||||||
|     state->logical_presentation = SDL_LOGICAL_PRESENTATION_MATCH; |     state->logical_presentation = SDL_LOGICAL_PRESENTATION_MATCH; | ||||||
|     state->logical_scale_mode = SDL_ScaleModeLinear; |     state->logical_scale_mode = SDL_SCALEMODE_LINEAR; | ||||||
|     state->num_windows = 1; |     state->num_windows = 1; | ||||||
|     state->audiospec.freq = 22050; |     state->audiospec.freq = 22050; | ||||||
|     state->audiospec.format = AUDIO_S16; |     state->audiospec.format = AUDIO_S16; | ||||||
| @@ -440,15 +440,15 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) | |||||||
|             return -1; |             return -1; | ||||||
|         } |         } | ||||||
|         if (SDL_strcasecmp(argv[index], "nearest") == 0) { |         if (SDL_strcasecmp(argv[index], "nearest") == 0) { | ||||||
|             state->logical_scale_mode = SDL_ScaleModeNearest; |             state->logical_scale_mode = SDL_SCALEMODE_NEAREST; | ||||||
|             return 2; |             return 2; | ||||||
|         } |         } | ||||||
|         if (SDL_strcasecmp(argv[index], "linear") == 0) { |         if (SDL_strcasecmp(argv[index], "linear") == 0) { | ||||||
|             state->logical_scale_mode = SDL_ScaleModeLinear; |             state->logical_scale_mode = SDL_SCALEMODE_LINEAR; | ||||||
|             return 2; |             return 2; | ||||||
|         } |         } | ||||||
|         if (SDL_strcasecmp(argv[index], "best") == 0) { |         if (SDL_strcasecmp(argv[index], "best") == 0) { | ||||||
|             state->logical_scale_mode = SDL_ScaleModeBest; |             state->logical_scale_mode = SDL_SCALEMODE_BEST; | ||||||
|             return 2; |             return 2; | ||||||
|         } |         } | ||||||
|         return -1; |         return -1; | ||||||
| @@ -1001,13 +1001,13 @@ static void SDLTest_PrintLogicalPresentation(char *text, size_t maxlen, SDL_Rend | |||||||
| static void SDLTest_PrintScaleMode(char *text, size_t maxlen, SDL_ScaleMode scale_mode) | static void SDLTest_PrintScaleMode(char *text, size_t maxlen, SDL_ScaleMode scale_mode) | ||||||
| { | { | ||||||
|     switch (scale_mode) { |     switch (scale_mode) { | ||||||
|     case SDL_ScaleModeNearest: |     case SDL_SCALEMODE_NEAREST: | ||||||
|         SDL_snprintfcat(text, maxlen, "NEAREST"); |         SDL_snprintfcat(text, maxlen, "NEAREST"); | ||||||
|         break; |         break; | ||||||
|     case SDL_ScaleModeLinear: |     case SDL_SCALEMODE_LINEAR: | ||||||
|         SDL_snprintfcat(text, maxlen, "LINEAR"); |         SDL_snprintfcat(text, maxlen, "LINEAR"); | ||||||
|         break; |         break; | ||||||
|     case SDL_ScaleModeBest: |     case SDL_SCALEMODE_BEST: | ||||||
|         SDL_snprintfcat(text, maxlen, "BEST"); |         SDL_snprintfcat(text, maxlen, "BEST"); | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|   | |||||||
| @@ -29,13 +29,13 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_S | |||||||
| int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | ||||||
|                     SDL_Surface *dst, const SDL_Rect *dstrect) |                     SDL_Surface *dst, const SDL_Rect *dstrect) | ||||||
| { | { | ||||||
|     return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); |     return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); | ||||||
| } | } | ||||||
|  |  | ||||||
| int SDL_SoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, | int SDL_SoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, | ||||||
|                           SDL_Surface *dst, const SDL_Rect *dstrect) |                           SDL_Surface *dst, const SDL_Rect *dstrect) | ||||||
| { | { | ||||||
|     return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_ScaleModeLinear); |     return SDL_UpperSoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); | ||||||
| } | } | ||||||
|  |  | ||||||
| static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | ||||||
| @@ -51,7 +51,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | |||||||
|         return SDL_SetError("Only works with same format surfaces"); |         return SDL_SetError("Only works with same format surfaces"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (scaleMode != SDL_ScaleModeNearest) { |     if (scaleMode != SDL_SCALEMODE_NEAREST) { | ||||||
|         if (src->format->BytesPerPixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) { |         if (src->format->BytesPerPixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) { | ||||||
|             return SDL_SetError("Wrong format"); |             return SDL_SetError("Wrong format"); | ||||||
|         } |         } | ||||||
| @@ -114,7 +114,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, | |||||||
|         src_locked = 1; |         src_locked = 1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (scaleMode == SDL_ScaleModeNearest) { |     if (scaleMode == SDL_SCALEMODE_NEAREST) { | ||||||
|         ret = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect); |         ret = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect); | ||||||
|     } else { |     } else { | ||||||
|         ret = SDL_LowerSoftStretchLinear(src, srcrect, dst, dstrect); |         ret = SDL_LowerSoftStretchLinear(src, srcrect, dst, dstrect); | ||||||
|   | |||||||
| @@ -759,7 +759,7 @@ int SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, | |||||||
| int SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, | int SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, | ||||||
|                         SDL_Surface *dst, SDL_Rect *dstrect) |                         SDL_Surface *dst, SDL_Rect *dstrect) | ||||||
| { | { | ||||||
|     return SDL_PrivateBlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); |     return SDL_PrivateBlitSurfaceScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); | ||||||
| } | } | ||||||
|  |  | ||||||
| int SDL_PrivateBlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, | int SDL_PrivateBlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, | ||||||
| @@ -927,7 +927,7 @@ int SDL_PrivateBlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, | |||||||
| int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, | int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, | ||||||
|                         SDL_Surface *dst, SDL_Rect *dstrect) |                         SDL_Surface *dst, SDL_Rect *dstrect) | ||||||
| { | { | ||||||
|     return SDL_PrivateBlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_ScaleModeNearest); |     return SDL_PrivateBlitSurfaceUncheckedScaled(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); | ||||||
| } | } | ||||||
|  |  | ||||||
| int SDL_PrivateBlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, | int SDL_PrivateBlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, | ||||||
| @@ -947,7 +947,7 @@ int SDL_PrivateBlitSurfaceUncheckedScaled(SDL_Surface *src, SDL_Rect *srcrect, | |||||||
|         SDL_InvalidateMap(src->map); |         SDL_InvalidateMap(src->map); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (scaleMode == SDL_ScaleModeNearest) { |     if (scaleMode == SDL_SCALEMODE_NEAREST) { | ||||||
|         if (!(src->map->info.flags & complex_copy_flags) && |         if (!(src->map->info.flags & complex_copy_flags) && | ||||||
|             src->format->format == dst->format->format && |             src->format->format == dst->format->format && | ||||||
|             !SDL_ISPIXELFORMAT_INDEXED(src->format->format)) { |             !SDL_ISPIXELFORMAT_INDEXED(src->format->format)) { | ||||||
|   | |||||||
| @@ -368,7 +368,7 @@ WatchJoystick(SDL_Joystick *joystick) | |||||||
|     /* scale for platforms that don't give you the window size you asked for. */ |     /* scale for platforms that don't give you the window size you asked for. */ | ||||||
|     SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, |     SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, | ||||||
|                                      SDL_LOGICAL_PRESENTATION_LETTERBOX, |                                      SDL_LOGICAL_PRESENTATION_LETTERBOX, | ||||||
|                                      SDL_ScaleModeLinear); |                                      SDL_SCALEMODE_LINEAR); | ||||||
|  |  | ||||||
|     /* Print info about the joystick we are watching */ |     /* Print info about the joystick we are watching */ | ||||||
|     name = SDL_GetJoystickName(joystick); |     name = SDL_GetJoystickName(joystick); | ||||||
|   | |||||||
| @@ -894,7 +894,7 @@ int render_testLogicalSize(void *arg) | |||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); | ||||||
|     ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, |     ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, |                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, | ||||||
|                                            SDL_ScaleModeNearest); |                                            SDL_SCALEMODE_NEAREST); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|     ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); |     ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); | ||||||
| @@ -907,7 +907,7 @@ int render_testLogicalSize(void *arg) | |||||||
|     (void)SDL_RenderPresent(renderer); |     (void)SDL_RenderPresent(renderer); | ||||||
|     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, |     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_DISABLED, |                                            SDL_LOGICAL_PRESENTATION_DISABLED, | ||||||
|                                            SDL_ScaleModeNearest); |                                            SDL_SCALEMODE_NEAREST); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|  |  | ||||||
|     /* Check to see if final image matches. */ |     /* Check to see if final image matches. */ | ||||||
| @@ -921,7 +921,7 @@ int render_testLogicalSize(void *arg) | |||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_GetRendererOutputSize, expected: 0, got: %i", ret); | ||||||
|     ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, |     ret = SDL_SetRenderLogicalPresentation(renderer, w / factor, h / factor, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, |                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, | ||||||
|                                            SDL_ScaleModeNearest); |                                            SDL_SCALEMODE_NEAREST); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|     viewport.x = (TESTRENDER_SCREEN_W / 4) / factor; |     viewport.x = (TESTRENDER_SCREEN_W / 4) / factor; | ||||||
|     viewport.y = (TESTRENDER_SCREEN_H / 4) / factor; |     viewport.y = (TESTRENDER_SCREEN_H / 4) / factor; | ||||||
| @@ -938,7 +938,7 @@ int render_testLogicalSize(void *arg) | |||||||
|     (void)SDL_RenderPresent(renderer); |     (void)SDL_RenderPresent(renderer); | ||||||
|     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, |     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_DISABLED, |                                            SDL_LOGICAL_PRESENTATION_DISABLED, | ||||||
|                                            SDL_ScaleModeNearest); |                                            SDL_SCALEMODE_NEAREST); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|  |  | ||||||
|     /* Check to see if final image matches. */ |     /* Check to see if final image matches. */ | ||||||
| @@ -969,7 +969,7 @@ int render_testLogicalSize(void *arg) | |||||||
|                                            w - 2 * (TESTRENDER_SCREEN_W / 4), |                                            w - 2 * (TESTRENDER_SCREEN_W / 4), | ||||||
|                                            h, |                                            h, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, |                                            SDL_LOGICAL_PRESENTATION_LETTERBOX, | ||||||
|                                            SDL_ScaleModeLinear); |                                            SDL_SCALEMODE_LINEAR); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|     ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); |     ret = SDL_SetRenderDrawColor(renderer, 0, 255, 0, SDL_ALPHA_OPAQUE); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderDrawColor, expected: 0, got: %i", ret); | ||||||
| @@ -978,7 +978,7 @@ int render_testLogicalSize(void *arg) | |||||||
|     (void)SDL_RenderPresent(renderer); |     (void)SDL_RenderPresent(renderer); | ||||||
|     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, |     ret = SDL_SetRenderLogicalPresentation(renderer, 0, 0, | ||||||
|                                            SDL_LOGICAL_PRESENTATION_DISABLED, |                                            SDL_LOGICAL_PRESENTATION_DISABLED, | ||||||
|                                            SDL_ScaleModeNearest); |                                            SDL_SCALEMODE_NEAREST); | ||||||
|     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); |     SDLTest_AssertCheck(ret == 0, "Validate result from SDL_SetRenderLogicalSize, expected: 0, got: %i", ret); | ||||||
|  |  | ||||||
|     /* Check to see if final image matches. */ |     /* Check to see if final image matches. */ | ||||||
|   | |||||||
| @@ -913,7 +913,7 @@ int main(int argc, char *argv[]) | |||||||
|     /* scale for platforms that don't give you the window size you asked for. */ |     /* scale for platforms that don't give you the window size you asked for. */ | ||||||
|     SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, |     SDL_SetRenderLogicalPresentation(screen, SCREEN_WIDTH, SCREEN_HEIGHT, | ||||||
|                                      SDL_LOGICAL_PRESENTATION_LETTERBOX, |                                      SDL_LOGICAL_PRESENTATION_LETTERBOX, | ||||||
|                                      SDL_ScaleModeLinear); |                                      SDL_SCALEMODE_LINEAR); | ||||||
|  |  | ||||||
|     background_front = LoadTexture(screen, "gamepadmap.bmp", SDL_FALSE, NULL, NULL); |     background_front = LoadTexture(screen, "gamepadmap.bmp", SDL_FALSE, NULL, NULL); | ||||||
|     background_back = LoadTexture(screen, "gamepadmap_back.bmp", SDL_FALSE, NULL, NULL); |     background_back = LoadTexture(screen, "gamepadmap_back.bmp", SDL_FALSE, NULL, NULL); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga