From 5112373338d379998fabeee67d7b0896008eb1fd Mon Sep 17 00:00:00 2001 From: rxi Date: Mon, 26 Sep 2016 20:40:05 +0100 Subject: [PATCH] Made image_setPixel() static inline; added image_setMaskPixel() --- src/image.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/image.h b/src/image.h index e484de5..f0c34cf 100644 --- a/src/image.h +++ b/src/image.h @@ -12,12 +12,6 @@ #include "luaobj.h" -#define image_setPixel(self, x, y, color)\ - if ((x) > 0 && (x) < (self)->width && (y) > 0 && (y) < (self)->height) {\ - (self)->data[(x) + (y) * (self)->width] = (color);\ - } - - enum { IMAGE_NORMAL, IMAGE_FAST, @@ -34,6 +28,20 @@ typedef struct { } image_t; +static inline +void image_setPixel(image_t* self, int x, int y, pixel_t val) { + if (x > 0 && x < self->width && y > 0 && y < self->height) { + self->data[x + y * self->width] = val; + } +} + +static inline +void image_setMaskPixel(image_t* self, int x, int y, pixel_t val) { + if (x > 0 && x < self->width && y > 0 && y < self->height) { + self->mask[x + y * self->width] = val; + } +} + void image_setColor(pixel_t color); void image_setBlendMode(int mode); void image_setFlip(int mode);