|
|
@@ -49,11 +49,11 @@ int pipi_getpixel(pipi_image_t const *img, |
|
|
{ |
|
|
{ |
|
|
uint8_t *pixel; |
|
|
uint8_t *pixel; |
|
|
|
|
|
|
|
|
if(x < 0 || y < 0 || x >= img->width || y >= img->height) |
|
|
|
|
|
{ |
|
|
|
|
|
*r = *g = *b = 1.; |
|
|
|
|
|
return -1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(x < 0) x = 0; |
|
|
|
|
|
else if(x >= img->width) x = img->width - 1; |
|
|
|
|
|
|
|
|
|
|
|
if(y < 0) y = 0; |
|
|
|
|
|
else if(y >= img->height) y = img->height - 1; |
|
|
|
|
|
|
|
|
pixel = img->pixels + y * img->pitch + x * img->channels; |
|
|
pixel = img->pixels + y * img->pitch + x * img->channels; |
|
|
|
|
|
|
|
|
|