summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@xonotic.org>2016-06-10 02:32:47 +0200
committerRudolf Polzer <divverent@xonotic.org>2016-06-10 12:56:49 +0200
commit96475174eaa343e522ae112dee5f0407c06e4ca8 (patch)
tree16f410d8b82f7b217f04cdb000cc007869520d1b
parent1c5fd2d9019d84901e2c0c5485c79e7d79fa5662 (diff)
downloadmpv-sdl2-pixelformats.tar.bz2
mpv-sdl2-pixelformats.tar.xz
vo_sdl: fix pixel formats.sdl2-pixelformats
There were two mistakes: - SDL's RGB565 is always equivalent to ffmpeg's RGB565 (both are packed 16bit native-endian integers in RGB=565 form) - this was wrongly reversed on big endian platforms. - SDL's RGB888 doesn't actually mean RGB24, but XRGB8888 (i.e. 32bit packed integer, top 8 bits unused). - Use RGB0 not RGBA when there is no alpha.
-rw-r--r--video/out/vo_sdl.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 9d34564587..dd18f6e9c4 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -58,30 +58,27 @@ const struct formatmap_entry formats[] = {
{SDL_PIXELFORMAT_UYVY, IMGFMT_UYVY, 0},
//{SDL_PIXELFORMAT_YVYU, IMGFMT_YVYU, 0},
#if BYTE_ORDER == BIG_ENDIAN
- {SDL_PIXELFORMAT_RGBX8888, IMGFMT_RGBA, 0}, // has no alpha -> bad for OSD
- {SDL_PIXELFORMAT_BGRX8888, IMGFMT_BGRA, 0}, // has no alpha -> bad for OSD
+ {SDL_PIXELFORMAT_RGB888, IMGFMT_0RGB, 0}, // RGB888 means XRGB8888
+ {SDL_PIXELFORMAT_RGBX8888, IMGFMT_RGB0, 0}, // has no alpha -> bad for OSD
+ {SDL_PIXELFORMAT_BGR888, IMGFMT_0BGR, 0}, // BGR888 means XBGR8888
+ {SDL_PIXELFORMAT_BGRX8888, IMGFMT_BGR0, 0}, // has no alpha -> bad for OSD
{SDL_PIXELFORMAT_ARGB8888, IMGFMT_ARGB, 1}, // matches SUBBITMAP_RGBA
{SDL_PIXELFORMAT_RGBA8888, IMGFMT_RGBA, 1},
{SDL_PIXELFORMAT_ABGR8888, IMGFMT_ABGR, 1},
{SDL_PIXELFORMAT_BGRA8888, IMGFMT_BGRA, 1},
- {SDL_PIXELFORMAT_RGB24, IMGFMT_RGB24, 0},
- {SDL_PIXELFORMAT_BGR24, IMGFMT_BGR24, 0},
- {SDL_PIXELFORMAT_RGB888, IMGFMT_RGB24, 0},
- {SDL_PIXELFORMAT_BGR888, IMGFMT_BGR24, 0},
- {SDL_PIXELFORMAT_BGR565, IMGFMT_RGB565, 0},
#else
- {SDL_PIXELFORMAT_RGBX8888, IMGFMT_ABGR, 0}, // has no alpha -> bad for OSD
- {SDL_PIXELFORMAT_BGRX8888, IMGFMT_ARGB, 0}, // has no alpha -> bad for OSD
+ {SDL_PIXELFORMAT_RGB888, IMGFMT_BGR0, 0}, // RGB888 means XRGB8888
+ {SDL_PIXELFORMAT_RGBX8888, IMGFMT_0BGR, 0}, // has no alpha -> bad for OSD
+ {SDL_PIXELFORMAT_BGR888, IMGFMT_RGB0, 0}, // BGR888 means XBGR8888
+ {SDL_PIXELFORMAT_BGRX8888, IMGFMT_0RGB, 0}, // has no alpha -> bad for OSD
{SDL_PIXELFORMAT_ARGB8888, IMGFMT_BGRA, 1}, // matches SUBBITMAP_RGBA
{SDL_PIXELFORMAT_RGBA8888, IMGFMT_ABGR, 1},
{SDL_PIXELFORMAT_ABGR8888, IMGFMT_RGBA, 1},
{SDL_PIXELFORMAT_BGRA8888, IMGFMT_ARGB, 1},
+#endif
{SDL_PIXELFORMAT_RGB24, IMGFMT_RGB24, 0},
{SDL_PIXELFORMAT_BGR24, IMGFMT_BGR24, 0},
- {SDL_PIXELFORMAT_RGB888, IMGFMT_BGR24, 0},
- {SDL_PIXELFORMAT_BGR888, IMGFMT_RGB24, 0},
{SDL_PIXELFORMAT_RGB565, IMGFMT_RGB565, 0},
-#endif
};
struct keymap_entry {