diff options
| author | Le Juez Victor <[email protected]> | 2024-01-11 19:37:42 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-11 19:37:42 +0100 |
| commit | 746f129bfe161c12bed294bd9d8514d8e46517ec (patch) | |
| tree | 4afd5ba28dde73ccca5d76dc180674b7a094a321 /src | |
| parent | 64ba5cb570a29f540c29165ff4bbdab16d422910 (diff) | |
| download | raylib-746f129bfe161c12bed294bd9d8514d8e46517ec.tar.gz raylib-746f129bfe161c12bed294bd9d8514d8e46517ec.zip | |
Fix `ImageDrawRectangleRec` (#3721)
Diffstat (limited to 'src')
| -rw-r--r-- | src/rtextures.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index ee7d7693..738f593c 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -3562,8 +3562,8 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) if ((dst->data == NULL) || (dst->width == 0) || (dst->height == 0)) return; // Security check to avoid drawing out of bounds in case of bad user data - if (rec.x < 0) { rec.width -= rec.x; rec.x = 0; } - if (rec.y < 0) { rec.height -= rec.y; rec.y = 0; } + if (rec.x < 0) { rec.width += rec.x; rec.x = 0; } + if (rec.y < 0) { rec.height += rec.y; rec.y = 0; } if (rec.width < 0) rec.width = 0; if (rec.height < 0) rec.height = 0; |
