Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11render.c @ 2874:36e312e0fac0
indent
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 16 Dec 2008 17:44:10 +0000 |
parents | b801df19835f |
children | 04e89201f6ed |
comparison
equal
deleted
inserted
replaced
2873:b33e38aaa027 | 2874:36e312e0fac0 |
---|---|
234 data->makedirty = SDL_FALSE; | 234 data->makedirty = SDL_FALSE; |
235 } | 235 } |
236 data->current_pixmap = 0; | 236 data->current_pixmap = 0; |
237 | 237 |
238 /* Get the format of the window */ | 238 /* Get the format of the window */ |
239 if (!SDL_PixelFormatEnumToMasks(display->current_mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { | 239 if (!SDL_PixelFormatEnumToMasks |
240 (display->current_mode.format, &bpp, &Rmask, &Gmask, &Bmask, | |
241 &Amask)) { | |
240 SDL_SetError("Unknown display format"); | 242 SDL_SetError("Unknown display format"); |
241 X11_DestroyRenderer(renderer); | 243 X11_DestroyRenderer(renderer); |
242 return NULL; | 244 return NULL; |
243 } | 245 } |
244 data->format = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); | 246 data->format = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask); |
323 } | 325 } |
324 data->format = display->current_mode.format; | 326 data->format = display->current_mode.format; |
325 } else { | 327 } else { |
326 /* The image/pixmap depth must be the same as the window or you | 328 /* The image/pixmap depth must be the same as the window or you |
327 get a BadMatch error when trying to putimage or copyarea. | 329 get a BadMatch error when trying to putimage or copyarea. |
328 */ | 330 */ |
329 if (texture->format != display->current_mode.format) { | 331 if (texture->format != display->current_mode.format) { |
330 SDL_SetError("Texture format doesn't match window format"); | 332 SDL_SetError("Texture format doesn't match window format"); |
331 return -1; | 333 return -1; |
332 } | 334 } |
333 data->format = texture->format; | 335 data->format = texture->format; |
362 } | 364 } |
363 if (!shm_error) { | 365 if (!shm_error) { |
364 data->pixels = shminfo->shmaddr; | 366 data->pixels = shminfo->shmaddr; |
365 | 367 |
366 data->image = | 368 data->image = |
367 XShmCreateImage(renderdata->display, renderdata->visual, renderdata->depth, ZPixmap, shminfo->shmaddr, shminfo, texture->w, texture->h); | 369 XShmCreateImage(renderdata->display, renderdata->visual, |
370 renderdata->depth, ZPixmap, shminfo->shmaddr, | |
371 shminfo, texture->w, texture->h); | |
368 if (!data->image) { | 372 if (!data->image) { |
369 XShmDetach(renderdata->display, shminfo); | 373 XShmDetach(renderdata->display, shminfo); |
370 XSync(renderdata->display, False); | 374 XSync(renderdata->display, False); |
371 shmdt(shminfo->shmaddr); | 375 shmdt(shminfo->shmaddr); |
372 shm_error = True; | 376 shm_error = True; |
384 SDL_OutOfMemory(); | 388 SDL_OutOfMemory(); |
385 return -1; | 389 return -1; |
386 } | 390 } |
387 | 391 |
388 data->image = | 392 data->image = |
389 XCreateImage(renderdata->display, renderdata->visual, renderdata->depth, ZPixmap, 0, data->pixels, texture->w, texture->h, SDL_BYTESPERPIXEL(data->format) * 8, data->pitch); | 393 XCreateImage(renderdata->display, renderdata->visual, |
394 renderdata->depth, ZPixmap, 0, data->pixels, | |
395 texture->w, texture->h, | |
396 SDL_BYTESPERPIXEL(data->format) * 8, | |
397 data->pitch); | |
390 if (!data->image) { | 398 if (!data->image) { |
391 X11_DestroyTexture(renderer, texture); | 399 X11_DestroyTexture(renderer, texture); |
392 SDL_SetError("XCreateImage() failed"); | 400 SDL_SetError("XCreateImage() failed"); |
393 return -1; | 401 return -1; |
394 } | 402 } |
402 SDL_SetError("XCteatePixmap() failed"); | 410 SDL_SetError("XCteatePixmap() failed"); |
403 return -1; | 411 return -1; |
404 } | 412 } |
405 | 413 |
406 data->image = | 414 data->image = |
407 XCreateImage(renderdata->display, renderdata->visual, renderdata->depth, ZPixmap, 0, NULL, texture->w, texture->h, SDL_BYTESPERPIXEL(data->format) * 8, data->pitch); | 415 XCreateImage(renderdata->display, renderdata->visual, |
416 renderdata->depth, ZPixmap, 0, NULL, texture->w, | |
417 texture->h, SDL_BYTESPERPIXEL(data->format) * 8, | |
418 data->pitch); | |
408 if (!data->image) { | 419 if (!data->image) { |
409 X11_DestroyTexture(renderer, texture); | 420 X11_DestroyTexture(renderer, texture); |
410 SDL_SetError("XCreateImage() failed"); | 421 SDL_SetError("XCreateImage() failed"); |
411 return -1; | 422 return -1; |
412 } | 423 } |
604 SDL_OutOfMemory(); | 615 SDL_OutOfMemory(); |
605 return -1; | 616 return -1; |
606 } | 617 } |
607 | 618 |
608 image = | 619 image = |
609 XCreateImage(data->display, data->visual, data->depth, ZPixmap, | 620 XCreateImage(data->display, data->visual, data->depth, |
610 0, pixels, dstrect->w, dstrect->h, | 621 ZPixmap, 0, pixels, dstrect->w, dstrect->h, |
611 SDL_BYTESPERPIXEL(texturedata->format) * 8, | 622 SDL_BYTESPERPIXEL(texturedata->format) * 8, |
612 pitch); | 623 pitch); |
613 if (!image) { | 624 if (!image) { |
614 SDL_SetError("XCreateImage() failed"); | 625 SDL_SetError("XCreateImage() failed"); |
615 return -1; | 626 return -1; |