testffmpeg: Only enable blending if we're using a texture format that supports it

This commit is contained in:
Sam Lantinga 2023-10-12 14:26:46 -07:00
parent 516d6f9efc
commit f91bde64d5

View file

@ -119,9 +119,6 @@ static SDL_bool CreateWindowAndRenderer(Uint32 window_flags, const char *driver)
SDL_Log("Created renderer %s\n", info.name);
}
/* Use linear scaling in case the user resizes the window */
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
#ifdef HAVE_EGL
if (useEGL) {
const char *extensions = eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS);
@ -446,7 +443,13 @@ static SDL_bool GetTextureForMemoryFrame(AVFrame *frame, SDL_Texture **texture)
if (!*texture) {
return SDL_FALSE;
}
if (frame_format == SDL_PIXELFORMAT_UNKNOWN || SDL_ISPIXELFORMAT_ALPHA(frame_format)) {
SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_BLEND);
} else {
SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_NONE);
}
SDL_SetTextureScaleMode(*texture, SDL_SCALEMODE_LINEAR);
}
switch (frame_format) {
@ -530,6 +533,8 @@ static SDL_bool GetTextureForDRMFrame(AVFrame *frame, SDL_Texture **texture)
if (!*texture) {
return SDL_FALSE;
}
SDL_SetTextureBlendMode(*texture, SDL_BLENDMODE_NONE);
SDL_SetTextureScaleMode(*texture, SDL_SCALEMODE_LINEAR);
/* Bind the texture for importing */
SDL_GL_BindTexture(*texture, NULL, NULL);