Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11modes.c @ 2916:ffdd533f7add
Fixed pitch alignment problem causing MITSHM error on 16-bit displays
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 25 Dec 2008 04:42:28 +0000 |
parents | c4150600b3ae |
children | cdb01906cb7e |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c Wed Dec 24 13:13:38 2008 +0000 +++ b/src/video/x11/SDL_x11modes.c Thu Dec 25 04:42:28 2008 +0000 @@ -136,6 +136,8 @@ SDL_VideoDisplay display; SDL_DisplayData *displaydata; SDL_DisplayMode mode; + XPixmapFormatValues *pixmapFormats; + int i, n; if (get_visualinfo(data->display, screen, &vinfo) < 0) { continue; @@ -155,6 +157,18 @@ displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; + displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format)*8; + pixmapFormats = XListPixmapFormats(data->display, &n); + if (pixmapFormats) { + for (i = 0; i < n; ++i) { + if (pixmapFormats[i].depth == displaydata->depth) { + displaydata->scanline_pad = pixmapFormats[i].scanline_pad; + break; + } + } + XFree(pixmapFormats); + } + SDL_zero(display); display.desktop_mode = mode; display.current_mode = mode;