Android: try to fix resize with software rendering (bug 4669)
authorSylvain Becker <sylvain.becker@gmail.com>
Tue, 18 Jun 2019 18:40:40 +0200
changeset 12879e8a2d4743bc3
parent 12878 f92b7ee0dec3
child 12880 e46fc7b6d880
Android: try to fix resize with software rendering (bug 4669)
src/render/software/SDL_render_sw.c
src/video/android/SDL_androidvideo.c
src/video/android/SDL_androidvideo.h
     1.1 --- a/src/render/software/SDL_render_sw.c	Tue Jun 18 18:22:18 2019 +0200
     1.2 +++ b/src/render/software/SDL_render_sw.c	Tue Jun 18 18:40:40 2019 +0200
     1.3 @@ -82,6 +82,11 @@
     1.4  static int
     1.5  SW_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
     1.6  {
     1.7 +#if defined(ANDROID)
     1.8 +    extern void Android_GetScreenResolution(int *w, int *h);
     1.9 +    Android_GetScreenResolution(w, h);
    1.10 +    return 0;
    1.11 +#else
    1.12      SDL_Surface *surface = SW_ActivateRenderer(renderer);
    1.13  
    1.14      if (surface) {
    1.15 @@ -96,6 +101,7 @@
    1.16          SDL_SetError("Software renderer doesn't have an output surface");
    1.17          return -1;
    1.18      }
    1.19 +#endif
    1.20  }
    1.21  
    1.22  static int
     2.1 --- a/src/video/android/SDL_androidvideo.c	Tue Jun 18 18:22:18 2019 +0200
     2.2 +++ b/src/video/android/SDL_androidvideo.c	Tue Jun 18 18:40:40 2019 +0200
     2.3 @@ -237,6 +237,18 @@
     2.4      Android_ScreenRate    = (int)rate;
     2.5  }
     2.6  
     2.7 +void
     2.8 +Android_GetScreenResolution(int *w, int *h)
     2.9 +{
    2.10 +    if (w) {
    2.11 +        *w = Android_SurfaceWidth;
    2.12 +    }
    2.13 +
    2.14 +    if (h) {
    2.15 +        *h = Android_SurfaceHeight;
    2.16 +    }
    2.17 +}
    2.18 +
    2.19  void Android_SendResize(SDL_Window *window)
    2.20  {
    2.21      /*
     3.1 --- a/src/video/android/SDL_androidvideo.h	Tue Jun 18 18:22:18 2019 +0200
     3.2 +++ b/src/video/android/SDL_androidvideo.h	Tue Jun 18 18:40:40 2019 +0200
     3.3 @@ -30,6 +30,7 @@
     3.4  /* Called by the JNI layer when the screen changes size or format */
     3.5  extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate);
     3.6  extern void Android_SendResize(SDL_Window *window);
     3.7 +extern void Android_GetScreenResolution(int *w, int *h);
     3.8  
     3.9  /* Private display data */
    3.10