diff options
| author | Ray <[email protected]> | 2023-08-27 00:30:56 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-08-27 00:30:56 +0200 |
| commit | 96464972168e32221298fef24af7c24b292e55f7 (patch) | |
| tree | 2228fcb1d90240fe5f8f39ab0bb8ab0526fbe282 /src/rtextures.c | |
| parent | b27e98a428a1732b2f146770e96631aa13aec8b0 (diff) | |
| download | raylib-96464972168e32221298fef24af7c24b292e55f7.tar.gz raylib-96464972168e32221298fef24af7c24b292e55f7.zip | |
Formating review
Diffstat (limited to 'src/rtextures.c')
| -rw-r--r-- | src/rtextures.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/rtextures.c b/src/rtextures.c index f32a45d1..b88aeb15 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -3284,19 +3284,13 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) if (rec.width < 0) rec.width = 0; if (rec.height < 0) rec.height = 0; - // clamp the size the the image bounds - if (rec.x + rec.width >= dst->width) - rec.width = dst->width - rec.x; + // Clamp the size the the image bounds + if ((rec.x + rec.width) >= dst->width) rec.width = dst->width - rec.x; + if ((rec.y + rec.height) >= dst->height) rec.height = dst->height - rec.y; - if (rec.y + rec.height >= dst->height) - rec.height = dst->height - rec.y; - - // check if the rect is even inside the image - if (rec.x > dst->width || rec.y > dst->height) - return; - - if (rec.x + rec.width < 0 || rec.y + rec.height < 0) - return; + // Check if the rect is even inside the image + if ((rec.x > dst->width) || (rec.y > dst->height)) return; + if (((rec.x + rec.width) < 0) || (rec.y + rec.height < 0)) return; int sy = (int)rec.y; int sx = (int)rec.x; |
