1
0
mirror of synced 2026-01-13 15:27:55 +00:00

change coordinates to signed.

This commit is contained in:
Eric Smith 2002-01-01 10:18:33 +00:00
parent 39101afa09
commit f2357f5596
2 changed files with 6 additions and 5 deletions

View File

@ -50,7 +50,8 @@ void free_bitmap (Bitmap *bitmap)
boolean get_pixel (Bitmap *bitmap, Point coord)
{
u8 *p;
if ((coord.x >= bitmap->width) || (coord.y >= bitmap->height))
if ((coord.x < 0) || (coord.y < 0) ||
(coord.x >= bitmap->width) || (coord.y >= bitmap->height))
return (0);
p = bitmap->bits + coord.y * bitmap->rowbytes + coord.x / 8;
return ((*p & pixel_mask (coord.x & 7)) != 0);
@ -59,7 +60,8 @@ boolean get_pixel (Bitmap *bitmap, Point coord)
void set_pixel (Bitmap *bitmap, Point coord, boolean value)
{
u8 *p;
if ((coord.x >= bitmap->width) || (coord.y >= bitmap->height))
if ((coord.x < 0) || (coord.y < 0) ||
(coord.x >= bitmap->width) || (coord.y >= bitmap->height))
return;
p = bitmap->bits + coord.y * bitmap->rowbytes + coord.x / 8;
if (value)
@ -77,7 +79,6 @@ Bitmap *bitblt (Bitmap *src_bitmap,
int tfn)
{
Point src_point, dest_point;
boolean src_pixel, dest_pixel;
if (! dest_bitmap)
{

View File

@ -1,7 +1,7 @@
typedef struct Point
{
u32 x;
u32 y;
int x;
int y;
} Point;
typedef struct Rect