bitblt.c

changeset 3
317de52d8a63
parent 2
8ca2aaf0513f
child 4
86a98659662f
     1.1 --- a/bitblt.c	Thu Dec 27 11:04:43 2001 +0000
     1.2 +++ b/bitblt.c	Thu Dec 27 11:17:28 2001 +0000
     1.3 @@ -72,9 +72,7 @@
     1.4  		Rect src_rect,
     1.5  		Bitmap *dest_bitmap,
     1.6  		Point dest_upper_left,
     1.7 -		boolean flip_horizontal,
     1.8 -		boolean flip_vertical,
     1.9 -		boolean transpose,
    1.10 +		int scan,
    1.11  		int tfn)
    1.12  {
    1.13    Point src_point, dest_point;
    1.14 @@ -82,7 +80,7 @@
    1.15  
    1.16    if (! dest_bitmap)
    1.17      {
    1.18 -      if (transpose)
    1.19 +      if (scan & TRANSPOSE)
    1.20  	dest_bitmap = create_bitmap (rect_height (src_rect),
    1.21  				     rect_width (src_rect));
    1.22        else
    1.23 @@ -102,17 +100,32 @@
    1.24  	{
    1.25  	  boolean a, b, c;
    1.26  
    1.27 -	  if (transpose)
    1.28 +	  if (scan & TRANSPOSE)
    1.29  	    {
    1.30 -	      dest_point.x = dest_upper_left.x + (src_point.y - src_rect.upper_left.y);
    1.31 -	      dest_point.y = dest_upper_left.y + (src_point.x - src_rect.upper_left.x);
    1.32 +	      dest_point.x = src_point.y - src_rect.upper_left.y;
    1.33 +	      dest_point.y = src_point.x - src_rect.upper_left.x;
    1.34 +
    1.35 +	      if (scan & FLIP_H)
    1.36 +		dest_point.x = (rect_height (src_rect) - 1) - dest_point.x;
    1.37 +
    1.38 +	      if (scan & FLIP_V)
    1.39 +		dest_point.y = (rect_width (src_rect) - 1) - dest_point.y;
    1.40  	    }
    1.41  	  else
    1.42  	    {
    1.43 -	      dest_point.x = dest_upper_left.x + (src_point.x - src_rect.upper_left.x);
    1.44 -	      dest_point.y = dest_upper_left.y + (src_point.y - src_rect.upper_left.y);
    1.45 +	      dest_point.x = src_point.x - src_rect.upper_left.x;
    1.46 +	      dest_point.y = src_point.y - src_rect.upper_left.y;
    1.47 +
    1.48 +	      if (scan & FLIP_H)
    1.49 +		dest_point.x = (rect_width (src_rect) - 1) - dest_point.x;
    1.50 +
    1.51 +	      if (scan & FLIP_V)
    1.52 +		dest_point.y = (rect_height (src_rect) - 1) - dest_point.y;
    1.53  	    }
    1.54  
    1.55 +	  dest_point.x += dest_upper_left.x;
    1.56 +	  dest_point.y += dest_upper_left.y;
    1.57 +
    1.58  	  a = get_pixel (src_bitmap, src_point);
    1.59  	  b = get_pixel (dest_bitmap, dest_point);
    1.60  	  c = (tfn & (1 << (a * 2 + b))) != 0;