Mercurial > sdl-ios-xcode
changeset 3163:a252014ce27d
Support for BGR565 pixel format has been added, mainly for OpenGL ES renderer. OpenGL ES renderer now have new texture formats.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Wed, 03 Jun 2009 10:40:44 +0000 |
parents | dc1eb82ffdaa |
children | c5b2884c26b4 |
files | include/SDL_pixels.h src/video/SDL_pixels.c src/video/SDL_renderer_gles.c |
diffstat | 3 files changed, 43 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/include/SDL_pixels.h Wed Jun 03 04:37:27 2009 +0000 +++ b/include/SDL_pixels.h Wed Jun 03 10:40:44 2009 +0000 @@ -158,6 +158,9 @@ SDL_PIXELFORMAT_ARGB4444 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_4444, 16, 2), + SDL_PIXELFORMAT_ABGR4444 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ABGR, + SDL_PACKEDLAYOUT_4444, 16, 2), SDL_PIXELFORMAT_ARGB1555 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_1555, 16, 2), @@ -167,6 +170,9 @@ SDL_PIXELFORMAT_RGB565 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XRGB, SDL_PACKEDLAYOUT_565, 16, 2), + SDL_PIXELFORMAT_BGR565 = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED16, SDL_PACKEDORDER_XBGR, + SDL_PACKEDLAYOUT_565, 16, 2), SDL_PIXELFORMAT_RGB24 = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_ARRAYU8, SDL_ARRAYORDER_RGB, 0, 24, 3),
--- a/src/video/SDL_pixels.c Wed Jun 03 04:37:27 2009 +0000 +++ b/src/video/SDL_pixels.c Wed Jun 03 10:40:44 2009 +0000 @@ -72,6 +72,12 @@ masks[2] = 0x000003E0; masks[3] = 0x0000001F; break; + case SDL_PACKEDLAYOUT_5551: + masks[0] = 0x0000F800; + masks[1] = 0x000007C0; + masks[2] = 0x0000003E; + masks[3] = 0x00000001; + break; case SDL_PACKEDLAYOUT_565: masks[0] = 0x00000000; masks[1] = 0x0000F800; @@ -90,6 +96,12 @@ masks[2] = 0x000FFC00; masks[3] = 0x000003FF; break; + case SDL_PACKEDLAYOUT_1010102: + masks[0] = 0xFFC00000; + masks[1] = 0x003FF000; + masks[2] = 0x00000FFC; + masks[3] = 0x00000003; + break; default: /* Unknown layout */ return SDL_FALSE; @@ -176,7 +188,12 @@ break; case 16: switch (Rmask) { + case 0x000F: + return SDL_PIXELFORMAT_ABGR4444; case 0x001F: + if (Gmask == 0x07E0) { + return SDL_PIXELFORMAT_BGR565; + } return SDL_PIXELFORMAT_ABGR1555; case 0x0F00: return SDL_PIXELFORMAT_ARGB4444;
--- a/src/video/SDL_renderer_gles.c Wed Jun 03 04:37:27 2009 +0000 +++ b/src/video/SDL_renderer_gles.c Wed Jun 03 10:40:44 2009 +0000 @@ -30,7 +30,7 @@ #include "SDL_rect_c.h" #include "SDL_yuv_sw_c.h" -#ifdef __QNXNTO__ +#if defined(SDL_VIDEO_DRIVER_QNXGF) || defined(SDL_VIDEO_DRIVER_PHOTON) /* Empty function stub to get OpenGL ES 1.0 support without */ /* OpenGL ES extension GL_OES_draw_texture_supported */ @@ -110,9 +110,12 @@ (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | - SDL_TEXTURESCALEMODE_SLOW), 2, + SDL_TEXTURESCALEMODE_SLOW), 5, { /* OpenGL ES 1.x supported formats list */ + SDL_PIXELFORMAT_ABGR4444, + SDL_PIXELFORMAT_ABGR1555, + SDL_PIXELFORMAT_BGR565, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_ABGR8888}, 0, @@ -384,24 +387,21 @@ format = GL_RGBA; type = GL_UNSIGNED_BYTE; break; - /* - These formats would be supported if SDL had the necessary pixel formats - case SDL_PIXELFORMAT_BGR565: - internalFormat = GL_RGB; - format = GL_RGB; - type = GL_UNSIGNED_SHORT_5_6_5; - break; - case SDL_PIXELFORMAT_ABGR5551: - internalFormat = GL_RGBA; - format = GL_RGBA; - type = GL_UNSIGNED_SHORT_5_5_5_1; - break; - case SDL_PIXELFORMAT_ABGR4444: - internalFormat = GL_RGBA; - format = GL_RGBA; - type = GL_UNSIGNED_SHORT_4_4_4_4; - break; - */ + case SDL_PIXELFORMAT_BGR565: + internalFormat = GL_RGB; + format = GL_RGB; + type = GL_UNSIGNED_SHORT_5_6_5; + break; + case SDL_PIXELFORMAT_ABGR1555: + internalFormat = GL_RGBA; + format = GL_RGBA; + type = GL_UNSIGNED_SHORT_5_5_5_1; + break; + case SDL_PIXELFORMAT_ABGR4444: + internalFormat = GL_RGBA; + format = GL_RGBA; + type = GL_UNSIGNED_SHORT_4_4_4_4; + break; default: SDL_SetError("Unsupported texture format"); return -1;