Fixed bug #2426 - SDL_RenderReadPixels result is unspecified and fails testautomation

Call SDL_RenderPresent after calling SDL_RenderReadPixels.
From "include/SDL_render.h":
"If you're using this on the main rendering target, it should be called after rendering and before SDL_RenderPresent()."
This commit is contained in:
Sylvain 2022-03-21 10:20:04 +01:00
parent 2b3c16eb5b
commit 7f1feee02a
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
1 changed files with 32 additions and 27 deletions

View File

@ -187,14 +187,14 @@ int render_testPrimitives (void *arg)
ret = SDL_RenderDrawLine(renderer, 79, 59, 50, 30 );
SDLTest_AssertCheck(ret == 0, "Validate result from SDL_RenderDrawLine, expected: 0, got: %i", ret);
/* Make current */
SDL_RenderPresent(renderer);
/* See if it's the same. */
referenceSurface = SDLTest_ImagePrimitives();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
/* Make current */
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -335,13 +335,13 @@ int render_testPrimitivesBlend (void *arg)
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_SetRenderDrawBlendMode, expected: 0, got: %i", checkFailCount2);
SDLTest_AssertCheck(checkFailCount3 == 0, "Validate results from calls to SDL_RenderDrawPoint, expected: 0, got: %i", checkFailCount3);
/* Make current */
SDL_RenderPresent(renderer);
/* See if it's the same. */
referenceSurface = SDLTest_ImagePrimitivesBlend();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
/* Make current */
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -404,13 +404,13 @@ render_testBlit(void *arg)
}
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount1);
/* Make current */
SDL_RenderPresent(renderer);
/* See if it's the same */
referenceSurface = SDLTest_ImageBlit();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
/* Make current */
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@ -478,13 +478,13 @@ render_testBlitColor (void *arg)
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureColorMod, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
/* Make current */
SDL_RenderPresent(renderer);
/* See if it's the same. */
referenceSurface = SDLTest_ImageBlitColor();
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
/* Make current */
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@ -555,13 +555,13 @@ render_testBlitAlpha (void *arg)
SDLTest_AssertCheck(checkFailCount1 == 0, "Validate results from calls to SDL_SetTextureAlphaMod, expected: 0, got: %i", checkFailCount1);
SDLTest_AssertCheck(checkFailCount2 == 0, "Validate results from calls to SDL_RenderCopy, expected: 0, got: %i", checkFailCount2);
/* Make current */
SDL_RenderPresent(renderer);
/* See if it's the same. */
referenceSurface = SDLTest_ImageBlitAlpha();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
/* Make current */
SDL_RenderPresent(renderer);
/* Clean up. */
SDL_DestroyTexture( tface );
SDL_FreeSurface(referenceSurface);
@ -674,9 +674,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_NONE );
referenceSurface = SDLTest_ImageBlitBlendNone();
/* Make current and compare */
SDL_RenderPresent(renderer);
/* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_OPAQUE );
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -684,9 +685,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_BLEND );
referenceSurface = SDLTest_ImageBlitBlend();
/* Make current and compare */
SDL_RenderPresent(renderer);
/* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -694,9 +696,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_ADD );
referenceSurface = SDLTest_ImageBlitBlendAdd();
/* Make current and compare */
SDL_RenderPresent(renderer);
/* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -704,9 +707,10 @@ render_testBlitBlend (void *arg)
_testBlitBlendMode( tface, SDL_BLENDMODE_MOD);
referenceSurface = SDLTest_ImageBlitBlendMod();
/* Make current and compare */
SDL_RenderPresent(renderer);
/* Compare, then Present */
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED );
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;
@ -753,12 +757,13 @@ render_testBlitBlend (void *arg)
/* Clean up. */
SDL_DestroyTexture( tface );
/* Make current */
SDL_RenderPresent(renderer);
/* Check to see if final image matches. */
referenceSurface = SDLTest_ImageBlitBlendAll();
_compare(referenceSurface, ALLOWABLE_ERROR_BLENDED);
/* Make current */
SDL_RenderPresent(renderer);
SDL_FreeSurface(referenceSurface);
referenceSurface = NULL;