X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=bmp%2Fbmp.c;h=cc53c7cc6161463be4d96f3b471b32dfdf8fd2ea;hb=HEAD;hp=d42eefd505505437109c9447d20ee5021c85108e;hpb=0e23b0ff9632e31c6abc581b42b0efdff798af4c;p=my-code%2Fapi.git diff --git a/bmp/bmp.c b/bmp/bmp.c index d42eefd..cc53c7c 100644 --- a/bmp/bmp.c +++ b/bmp/bmp.c @@ -138,7 +138,7 @@ int bmp_write_file(t_bmp *bmp) { return B_SUCCESS; } -int bmp_cut_bottom(t_bmp *dst,t_bmp *src,int dz) { +int bmp_cut_grab_bottom(t_bmp *dst,t_bmp *src,int dz,unsigned char m) { int off; @@ -155,9 +155,8 @@ int bmp_cut_bottom(t_bmp *dst,t_bmp *src,int dz) { return B_E_MEM; } - off=(src->height-dz-1)*src->width; - printf("debug: off = %d height = %d dz = %d\n",off,src->height,dz); - memcpy(dst->map,&(src->map[off]),dz*src->width*sizeof(t_pixel)); + off=(m==GRAB)?0:(src->height-dz)*src->width; + memcpy(dst->map,src->map+off,dz*src->width*sizeof(t_pixel)); return B_SUCCESS; }