comparison 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
comparison
equal deleted inserted replaced
2915:deb377097225 2916:ffdd533f7add
134 for (screen = 0; screen < ScreenCount(data->display); ++screen) { 134 for (screen = 0; screen < ScreenCount(data->display); ++screen) {
135 XVisualInfo vinfo; 135 XVisualInfo vinfo;
136 SDL_VideoDisplay display; 136 SDL_VideoDisplay display;
137 SDL_DisplayData *displaydata; 137 SDL_DisplayData *displaydata;
138 SDL_DisplayMode mode; 138 SDL_DisplayMode mode;
139 XPixmapFormatValues *pixmapFormats;
140 int i, n;
139 141
140 if (get_visualinfo(data->display, screen, &vinfo) < 0) { 142 if (get_visualinfo(data->display, screen, &vinfo) < 0) {
141 continue; 143 continue;
142 } 144 }
143 145
152 continue; 154 continue;
153 } 155 }
154 displaydata->screen = screen; 156 displaydata->screen = screen;
155 displaydata->visual = vinfo.visual; 157 displaydata->visual = vinfo.visual;
156 displaydata->depth = vinfo.depth; 158 displaydata->depth = vinfo.depth;
159
160 displaydata->scanline_pad = SDL_BYTESPERPIXEL(mode.format)*8;
161 pixmapFormats = XListPixmapFormats(data->display, &n);
162 if (pixmapFormats) {
163 for (i = 0; i < n; ++i) {
164 if (pixmapFormats[i].depth == displaydata->depth) {
165 displaydata->scanline_pad = pixmapFormats[i].scanline_pad;
166 break;
167 }
168 }
169 XFree(pixmapFormats);
170 }
157 171
158 SDL_zero(display); 172 SDL_zero(display);
159 display.desktop_mode = mode; 173 display.desktop_mode = mode;
160 display.current_mode = mode; 174 display.current_mode = mode;
161 display.driverdata = displaydata; 175 display.driverdata = displaydata;