summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2018-06-06 00:43:52 +0200
committerRay <[email protected]>2018-06-06 00:43:52 +0200
commit817ae075050b348e42223a567e7deaff42b6bb24 (patch)
tree7c514bb6687cfe2debeb49b3a9dde0da487d4668 /src
parent31cd4a1a48f0e6b9678cbc3bb5c22a353665e1af (diff)
downloadraylib-817ae075050b348e42223a567e7deaff42b6bb24.tar.gz
raylib-817ae075050b348e42223a567e7deaff42b6bb24.zip
Some comments cleaning
ImageDraw() code tweak
Diffstat (limited to 'src')
-rw-r--r--src/textures.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/src/textures.c b/src/textures.c
index 0b9f907e..c7bd7648 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -1075,40 +1075,10 @@ void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, in
Rectangle srcRec = { 0, 0, image->width, image->height };
Rectangle dstRec = { offsetX, offsetY, srcRec.width, srcRec.height };
+ // TODO: Review different scaling situations
+
if ((newWidth > image->width) && (newHeight > image->height))
{
- // Consider anchor properly
- /*
- switch (anchor)
- {
- case 0: break; // TOP-LEFT corner --> dstRec = srcRec
- case 1: dstRec.x = (newWidth - image->width)/2; break; // TOP side
- case 2: dstRec.x = newWidth - image->width; break; // TOP-RIGHT corner
- case 3: dstRec.y = (newHeight - image->height)/2; break; // LEFT side
- case 4: // CENTER
- {
- dstRec.x = (newWidth - image->width)/2;
- dstRec.y = (newHeight - image->height)/2;
- } break;
- case 5: // RIGHT side
- {
- dstRec.x = newWidth - image->width;
- dstRec.y = (newHeight - image->height)/2;
- } break;
- case 6: dstRec.y = newHeight - image->height; break; // BOTTOM-LEFT corner
- case 7: // BOTTOM side
- {
- dstRec.x = (newWidth - image->width)/2;
- dstRec.y = newHeight - image->height;
- } break;
- case 8: // BOTTOM-RIGHT side
- {
- dstRec.x = newWidth - image->width;
- dstRec.y = newHeight - image->height;
- } break;
- default: break;
- }
- */
ImageDraw(&imTemp, *image, srcRec, dstRec);
ImageFormat(&imTemp, image->format);
UnloadImage(*image);
@@ -1325,7 +1295,6 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec)
{
srcRec.height = src.height - srcRec.y;
TraceLog(LOG_WARNING, "Source rectangle height out of bounds, rescaled height: %i", srcRec.height);
- cropRequired = true;
}
Image srcCopy = ImageCopy(src); // Make a copy of source image to work with it
@@ -1337,10 +1306,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec)
if (dstRec.y < 0) dstRec.y = 0;
// Scale source image in case destination rec size is different than source rec size
- if ((dstRec.width != srcRec.width) || (dstRec.height != srcRec.height))
- {
- ImageResize(&srcCopy, dstRec.width, dstRec.height);
- }
+ if ((dstRec.width != srcRec.width) || (dstRec.height != srcRec.height)) ImageResize(&srcCopy, dstRec.width, dstRec.height);
if ((dstRec.x + dstRec.width) > dst->width)
{