diff options
| author | raysan5 <[email protected]> | 2020-06-08 18:23:59 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-06-08 18:23:59 +0200 |
| commit | 40bc6afdbd06d213a07a5e321f4f285d613a1fe5 (patch) | |
| tree | 43826ae5c78bd41a54981de7a24cd885b4ebfd91 /src/textures.c | |
| parent | 6264c4901b67fb49f829165bdb806c11be40b29a (diff) | |
| download | raylib-40bc6afdbd06d213a07a5e321f4f285d613a1fe5.tar.gz raylib-40bc6afdbd06d213a07a5e321f4f285d613a1fe5.zip | |
REVIEWED: ImageAlphaClear(), minor optimization
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 3 |
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; |
