bitblt.c

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