add in High DPI support (aka Retina)

- based on Jørgen's patch with a few bug fixes
This commit is contained in:
Edward Rudd 2013-09-20 13:43:00 -04:00
parent a449178caa
commit 3a11d95444
12 changed files with 134 additions and 11 deletions

View file

@ -47,6 +47,7 @@ static const float inv255f = 1.0f / 255.0f;
static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags);
static void GL_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
@ -399,6 +400,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
}
renderer->WindowEvent = GL_WindowEvent;
renderer->GetOutputSize = GL_GetOutputSize;
renderer->CreateTexture = GL_CreateTexture;
renderer->UpdateTexture = GL_UpdateTexture;
renderer->LockTexture = GL_LockTexture;
@ -539,6 +541,14 @@ GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
}
}
static int
GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
SDL_GL_GetDrawableSize(renderer->window, w, h);
return 0;
}
SDL_FORCE_INLINE int
power_of_2(int input)
{