bitblt_test.c

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