summaryrefslogtreecommitdiffhomepage
path: root/src/textures.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-06-08 18:23:59 +0200
committerraysan5 <[email protected]>2020-06-08 18:23:59 +0200
commit40bc6afdbd06d213a07a5e321f4f285d613a1fe5 (patch)
tree43826ae5c78bd41a54981de7a24cd885b4ebfd91 /src/textures.c
parent6264c4901b67fb49f829165bdb806c11be40b29a (diff)
downloadraylib-40bc6afdbd06d213a07a5e321f4f285d613a1fe5.tar.gz
raylib-40bc6afdbd06d213a07a5e321f4f285d613a1fe5.zip
REVIEWED: ImageAlphaClear(), minor optimization
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/textures.c b/src/textures.c
index df7b35be..1a8af614 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1107,8 +1107,9 @@ void ImageAlphaClear(Image *image, Color color, float threshold)
if ((image->data == NULL) || (image->width == 0) || (image->height == 0)) return;
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);
int format = image->format;