src/render/opengles/SDL_render_gles.c
changeset 5484 e20c93bc9122
parent 5402 5d102cd8aef3
child 5503 be88d105e91c
--- a/src/render/opengles/SDL_render_gles.c	Sun Mar 13 11:17:11 2011 -0700
+++ b/src/render/opengles/SDL_render_gles.c	Sun Mar 13 11:18:35 2011 -0700
@@ -23,6 +23,7 @@
 
 #if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED
 
+#include "SDL_hints.h"
 #include "SDL_opengles.h"
 #include "../SDL_sysrender.h"
 
@@ -292,6 +293,18 @@
     return value;
 }
 
+static GLenum
+GetScaleQuality(void)
+{
+    const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
+
+    if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) {
+        return GL_NEAREST;
+    } else {
+        return GL_LINEAR;
+    }
+}
+
 static int
 GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
 {
@@ -345,7 +358,7 @@
 
     data->format = format;
     data->formattype = type;
-    data->scaleMode = GL_LINEAR;
+    data->scaleMode = GetScaleQuality();
     glBindTexture(data->type, data->texture);
     glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);