use signed integers for coordinates.
This commit is contained in:
9
bitblt.c
9
bitblt.c
@@ -12,20 +12,23 @@ static inline u8 pixel_mask (x)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline u32 rect_width (Rect r)
|
||||
static inline s32 rect_width (Rect r)
|
||||
{
|
||||
return (r.lower_right.x - r.upper_left.x);
|
||||
}
|
||||
|
||||
static inline u32 rect_height (Rect r)
|
||||
static inline s32 rect_height (Rect r)
|
||||
{
|
||||
return (r.lower_right.y - r.upper_left.y);
|
||||
}
|
||||
|
||||
Bitmap *create_bitmap (u32 width, u32 height)
|
||||
Bitmap *create_bitmap (s32 width, s32 height)
|
||||
{
|
||||
Bitmap *bitmap;
|
||||
|
||||
if ((width <= 0) || (height <= 0))
|
||||
return (NULL);
|
||||
|
||||
bitmap = calloc (1, sizeof (Bitmap));
|
||||
if (! bitmap)
|
||||
return (NULL);
|
||||
|
||||
10
bitblt.h
10
bitblt.h
@@ -1,7 +1,7 @@
|
||||
typedef struct Point
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
s32 x;
|
||||
s32 y;
|
||||
} Point;
|
||||
|
||||
typedef struct Rect
|
||||
@@ -13,8 +13,8 @@ typedef struct Rect
|
||||
typedef struct Bitmap
|
||||
{
|
||||
u8 *bits;
|
||||
u32 width;
|
||||
u32 height;
|
||||
s32 width;
|
||||
s32 height;
|
||||
u32 rowbytes;
|
||||
} Bitmap;
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef struct Bitmap
|
||||
#define ROT_270 (TRANSPOSE + FLIP_V)
|
||||
|
||||
|
||||
Bitmap *create_bitmap (u32 width, u32 height);
|
||||
Bitmap *create_bitmap (s32 width, s32 height);
|
||||
void free_bitmap (Bitmap *bitmap);
|
||||
boolean get_pixel (Bitmap *bitmap, Point coord);
|
||||
void set_pixel (Bitmap *bitmap, Point coord, boolean value);
|
||||
|
||||
Reference in New Issue
Block a user