diff options
| author | Ray <[email protected]> | 2020-01-15 11:52:50 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-01-15 11:52:50 +0100 |
| commit | 237972652d846495b42c3601f4b696c15b14cad2 (patch) | |
| tree | 06bfab4b26073c6c4ce4b9d6da1ff5070e7e224d /src | |
| parent | 9f699af138d4f6fc7e495b86a9f361159e9aef63 (diff) | |
| download | raylib-237972652d846495b42c3601f4b696c15b14cad2.tar.gz raylib-237972652d846495b42c3601f4b696c15b14cad2.zip | |
GetImageAlphaBorder() return 0 in case of blank image
Diffstat (limited to 'src')
| -rw-r--r-- | src/textures.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/textures.c b/src/textures.c index 768e1be6..19bfd16a 100644 --- a/src/textures.c +++ b/src/textures.c @@ -301,7 +301,7 @@ Image LoadImage(const char *fileName) // NOTE: Creates a copy of pixels data array Image LoadImageEx(Color *pixels, int width, int height) { - Image image; + Image image = { 0 }; image.data = NULL; image.width = width; image.height = height; @@ -710,7 +710,11 @@ Rectangle GetImageAlphaBorder(Image image, float threshold) } } - crop = (Rectangle){ xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin }; + // Check for empty blank image + if ((xMin != 65536) && (xMax != 65536)) + { + crop = (Rectangle){ xMin, yMin, (xMax + 1) - xMin, (yMax + 1) - yMin }; + } RL_FREE(pixels); } |
