Android: prevent using SW_GetOutputSize with software renderer (Bug 4669)

This commit is contained in:
Sylvain Becker 2019-06-18 10:41:11 +02:00
parent a55c0e1479
commit 98cc7589b1
1 changed files with 8 additions and 0 deletions

View File

@ -79,6 +79,7 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
} }
} }
#if !defined(ANDROID)
static int static int
SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{ {
@ -97,6 +98,7 @@ SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
return -1; return -1;
} }
} }
#endif
static int static int
SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
@ -820,7 +822,13 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
data->window = surface; data->window = surface;
renderer->WindowEvent = SW_WindowEvent; renderer->WindowEvent = SW_WindowEvent;
#if defined(ANDROID)
/* Avoid using it with Android software renderer. While resizing in background,
* it ends up creating a broken texture because EGL context is not active. */
renderer->GetOutputSize = NULL;
#else
renderer->GetOutputSize = SW_GetOutputSize; renderer->GetOutputSize = SW_GetOutputSize;
#endif
renderer->CreateTexture = SW_CreateTexture; renderer->CreateTexture = SW_CreateTexture;
renderer->UpdateTexture = SW_UpdateTexture; renderer->UpdateTexture = SW_UpdateTexture;
renderer->LockTexture = SW_LockTexture; renderer->LockTexture = SW_LockTexture;