bitblt_test.c

changeset 43
b80cb5a4282a
parent 11
30d18cf8bb67
child 47
bfc6aaa089b0
     1.1 diff -r 9c85a4cd88a3 -r b80cb5a4282a bitblt_test.c
     1.2 --- a/bitblt_test.c	Wed Jan 02 16:39:39 2002 +0000
     1.3 +++ b/bitblt_test.c	Tue Jan 22 09:42:42 2002 +0000
     1.4 @@ -1,4 +1,5 @@
     1.5  #include <stdio.h>
     1.6 +#include <stdlib.h>
     1.7  
     1.8  #include "type.h"
     1.9  #include "bitblt.h"
    1.10 @@ -24,8 +25,9 @@
    1.11  {
    1.12    Bitmap *b;
    1.13    Point p;
    1.14 +  Rect r = {{ 0, 0 }, { WIDTH, HEIGHT }};
    1.15  
    1.16 -  b = create_bitmap (WIDTH, HEIGHT);
    1.17 +  b = create_bitmap (& r);
    1.18    if (! b)
    1.19      return (NULL);
    1.20  
    1.21 @@ -39,10 +41,10 @@
    1.22  void print_bitmap (FILE *o, Bitmap *b)
    1.23  {
    1.24    Point p;
    1.25 -  printf ("rowbytes: %d\n", b->rowbytes);
    1.26 -  for (p.y = 0; p.y < b->height; p.y++)
    1.27 +  printf ("row_words: %d\n", b->row_words);
    1.28 +  for (p.y = b->rect.min.y; p.y < b->rect.max.y; p.y++)
    1.29      {
    1.30 -      for (p.x = 0; p.x < b->width; p.x++)
    1.31 +      for (p.x = b->rect.min.x; p.x < b->rect.max.x; p.x++)
    1.32  	fputc (".X" [get_pixel (b, p)], o);
    1.33        fprintf (o, "\n");
    1.34      }
    1.35 @@ -64,18 +66,19 @@
    1.36      }
    1.37  
    1.38    print_bitmap (stdout, b);
    1.39 +  printf ("\n");
    1.40  
    1.41 +  flip_v (b);
    1.42 +
    1.43 +  print_bitmap (stdout, b);
    1.44 +  printf ("\n");
    1.45 +
    1.46 +  flip_h (b);
    1.47 +
    1.48 +  print_bitmap (stdout, b);
    1.49    printf ("\n");
    1.50  
    1.51  #if 0
    1.52 -  b2 = create_bitmap (b->height, b->width);
    1.53 -  if (! b2)
    1.54 -    {
    1.55 -      fprintf (stderr, "create_bitmap failed\n");
    1.56 -      exit (2);
    1.57 -    }
    1.58 -#endif
    1.59 -
    1.60    r.upper_left.x = r.upper_left.y = 0;
    1.61    r.lower_right.x = b->width;
    1.62    r.lower_right.y = b->height;
    1.63 @@ -92,6 +95,7 @@
    1.64      }
    1.65  
    1.66    print_bitmap (stdout, b2);
    1.67 +#endif
    1.68  
    1.69    exit (0);
    1.70  }