diff src/video/SDL_renderer_gl.c @ 2237:e57a883ffa86

Advertise the most efficient format for the screen. Of course SDL code needs to be fixed to handle framebuffers with alpha...
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Aug 2007 02:38:59 +0000
parents 741afd8402cf
children 75daa0792bd1
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c	Sun Aug 12 18:53:51 2007 +0000
+++ b/src/video/SDL_renderer_gl.c	Mon Aug 13 02:38:59 2007 +0000
@@ -457,15 +457,9 @@
         type = GL_UNSIGNED_BYTE;
         break;
     case SDL_PIXELFORMAT_RGB888:
-#ifdef __MACOSX__
-        internalFormat = GL_RGBA;
-        format = GL_BGRA;
-        type = GL_UNSIGNED_INT_8_8_8_8_REV;
-#else
         internalFormat = GL_RGB8;
         format = GL_BGRA;
         type = GL_UNSIGNED_BYTE;
-#endif
         break;
     case SDL_PIXELFORMAT_BGR24:
         internalFormat = GL_RGB8;
@@ -574,13 +568,14 @@
         renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
                                     GL_STORAGE_CACHED_APPLE);
     }
-    if (data->pixels && internalFormat == GL_RGBA && format == GL_BGRA
-        && type == GL_UNSIGNED_INT_8_8_8_8_REV && data->pixels) {
+    if (texture->access == SDL_TEXTUREACCESS_STREAMING && texture->format == SDL_PIXELFORMAT_ARGB8888 ) {
+        /*
         if (renderdata->glTextureRangeAPPLE) {
             renderdata->glTextureRangeAPPLE(data->type,
                                             texture->h * data->pitch,
                                             data->pixels);
         }
+        */
         renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
         renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
                                  texture_h, 0, format, type, data->pixels);
@@ -806,19 +801,6 @@
         int bpp = SDL_BYTESPERPIXEL(texture->format);
         int pitch = texturedata->pitch;
 
-#ifdef __MACOSX__
-        if (texture->format == SDL_PIXELFORMAT_RGB888) {
-            int i;
-            Uint8 *p = (Uint8 *) texturedata->pixels;
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-            p += 3;
-#endif
-            for (i = texture->h * pitch / 4; i--;) {
-                *p = 0xff;
-                p += 4;
-            }
-        }
-#endif
         SetupTextureUpdate(data, texture, pitch);
         data->glBindTexture(texturedata->type, texturedata->texture);
         for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {