|
|
|
|
@@ -1089,7 +1089,6 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
int w, h;
|
|
|
|
|
int set_w, set_h;
|
|
|
|
|
SDL_RendererLogicalPresentation set_presentation_mode;
|
|
|
|
|
SDL_ScaleMode set_scale_mode;
|
|
|
|
|
SDL_FRect set_rect;
|
|
|
|
|
const int factor = 2;
|
|
|
|
|
|
|
|
|
|
@@ -1108,16 +1107,13 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
|
|
|
|
|
/* Set the logical size and do a fill operation */
|
|
|
|
|
CHECK_FUNC(SDL_GetCurrentRenderOutputSize, (renderer, &w, &h))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, w / factor, h / factor,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
|
|
|
|
SDL_SCALEMODE_NEAREST))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode, &set_scale_mode))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, w / factor, h / factor, SDL_LOGICAL_PRESENTATION_LETTERBOX))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_w == (w / factor) &&
|
|
|
|
|
set_h == (h / factor) &&
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_LETTERBOX &&
|
|
|
|
|
set_scale_mode == SDL_SCALEMODE_NEAREST,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d, %d", set_w, set_h, set_presentation_mode, set_scale_mode);
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d", set_w, set_h, set_presentation_mode);
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentationRect, (renderer, &set_rect))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_rect.x == 0.0f &&
|
|
|
|
|
@@ -1131,16 +1127,13 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
rect.w = (float)viewport.w / factor;
|
|
|
|
|
rect.h = (float)viewport.h / factor;
|
|
|
|
|
CHECK_FUNC(SDL_RenderFillRect, (renderer, &rect))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_DISABLED,
|
|
|
|
|
SDL_SCALEMODE_NEAREST))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode, &set_scale_mode))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_w == 0 &&
|
|
|
|
|
set_h == 0 &&
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_DISABLED &&
|
|
|
|
|
set_scale_mode == SDL_SCALEMODE_NEAREST,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d, %d", set_w, set_h, set_presentation_mode, set_scale_mode);
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_DISABLED,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d", set_w, set_h, set_presentation_mode);
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentationRect, (renderer, &set_rect))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_rect.x == 0.0f &&
|
|
|
|
|
@@ -1157,20 +1150,16 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
|
|
|
|
|
/* Set the logical size and viewport and do a fill operation */
|
|
|
|
|
CHECK_FUNC(SDL_GetCurrentRenderOutputSize, (renderer, &w, &h))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, w / factor, h / factor,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
|
|
|
|
SDL_SCALEMODE_NEAREST))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, w / factor, h / factor, SDL_LOGICAL_PRESENTATION_LETTERBOX))
|
|
|
|
|
viewport.x = (TESTRENDER_SCREEN_W / 4) / factor;
|
|
|
|
|
viewport.y = (TESTRENDER_SCREEN_H / 4) / factor;
|
|
|
|
|
viewport.w = (TESTRENDER_SCREEN_W / 2) / factor;
|
|
|
|
|
viewport.h = (TESTRENDER_SCREEN_H / 2) / factor;
|
|
|
|
|
viewport.w = TESTRENDER_SCREEN_W / factor;
|
|
|
|
|
viewport.h = TESTRENDER_SCREEN_H / factor;
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderViewport, (renderer, &viewport))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderDrawColor, (renderer, 0, 255, 0, SDL_ALPHA_OPAQUE))
|
|
|
|
|
CHECK_FUNC(SDL_RenderFillRect, (renderer, NULL))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderViewport, (renderer, NULL))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_DISABLED,
|
|
|
|
|
SDL_SCALEMODE_NEAREST))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED))
|
|
|
|
|
|
|
|
|
|
/* Check to see if final image matches. */
|
|
|
|
|
compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE);
|
|
|
|
|
@@ -1196,15 +1185,13 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer,
|
|
|
|
|
w - 2 * (TESTRENDER_SCREEN_W / 4),
|
|
|
|
|
h,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
|
|
|
|
SDL_SCALEMODE_LINEAR))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode, &set_scale_mode))
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_LETTERBOX))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_w == w - 2 * (TESTRENDER_SCREEN_W / 4) &&
|
|
|
|
|
set_h == h &&
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_LETTERBOX &&
|
|
|
|
|
set_scale_mode == SDL_SCALEMODE_LINEAR,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d, %d", set_w, set_h, set_presentation_mode, set_scale_mode);
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_LETTERBOX,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d", set_w, set_h, set_presentation_mode);
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentationRect, (renderer, &set_rect))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_rect.x == 20.0f &&
|
|
|
|
|
@@ -1214,16 +1201,13 @@ static int SDLCALL render_testLogicalSize(void *arg)
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentationRect, got {%g, %g, %gx%g}", set_rect.x, set_rect.y, set_rect.w, set_rect.h);
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderDrawColor, (renderer, 0, 255, 0, SDL_ALPHA_OPAQUE))
|
|
|
|
|
CHECK_FUNC(SDL_RenderFillRect, (renderer, NULL))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0,
|
|
|
|
|
SDL_LOGICAL_PRESENTATION_DISABLED,
|
|
|
|
|
SDL_SCALEMODE_NEAREST))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode, &set_scale_mode))
|
|
|
|
|
CHECK_FUNC(SDL_SetRenderLogicalPresentation, (renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED))
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentation, (renderer, &set_w, &set_h, &set_presentation_mode))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_w == 0 &&
|
|
|
|
|
set_h == 0 &&
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_DISABLED &&
|
|
|
|
|
set_scale_mode == SDL_SCALEMODE_NEAREST,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d, %d", set_w, set_h, set_presentation_mode, set_scale_mode);
|
|
|
|
|
set_presentation_mode == SDL_LOGICAL_PRESENTATION_DISABLED,
|
|
|
|
|
"Validate result from SDL_GetRenderLogicalPresentation, got %d, %d, %d", set_w, set_h, set_presentation_mode);
|
|
|
|
|
CHECK_FUNC(SDL_GetRenderLogicalPresentationRect, (renderer, &set_rect))
|
|
|
|
|
SDLTest_AssertCheck(
|
|
|
|
|
set_rect.x == 0.0f &&
|
|
|
|
|
|