/ minilibx-linux / mlx_destroy_image.c
mlx_destroy_image.c
1 /* 2 ** mlx_destroy_image.c for MinilibX in 3 ** 4 ** Made by Charlie Root 5 ** Login <ol@epitech.net> 6 ** 7 ** Started on Tue Mar 12 10:25:15 2002 Charlie Root 8 ** Last update Tue May 15 16:45:54 2007 Olivier Crouzet 9 */ 10 11 12 #include "mlx_int.h" 13 14 15 int mlx_destroy_image(t_xvar *xvar, t_img *img) 16 { 17 if (img->type == MLX_TYPE_SHM_PIXMAP || 18 img->type == MLX_TYPE_SHM) 19 { 20 XShmDetach(xvar->display, &(img->shm)); 21 shmdt(img->shm.shmaddr); 22 /* shmctl IPC_RMID already done */ 23 } 24 XDestroyImage(img->image); /* For image & shm-image. Also free img->data */ 25 XFreePixmap(xvar->display, img->pix); 26 if (img->gc) 27 XFreeGC(xvar->display, img->gc); 28 free(img); 29 if (xvar->do_flush) 30 XFlush(xvar->display); 31 }