diff options
| author | raysan5 <raysan5@gmail.com> | 2019-09-14 19:01:33 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2019-09-14 19:01:33 +0200 |
| commit | c10348cc85ffbe57e36e60693fa1f51375aefde0 (patch) | |
| tree | 333a7e44798aa64edd73f6937901f91f61b273c9 | |
| parent | 904a7ee03278606f9495bf897fa1ba2918700e3d (diff) | |
| download | raylib-c10348cc85ffbe57e36e60693fa1f51375aefde0.tar.gz raylib-c10348cc85ffbe57e36e60693fa1f51375aefde0.zip | |
Review conditions
| -rw-r--r-- | src/textures.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/textures.c b/src/textures.c index 56ff194a..8f5b5c97 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1826,7 +1826,9 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color } Image srcCopy = ImageCopy(src); // Make a copy of source image to work with it - ImageCrop(&srcCopy, srcRec); // Crop source image to desired source rectangle + + // Crop source image to desired source rectangle (if required) + if ((src.width != (int)srcRec.width) && (src.height != (int)srcRec.height)) ImageCrop(&srcCopy, srcRec); // Scale source image in case destination rec size is different than source rec size if (((int)dstRec.width != (int)srcRec.width) || ((int)dstRec.height != (int)srcRec.height)) @@ -1856,7 +1858,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color dstRec.y = 0; } - if (dstRec.y > (dst->height - dstRec.height)) + if ((dstRec.y + dstRec.height) > dst->height) { ImageCrop(&srcCopy, (Rectangle) { 0, 0, dstRec.width, dst->height - dstRec.y }); dstRec.height = dst->height - dstRec.y; |
