This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 1c0f25ead2f6ba48d8ab03dcaef1d2fbcde9788c
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Oct 4 14:43:12 2024 +0200
blend: Rename some variables for clarity
---
src/lib/blend.c | 84 +++++++++++++++++++++++++++------------------------------
src/lib/blend.h | 6 ++---
2 files changed, 41 insertions(+), 49 deletions(-)
diff --git a/src/lib/blend.c b/src/lib/blend.c
index 601bc07..7a2be4d 100644
--- a/src/lib/blend.c
+++ b/src/lib/blend.c
@@ -1804,8 +1804,8 @@ __imlib_BlendRGBAToData(const uint32_t *src, int src_w, int src_h,
void
__imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
char aa, char blend, char merge_alpha,
- int ssx, int ssy, int ssw, int ssh,
- int ddx, int ddy, int ddw, int ddh,
+ int sx, int sy, int sw, int sh,
+ int dx, int dy, int dw, int dh,
const ImlibColorModifier *cm, ImlibOp op,
int clx, int cly, int clw, int clh)
{
@@ -1817,10 +1817,10 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
/* don't do anything if we have a 0 width or height image to render */
/* if the input rect size < 0 don't render either */
- if (ssw <= 0 || ssh <= 0 || ddw == 0 || ddh == 0)
+ if (sw <= 0 || sh <= 0 || dw == 0 || dh == 0)
return;
- if ((ssw == ddw) && (ssh == ddh))
+ if ((sw == dw) && (sh == dh))
{
if (!im_dst->has_alpha)
merge_alpha = 0;
@@ -1832,38 +1832,32 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
}
if (clw)
{
- int px, py;
+ int pdx, pdy;
- px = ddx;
- py = ddy;
- CLIP(ddx, ddy, ddw, ddh, clx, cly, clw, clh);
- if (ddw <= 0 || ddh <= 0)
+ pdx = dx;
+ pdy = dy;
+ CLIP(dx, dy, dw, dh, clx, cly, clw, clh);
+ if (dw <= 0 || dh <= 0)
return;
- ssx += ddx - px;
- ssy += ddy - py;
+ sx += dx - pdx;
+ sy += dy - pdy;
}
__imlib_BlendRGBAToData(im_src->data, im_src->w, im_src->h,
im_dst->data, im_dst->w, im_dst->h,
- ssx, ssy, ddx, ddy, ddw, ddh,
+ sx, sy, dx, dy, dw, dh,
blend, merge_alpha, cm, op, rgb_src);
}
else
{
ImlibScaleInfo *scaleinfo;
uint32_t *buf;
- int sx, sy, sw, sh, dx, dy, dw, dh, dxx, dyy, y2, x2;
+ int dwabs, dhabs, dxx, dyy, y2, x2;
int psx, psy, psw, psh;
int y, h, hh;
- sx = ssx;
- sy = ssy;
- sw = ssw;
- sh = ssh;
- dx = ddx;
- dy = ddy;
- dw = abs(ddw);
- dh = abs(ddh);
+ dwabs = abs(dw);
+ dhabs = abs(dh);
/* clip the source rect to be within the actual image */
psx = sx;
@@ -1874,40 +1868,40 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
if (sw <= 0 || sh <= 0)
return;
if (psx != sx)
- dx += ((sx - psx) * abs(ddw)) / ssw;
+ dx += ((sx - psx) * dwabs) / sw;
if (psy != sy)
- dy += ((sy - psy) * abs(ddh)) / ssh;
+ dy += ((sy - psy) * dhabs) / sh;
if (psw != sw)
- dw = (dw * sw) / psw;
+ dwabs = (dwabs * sw) / psw;
if (psh != sh)
- dh = (dh * sh) / psh;
- if (dw <= 0 || dh <= 0)
+ dhabs = (dhabs * sh) / psh;
+ if (dwabs <= 0 || dhabs <= 0)
return;
/* clip output coords to clipped input coords */
psx = dx;
psy = dy;
- psw = dw;
- psh = dh;
+ psw = dwabs;
+ psh = dhabs;
x2 = sx;
y2 = sy;
- CLIP(dx, dy, dw, dh, 0, 0, im_dst->w, im_dst->h);
- if (dw <= 0 || dh <= 0)
+ CLIP(dx, dy, dwabs, dhabs, 0, 0, im_dst->w, im_dst->h);
+ if (dwabs <= 0 || dhabs <= 0)
return;
if (clw)
{
- CLIP(dx, dy, dw, dh, clx, cly, clw, clh);
- if (dw <= 0 || dh <= 0)
+ CLIP(dx, dy, dwabs, dhabs, clx, cly, clw, clh);
+ if (dwabs <= 0 || dhabs <= 0)
return;
}
- if (psw != dw)
- sw = (sw * dw) / psw;
- if (psh != dh)
- sh = (sh * dh) / psh;
+ if (psw != dwabs)
+ sw = (sw * dwabs) / psw;
+ if (psh != dhabs)
+ sh = (sh * dhabs) / psh;
dxx = dx - psx;
dyy = dy - psy;
- dxx += (x2 * abs(ddw)) / ssw;
- dyy += (y2 * abs(ddh)) / ssh;
+ dxx += (x2 * abs(dw)) / sw;
+ dyy += (y2 * abs(dh)) / sh;
if (sw == 0)
sw = 1;
@@ -1919,12 +1913,12 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
if (sw <= 0 || sh <= 0)
return;
- scaleinfo = __imlib_CalcScaleInfo(im_src, ssw, ssh, ddw, ddh, aa);
+ scaleinfo = __imlib_CalcScaleInfo(im_src, sw, sh, dw, dh, aa);
if (!scaleinfo)
return;
/* if we are scaling the image at all make a scaling buffer */
/* allocate a buffer to render scaled RGBA data into */
- buf = malloc(dw * LINESIZE * sizeof(uint32_t));
+ buf = malloc(dwabs * LINESIZE * sizeof(uint32_t));
if (!buf)
{
__imlib_FreeScaleInfo(scaleinfo);
@@ -1932,7 +1926,7 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
}
/* setup h */
- h = dh;
+ h = dhabs;
if (!im_dst->has_alpha)
merge_alpha = 0;
if (!im_src->has_alpha)
@@ -1943,7 +1937,7 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
}
/* scale in LINESIZE Y chunks and convert to depth */
- for (y = 0; y < dh; y += LINESIZE, h -= LINESIZE)
+ for (y = 0; y < dhabs; y += LINESIZE, h -= LINESIZE)
{
hh = LINESIZE;
if (h < LINESIZE)
@@ -1952,11 +1946,11 @@ __imlib_BlendImageToImage(const ImlibImage *im_src, ImlibImage *im_dst,
/* scale the imagedata for this LINESIZE lines chunk of image */
__imlib_Scale(scaleinfo, aa, im_src->has_alpha,
im_src->data, buf, dxx, dyy + y,
- 0, 0, dw, hh, dw, im_src->w);
+ 0, 0, dwabs, hh, dwabs, im_src->w);
- __imlib_BlendRGBAToData(buf, dw, hh,
+ __imlib_BlendRGBAToData(buf, dwabs, hh,
im_dst->data, im_dst->w, im_dst->h,
- 0, 0, dx, dy + y, dw, dh,
+ 0, 0, dx, dy + y, dwabs, dhabs,
blend, merge_alpha, cm, op, rgb_src);
}
/* free up our buffers and point tables */
diff --git a/src/lib/blend.h b/src/lib/blend.h
index 458de53..701a072 100644
--- a/src/lib/blend.h
+++ b/src/lib/blend.h
@@ -313,10 +313,8 @@ ImlibBlendFunction __imlib_GetBlendFunction(ImlibOp op, char merge_alpha,
void __imlib_BlendImageToImage(const ImlibImage * im_src,
ImlibImage * im_dst, char aa,
char blend, char merge_alpha,
- int ssx, int ssy,
- int ssw, int ssh,
- int ddx, int ddy,
- int ddw, int ddh,
+ int sx, int sy, int sw, int sh,
+ int dx, int dy, int dw, int dh,
const ImlibColorModifier * cm,
ImlibOp op, int clx, int cly,
int clw, int clh);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.