Fixed SDL_GetRendererOutputSize on iOS when high-DPI mode is enabled on a Retina device. iOS-improvements
authorAlex Szpakowski <slime73@gmail.com>
Mon, 01 Dec 2014 07:31:22 -0400
branchiOS-improvements
changeset 9530ac0885050d79
parent 9529 4bf9830d8153
child 9531 b7ad394978b1
Fixed SDL_GetRendererOutputSize on iOS when high-DPI mode is enabled on a Retina device.
src/render/opengles/SDL_render_gles.c
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Thu Nov 27 20:25:54 2014 -0400
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Mon Dec 01 07:31:22 2014 -0400
     1.3 @@ -55,6 +55,7 @@
     1.4  static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
     1.5  static void GLES_WindowEvent(SDL_Renderer * renderer,
     1.6                               const SDL_WindowEvent *event);
     1.7 +static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
     1.8  static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
     1.9  static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
    1.10                                const SDL_Rect * rect, const void *pixels,
    1.11 @@ -321,6 +322,7 @@
    1.12      }
    1.13  
    1.14      renderer->WindowEvent = GLES_WindowEvent;
    1.15 +    renderer->GetOutputSize = GLES_GetOutputSize;
    1.16      renderer->CreateTexture = GLES_CreateTexture;
    1.17      renderer->UpdateTexture = GLES_UpdateTexture;
    1.18      renderer->LockTexture = GLES_LockTexture;
    1.19 @@ -438,6 +440,13 @@
    1.20      }
    1.21  }
    1.22  
    1.23 +static int
    1.24 +GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
    1.25 +{
    1.26 +    SDL_GL_GetDrawableSize(renderer->window, w, h);
    1.27 +    return 0;
    1.28 +}
    1.29 +
    1.30  static SDL_INLINE int
    1.31  power_of_2(int input)
    1.32  {
     2.1 --- a/src/render/opengles2/SDL_render_gles2.c	Thu Nov 27 20:25:54 2014 -0400
     2.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Mon Dec 01 07:31:22 2014 -0400
     2.3 @@ -352,6 +352,13 @@
     2.4  }
     2.5  
     2.6  static int
     2.7 +GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
     2.8 +{
     2.9 +    SDL_GL_GetDrawableSize(renderer->window, w, h);
    2.10 +    return 0;
    2.11 +}
    2.12 +
    2.13 +static int
    2.14  GLES2_UpdateViewport(SDL_Renderer * renderer)
    2.15  {
    2.16      GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
    2.17 @@ -2004,6 +2011,7 @@
    2.18  
    2.19      /* Populate the function pointers for the module */
    2.20      renderer->WindowEvent         = &GLES2_WindowEvent;
    2.21 +    renderer->GetOutputSize       = &GLES2_GetOutputSize;
    2.22      renderer->CreateTexture       = &GLES2_CreateTexture;
    2.23      renderer->UpdateTexture       = &GLES2_UpdateTexture;
    2.24      renderer->UpdateTextureYUV    = &GLES2_UpdateTextureYUV;