src/render/opengles/SDL_render_gles.c
changeset 5484 e20c93bc9122
parent 5402 5d102cd8aef3
child 5503 be88d105e91c
     1.1 --- a/src/render/opengles/SDL_render_gles.c	Sun Mar 13 11:17:11 2011 -0700
     1.2 +++ b/src/render/opengles/SDL_render_gles.c	Sun Mar 13 11:18:35 2011 -0700
     1.3 @@ -23,6 +23,7 @@
     1.4  
     1.5  #if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
     1.6  
     1.7 +#include "SDL_hints.h"
     1.8  #include "SDL_opengles.h"
     1.9  #include "../SDL_sysrender.h"
    1.10  
    1.11 @@ -292,6 +293,18 @@
    1.12      return value;
    1.13  }
    1.14  
    1.15 +static GLenum
    1.16 +GetScaleQuality(void)
    1.17 +{
    1.18 +    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
    1.19 +
    1.20 +    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
    1.21 +        return GL_NEAREST;
    1.22 +    } else {
    1.23 +        return GL_LINEAR;
    1.24 +    }
    1.25 +}
    1.26 +
    1.27  static int
    1.28  GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
    1.29  {
    1.30 @@ -345,7 +358,7 @@
    1.31  
    1.32      data->format = format;
    1.33      data->formattype = type;
    1.34 -    data->scaleMode = GL_LINEAR;
    1.35 +    data->scaleMode = GetScaleQuality();
    1.36      glBindTexture(data->type, data->texture);
    1.37      glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    1.38      glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);