diff options
| author | raysan5 <[email protected]> | 2020-06-20 18:49:15 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-06-20 18:49:15 +0200 |
| commit | 5a862bce29c761da0d65baaa1b146f71df84db1a (patch) | |
| tree | 665b455c0a32d2c40c59e8cc4fcb48d9b6c6a960 /src/textures.c | |
| parent | da582e2eec658e59f017c1d4507221af1c87b656 (diff) | |
| download | raylib-5a862bce29c761da0d65baaa1b146f71df84db1a.tar.gz raylib-5a862bce29c761da0d65baaa1b146f71df84db1a.zip | |
REVIEWED: ImageDraw(), consider negative source offset properly #1283
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/textures.c b/src/textures.c index 279fa0a2..7c6cf801 100644 --- a/src/textures.c +++ b/src/textures.c @@ -2529,8 +2529,8 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color bool useSrcMod = false; // Track source copy required // Source rectangle out-of-bounds security checks - if (srcRec.x < 0) { srcRec.width -= srcRec.x; srcRec.x = 0; } - if (srcRec.y < 0) { srcRec.height -= srcRec.y; srcRec.y = 0; } + if (srcRec.x < 0) { srcRec.width += srcRec.x; srcRec.x = 0; } + if (srcRec.y < 0) { srcRec.height += srcRec.y; srcRec.y = 0; } if ((srcRec.x + srcRec.width) > src.width) srcRec.width = src.width - srcRec.x; if ((srcRec.y + srcRec.height) > src.height) srcRec.height = src.height - srcRec.y; |
