Skip to content

Commit

Permalink
Android: prevent using SW_GetOutputSize with software renderer (Bug 4…
Browse files Browse the repository at this point in the history
…669)
  • Loading branch information
1bsyl committed Jun 18, 2019
1 parent a55c0e1 commit 98cc758
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -79,6 +79,7 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
}
}

#if !defined(ANDROID)
static int
SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
Expand All @@ -97,6 +98,7 @@ SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
return -1;
}
}
#endif

static int
SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
Expand Down Expand Up @@ -820,7 +822,13 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
data->window = surface;

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;
#endif
renderer->CreateTexture = SW_CreateTexture;
renderer->UpdateTexture = SW_UpdateTexture;
renderer->LockTexture = SW_LockTexture;
Expand Down

0 comments on commit 98cc758

Please sign in to comment.