change coordinates to signed.

Tue, 01 Jan 2002 10:18:33 +0000

author
eric
date
Tue, 01 Jan 2002 10:18:33 +0000
changeset 33
44d823824a46
parent 32
3aac131058da
child 34
8d7bd2fa5db6

change coordinates to signed.

bitblt.c file | annotate | diff | revisions
bitblt.h file | annotate | diff | revisions
     1.1 --- a/bitblt.c	Tue Jan 01 10:16:50 2002 +0000
     1.2 +++ b/bitblt.c	Tue Jan 01 10:18:33 2002 +0000
     1.3 @@ -50,7 +50,8 @@
     1.4  boolean get_pixel (Bitmap *bitmap, Point coord)
     1.5  {
     1.6    u8 *p;
     1.7 -  if ((coord.x >= bitmap->width) || (coord.y >= bitmap->height))
     1.8 +  if ((coord.x < 0) || (coord.y < 0) ||
     1.9 +      (coord.x >= bitmap->width) || (coord.y >= bitmap->height))
    1.10      return (0);
    1.11    p = bitmap->bits + coord.y * bitmap->rowbytes + coord.x / 8;
    1.12    return ((*p & pixel_mask (coord.x & 7)) != 0);
    1.13 @@ -59,7 +60,8 @@
    1.14  void set_pixel (Bitmap *bitmap, Point coord, boolean value)
    1.15  {
    1.16    u8 *p;
    1.17 -  if ((coord.x >= bitmap->width) || (coord.y >= bitmap->height))
    1.18 +  if ((coord.x < 0) || (coord.y < 0) ||
    1.19 +      (coord.x >= bitmap->width) || (coord.y >= bitmap->height))
    1.20      return;
    1.21    p = bitmap->bits + coord.y * bitmap->rowbytes + coord.x / 8;
    1.22    if (value)
    1.23 @@ -77,7 +79,6 @@
    1.24  		int tfn)
    1.25  {
    1.26    Point src_point, dest_point;
    1.27 -  boolean src_pixel, dest_pixel;
    1.28  
    1.29    if (! dest_bitmap)
    1.30      {
     2.1 --- a/bitblt.h	Tue Jan 01 10:16:50 2002 +0000
     2.2 +++ b/bitblt.h	Tue Jan 01 10:18:33 2002 +0000
     2.3 @@ -1,7 +1,7 @@
     2.4  typedef struct Point
     2.5  {
     2.6 -  u32 x;
     2.7 -  u32 y;
     2.8 +  int x;
     2.9 +  int y;
    2.10  } Point;
    2.11  
    2.12  typedef struct Rect