diff src/video/SDL_renderer_gl.c @ 5141:da10636e5eca

Making the API simpler, scaling is always defined as linear interpolation and should be supported as much as possible on all renderers.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 31 Jan 2011 22:44:43 -0800
parents c2539ff054c8
children e743b9c3f6d6
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c	Mon Jan 31 22:21:29 2011 -0800
+++ b/src/video/SDL_renderer_gl.c	Mon Jan 31 22:44:43 2011 -0800
@@ -85,8 +85,6 @@
                                  SDL_Texture * texture);
 static int GL_SetTextureBlendMode(SDL_Renderer * renderer,
                                   SDL_Texture * texture);
-static int GL_SetTextureScaleMode(SDL_Renderer * renderer,
-                                  SDL_Texture * texture);
 static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                             const SDL_Rect * rect, const void *pixels,
                             int pitch);
@@ -126,7 +124,6 @@
       SDL_TEXTUREMODULATE_ALPHA),
      (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
       SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
-     (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW),
      15,
      {
       SDL_PIXELFORMAT_INDEX1LSB,
@@ -159,7 +156,6 @@
     SDL_bool GL_MESA_ycbcr_texture_supported;
     SDL_bool GL_ARB_fragment_program_supported;
     int blendMode;
-    int scaleMode;
 
     /* OpenGL functions */
 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
@@ -303,7 +299,6 @@
     renderer->SetTextureColorMod = GL_SetTextureColorMod;
     renderer->SetTextureAlphaMod = GL_SetTextureAlphaMod;
     renderer->SetTextureBlendMode = GL_SetTextureBlendMode;
-    renderer->SetTextureScaleMode = GL_SetTextureScaleMode;
     renderer->UpdateTexture = GL_UpdateTexture;
     renderer->LockTexture = GL_LockTexture;
     renderer->UnlockTexture = GL_UnlockTexture;
@@ -422,7 +417,6 @@
 
     /* Set up parameters for rendering */
     data->blendMode = -1;
-    data->scaleMode = -1;
     data->glDisable(GL_DEPTH_TEST);
     data->glDisable(GL_CULL_FACE);
     /* This ended up causing video discrepancies between OpenGL and Direct3D */
@@ -842,9 +836,9 @@
     renderdata->glEnable(data->type);
     renderdata->glBindTexture(data->type, data->texture);
     renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER,
-                                GL_NEAREST);
+                                GL_LINEAR);
     renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER,
-                                GL_NEAREST);
+                                GL_LINEAR);
     renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S,
                                 GL_CLAMP_TO_EDGE);
     renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
@@ -1001,25 +995,6 @@
 }
 
 static int
-GL_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    switch (texture->scaleMode) {
-    case SDL_SCALEMODE_NONE:
-    case SDL_SCALEMODE_FAST:
-    case SDL_SCALEMODE_SLOW:
-        return 0;
-    case SDL_SCALEMODE_BEST:
-        SDL_Unsupported();
-        texture->scaleMode = SDL_SCALEMODE_SLOW;
-        return -1;
-    default:
-        SDL_Unsupported();
-        texture->scaleMode = SDL_SCALEMODE_NONE;
-        return -1;
-    }
-}
-
-static int
 GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                  const SDL_Rect * rect, const void *pixels, int pitch)
 {
@@ -1363,26 +1338,6 @@
         }
     }
 
-    if (texture->scaleMode != data->scaleMode) {
-        switch (texture->scaleMode) {
-        case SDL_SCALEMODE_NONE:
-        case SDL_SCALEMODE_FAST:
-            data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
-                                  GL_NEAREST);
-            data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
-                                  GL_NEAREST);
-            break;
-        case SDL_SCALEMODE_SLOW:
-        case SDL_SCALEMODE_BEST:
-            data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
-                                  GL_LINEAR);
-            data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
-                                  GL_LINEAR);
-            break;
-        }
-        data->scaleMode = texture->scaleMode;
-    }
-
     if (shader) {
         data->glEnable(GL_FRAGMENT_PROGRAM_ARB);
         data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader);