Skip to content

Commit

Permalink
Android: try to fix resize with software rendering (bug 4669)
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Jun 18, 2019
1 parent 8a20d40 commit 12b9226
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -82,6 +82,11 @@ SW_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
static int
SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
#if defined(ANDROID)
extern void Android_GetScreenResolution(int *w, int *h);
Android_GetScreenResolution(w, h);
return 0;
#else
SDL_Surface *surface = SW_ActivateRenderer(renderer);

if (surface) {
Expand All @@ -96,6 +101,7 @@ SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
SDL_SetError("Software renderer doesn't have an output surface");
return -1;
}
#endif
}

static int
Expand Down
12 changes: 12 additions & 0 deletions src/video/android/SDL_androidvideo.c
Expand Up @@ -237,6 +237,18 @@ Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth
Android_ScreenRate = (int)rate;
}

void
Android_GetScreenResolution(int *w, int *h)
{
if (w) {
*w = Android_SurfaceWidth;
}

if (h) {
*h = Android_SurfaceHeight;
}
}

void Android_SendResize(SDL_Window *window)
{
/*
Expand Down
1 change: 1 addition & 0 deletions src/video/android/SDL_androidvideo.h
Expand Up @@ -30,6 +30,7 @@
/* Called by the JNI layer when the screen changes size or format */
extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate);
extern void Android_SendResize(SDL_Window *window);
extern void Android_GetScreenResolution(int *w, int *h);

/* Private display data */

Expand Down

0 comments on commit 12b9226

Please sign in to comment.