Fixed screen texture format on Android
authorSam Lantinga <slouken@libsdl.org>
Wed, 05 Jan 2011 00:09:19 -0800
changeset 4963604077962776
parent 4962 730b234ba9ec
child 4964 6c645018741e
Fixed screen texture format on Android
I think this also fixes some of the red/blue channel swap bugs reported on iPhone.
src/video/SDL_renderer_gles.c
src/video/android/SDL_androidvideo.c
     1.1 --- a/src/video/SDL_renderer_gles.c	Tue Jan 04 21:05:42 2011 -0800
     1.2 +++ b/src/video/SDL_renderer_gles.c	Wed Jan 05 00:09:19 2011 -0800
     1.3 @@ -118,7 +118,8 @@
     1.4        SDL_PIXELFORMAT_ABGR4444,
     1.5        SDL_PIXELFORMAT_ABGR1555,
     1.6        SDL_PIXELFORMAT_BGR565,
     1.7 -      SDL_PIXELFORMAT_BGR24,
     1.8 +      SDL_PIXELFORMAT_RGB24,
     1.9 +      SDL_PIXELFORMAT_BGR888,
    1.10        SDL_PIXELFORMAT_ABGR8888},
    1.11       0,
    1.12       0}
    1.13 @@ -380,11 +381,12 @@
    1.14      GLenum result;
    1.15  
    1.16      switch (texture->format) {
    1.17 -    case SDL_PIXELFORMAT_BGR24:
    1.18 +    case SDL_PIXELFORMAT_RGB24:
    1.19          internalFormat = GL_RGB;
    1.20          format = GL_RGB;
    1.21          type = GL_UNSIGNED_BYTE;
    1.22          break;
    1.23 +    case SDL_PIXELFORMAT_BGR888:
    1.24      case SDL_PIXELFORMAT_ABGR8888:
    1.25          internalFormat = GL_RGBA;
    1.26          format = GL_RGBA;
     2.1 --- a/src/video/android/SDL_androidvideo.c	Tue Jan 04 21:05:42 2011 -0800
     2.2 +++ b/src/video/android/SDL_androidvideo.c	Wed Jan 05 00:09:19 2011 -0800
     2.3 @@ -124,7 +124,7 @@
     2.4      SDL_DisplayMode mode;
     2.5  
     2.6      /* Use a fake 32-bpp desktop mode */
     2.7 -    mode.format = SDL_PIXELFORMAT_RGB888;
     2.8 +    mode.format = SDL_PIXELFORMAT_BGR888;
     2.9      mode.w = iScreenWidth;
    2.10      mode.h = iScreenHeight;
    2.11      mode.refresh_rate = 0;