Skip to content
Permalink
Browse files

Fixed SDL_GetRendererOutputSize on iOS when high-DPI mode is enabled …

…on a Retina device.
  • Loading branch information
slime73 committed Dec 1, 2014
1 parent bc4b6f0 commit ba6392d79dd4e6aa3b4a98691d373b01a144e35e
Showing with 17 additions and 0 deletions.
  1. +9 −0 src/render/opengles/SDL_render_gles.c
  2. +8 −0 src/render/opengles2/SDL_render_gles2.c
@@ -55,6 +55,7 @@ static const float inv255f = 1.0f / 255.0f;
static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GLES_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
@@ -321,6 +322,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
}

renderer->WindowEvent = GLES_WindowEvent;
renderer->GetOutputSize = GLES_GetOutputSize;
renderer->CreateTexture = GLES_CreateTexture;
renderer->UpdateTexture = GLES_UpdateTexture;
renderer->LockTexture = GLES_LockTexture;
@@ -438,6 +440,13 @@ GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
}
}

static int
GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
SDL_GL_GetDrawableSize(renderer->window, w, h);
return 0;
}

static SDL_INLINE int
power_of_2(int input)
{
@@ -351,6 +351,13 @@ GLES2_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
}
}

static int
GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
SDL_GL_GetDrawableSize(renderer->window, w, h);
return 0;
}

static int
GLES2_UpdateViewport(SDL_Renderer * renderer)
{
@@ -2004,6 +2011,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)

/* Populate the function pointers for the module */
renderer->WindowEvent = &GLES2_WindowEvent;
renderer->GetOutputSize = &GLES2_GetOutputSize;
renderer->CreateTexture = &GLES2_CreateTexture;
renderer->UpdateTexture = &GLES2_UpdateTexture;
renderer->UpdateTextureYUV = &GLES2_UpdateTextureYUV;

0 comments on commit ba6392d

Please sign in to comment.