added fast(er) list to be included (just in header) + small bug fix
[my-code/api.git] / bmp / bmp.c
index d42eefd..cc53c7c 100644 (file)
--- 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;
 }