REVIEWED: ImageAlphaClear(), minor optimization
This commit is contained in:
parent
6264c4901b
commit
40bc6afdbd
1 changed files with 2 additions and 1 deletions
|
@ -1107,8 +1107,9 @@ void ImageAlphaClear(Image *image, Color color, float threshold)
|
||||||
if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return;
|
if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return;
|
||||||
|
|
||||||
Color *pixels = GetImageData(*image);
|
Color *pixels = GetImageData(*image);
|
||||||
|
unsigned char thresholdValue = (unsigned char)(threshold*255.0f);
|
||||||
|
|
||||||
for (int i = 0; i < image->width*image->height; i++) if (pixels[i].a <= (unsigned char)(threshold*255.0f)) pixels[i] = color;
|
for (int i = 0; i < image->width*image->height; i++) if (pixels[i].a <= thresholdValue) pixels[i] = color;
|
||||||
|
|
||||||
RL_FREE(image->data);
|
RL_FREE(image->data);
|
||||||
int format = image->format;
|
int format = image->format;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue