*** empty log message ***

Thu, 27 Dec 2001 11:17:28 +0000

author
eric
date
Thu, 27 Dec 2001 11:17:28 +0000
changeset 3
317de52d8a63
parent 2
8ca2aaf0513f
child 4
86a98659662f

*** empty log message ***

bitblt.c file | annotate | diff | revisions
bitblt.h file | annotate | diff | revisions
bitblt_test.c file | annotate | diff | revisions
     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;
     2.1 --- a/bitblt.h	Thu Dec 27 11:04:43 2001 +0000
     2.2 +++ b/bitblt.h	Thu Dec 27 11:17:28 2001 +0000
     2.3 @@ -29,6 +29,16 @@
     2.4  #define TF_XOR 0x6
     2.5  
     2.6  
     2.7 +#define FLIP_H    0x1
     2.8 +#define FLIP_V    0x2
     2.9 +#define TRANSPOSE 0x4
    2.10 +
    2.11 +#define ROT_0     0x0
    2.12 +#define ROT_90    (TRANSPOSE + FLIP_H)
    2.13 +#define ROT_180   (FLIP_H + FLIP_V)
    2.14 +#define ROT_270   (TRANSPOSE + FLIP_V)
    2.15 +
    2.16 +
    2.17  Bitmap *create_bitmap (u32 width, u32 height);
    2.18  void free_bitmap (Bitmap *bitmap);
    2.19  boolean get_pixel (Bitmap *bitmap, Point coord);
    2.20 @@ -38,7 +48,5 @@
    2.21  		Rect src_rect,
    2.22  		Bitmap *dest_bitmap,
    2.23  		Point dest_upper_left,
    2.24 -		boolean flip_horizontal,
    2.25 -		boolean flip_vertical,
    2.26 -		boolean transpose,
    2.27 +		int scan,
    2.28  		int tfn);
     3.1 --- a/bitblt_test.c	Thu Dec 27 11:04:43 2001 +0000
     3.2 +++ b/bitblt_test.c	Thu Dec 27 11:17:28 2001 +0000
     3.3 @@ -16,7 +16,7 @@
     3.4    ".....X....X...X.....",
     3.5    ".....X.....X..X.....",
     3.6    ".....XXXXXXXXXX.....",
     3.7 -  ".....XXXXXXXXXX....."
     3.8 +  ".....X.X.X.X.X......"
     3.9  };
    3.10  
    3.11  Bitmap *setup (void)
    3.12 @@ -82,8 +82,7 @@
    3.13  
    3.14    b2 = bitblt (b, r,
    3.15  	       NULL, p,
    3.16 -	       0, 0, 
    3.17 -	       1,  /* transpose */
    3.18 +	       ROT_90,
    3.19  	       TF_SRC);
    3.20    if (! b2)
    3.21      {