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 61a180f3b0a5d5abec7848ae780c6c539a81d1db
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Thu May 4 16:56:14 2023 +0200
scaling: Move scaling function call sequence into common __imlib_Scale()
---
src/lib/blend.c | 19 +++++--------------
src/lib/scale.c | 24 ++++++++++++++++++++----
src/lib/scale.h | 17 ++++++-----------
src/lib/x11_rend.c | 29 +++++++++++++----------------
4 files changed, 44 insertions(+), 45 deletions(-)
diff --git a/src/lib/blend.c b/src/lib/blend.c
index 224e6e3..08e0153 100644
--- a/src/lib/blend.c
+++ b/src/lib/blend.c
@@ -1937,30 +1937,21 @@ __imlib_BlendImageToImage(ImlibImage * im_src, ImlibImage * im_dst,
}
/* scale in LINESIZE Y chunks and convert to depth */
- for (y = 0; y < dh; y += LINESIZE)
+ for (y = 0; y < dh; y += LINESIZE, h -= LINESIZE)
{
hh = LINESIZE;
if (h < LINESIZE)
hh = h;
+
/* scale the imagedata for this LINESIZE lines chunk of image */
- if (aa)
- {
- if (im_src->has_alpha)
- __imlib_ScaleAARGBA(scaleinfo, buf, dxx, dyy + y,
- 0, 0, dw, hh, dw, im_src->w);
- else
- __imlib_ScaleAARGB(scaleinfo, buf, dxx, dyy + y,
- 0, 0, dw, hh, dw, im_src->w);
- }
- else
- __imlib_ScaleSampleRGBA(scaleinfo, buf, dxx, dyy + y,
- 0, 0, dw, hh, dw);
+ __imlib_Scale(scaleinfo, aa, im_src->has_alpha, buf, dxx, dyy + y,
+ 0, 0, dw, hh, dw, im_src->w);
+
__imlib_BlendRGBAToData(buf, dw, hh,
im_dst->data, im_dst->w,
im_dst->h,
0, 0, dx, dy + y, dw, dh,
blend, merge_alpha, cm, op, rgb_src);
- h -= LINESIZE;
}
/* free up our buffers and point tables */
free(buf);
diff --git a/src/lib/scale.c b/src/lib/scale.c
index 0cc7d4d..91ad38c 100644
--- a/src/lib/scale.c
+++ b/src/lib/scale.c
@@ -245,7 +245,7 @@ __imlib_FreeScaleInfo(ImlibScaleInfo * isi)
}
ImlibScaleInfo *
-__imlib_CalcScaleInfo(ImlibImage * im, int sw, int sh, int dw, int dh, char aa)
+__imlib_CalcScaleInfo(ImlibImage * im, int sw, int sh, int dw, int dh, bool aa)
{
ImlibScaleInfo *isi;
int scw, sch;
@@ -286,7 +286,7 @@ __imlib_CalcScaleInfo(ImlibImage * im, int sw, int sh, int dw, int dh, char aa)
}
/* scale by pixel sampling only */
-void
+static void
__imlib_ScaleSampleRGBA(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
int dx, int dy, int dw, int dh, int dow)
{
@@ -313,7 +313,7 @@ __imlib_ScaleSampleRGBA(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
/* FIXME: NEED to optimise ScaleAARGBA - currently its "ok" but needs work*/
/* scale by area sampling */
-void
+static void
__imlib_ScaleAARGBA(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
int dx, int dy, int dw, int dh, int dow, int sow)
{
@@ -723,7 +723,7 @@ __imlib_ScaleAARGBA(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
}
/* scale by area sampling - IGNORE the ALPHA byte*/
-void
+static void
__imlib_ScaleAARGB(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
int dx, int dy, int dw, int dh, int dow, int sow)
{
@@ -1085,3 +1085,19 @@ __imlib_ScaleAARGB(ImlibScaleInfo * isi, uint32_t * dest, int dxx, int dyy,
}
}
}
+
+void
+__imlib_Scale(ImlibScaleInfo * isi, bool aa, bool alpha,
+ uint32_t * dest, int dxx, int dyy, int dx, int dy,
+ int dw, int dh, int dow, int sow)
+{
+ if (aa)
+ {
+ if (alpha)
+ __imlib_ScaleAARGBA(isi, dest, dxx, dyy, dx, dy, dw, dh, dow, sow);
+ else
+ __imlib_ScaleAARGB(isi, dest, dxx, dyy, dx, dy, dw, dh, dow, sow);
+ }
+ else
+ __imlib_ScaleSampleRGBA(isi, dest, dxx, dyy, dx, dy, dw, dh, dow);
+}
diff --git a/src/lib/scale.h b/src/lib/scale.h
index 7ef923d..118967a 100644
--- a/src/lib/scale.h
+++ b/src/lib/scale.h
@@ -7,18 +7,13 @@ typedef struct _imlib_scale_info ImlibScaleInfo;
ImlibScaleInfo *__imlib_CalcScaleInfo(ImlibImage * im,
int sw, int sh,
- int dw, int dh, char aa);
+ int dw, int dh, bool aa);
ImlibScaleInfo *__imlib_FreeScaleInfo(ImlibScaleInfo * isi);
-void __imlib_ScaleSampleRGBA(ImlibScaleInfo * isi,
- uint32_t * dest, int dxx, int dyy,
- int dx, int dy, int dw, int dh,
- int dow);
-void __imlib_ScaleAARGBA(ImlibScaleInfo * isi, uint32_t * dest,
- int dxx, int dyy, int dx, int dy,
- int dw, int dh, int dow, int sow);
-void __imlib_ScaleAARGB(ImlibScaleInfo * isi, uint32_t * dest,
- int dxx, int dyy, int dx, int dy, int dw,
- int dh, int dow, int sow);
+
+void __imlib_Scale(ImlibScaleInfo * isi, bool aa, bool alpha,
+ uint32_t * dest,
+ int dxx, int dyy, int dx, int dy,
+ int dw, int dh, int dow, int sow);
#ifdef DO_MMX_ASM
void __imlib_Scale_mmx_AARGBA(ImlibScaleInfo * isi,
diff --git a/src/lib/x11_rend.c b/src/lib/x11_rend.c
index 2c56951..8fd83ef 100644
--- a/src/lib/x11_rend.c
+++ b/src/lib/x11_rend.c
@@ -369,29 +369,19 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
x11->vis->blue_mask, hiq, ct->palette_type);
if (m)
masker = __imlib_GetMaskFunction(dither_mask);
- for (y = 0; y < dh; y += LINESIZE)
+ for (y = 0; y < dh; y += LINESIZE, h -= LINESIZE)
{
hh = LINESIZE;
if (h < LINESIZE)
hh = h;
+
/* if we're scaling it */
if (scaleinfo)
{
/* scale the imagedata for this LINESIZE lines chunk of image data */
- if (antialias)
- {
- if (im->has_alpha)
- __imlib_ScaleAARGBA(scaleinfo, buf, ((sx * dw) / sw),
- ((sy * dh) / sh) + y,
- 0, 0, dw, hh, dw, im->w);
- else
- __imlib_ScaleAARGB(scaleinfo, buf, ((sx * dw) / sw),
- ((sy * dh) / sh) + y,
- 0, 0, dw, hh, dw, im->w);
- }
- else
- __imlib_ScaleSampleRGBA(scaleinfo, buf, ((sx * dw) / sw),
- ((sy * dh) / sh) + y, 0, 0, dw, hh, dw);
+ __imlib_Scale(scaleinfo, antialias, im->has_alpha,
+ buf, (sx * dw) / sw,
+ ((sy * dh) / sh) + y, 0, 0, dw, hh, dw, im->w);
jump = 0;
pointer = buf;
if (cmod)
@@ -424,6 +414,7 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
pointer = im->data + ((y + sy) * im->w) + sx;
}
}
+
/* if we have a back buffer - we're blending to the bg */
if (back)
{
@@ -431,6 +422,7 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
pointer = back + (y * dw);
jump = 0;
}
+
/* once scaled... convert chunk to bit depth into XImage bufer */
if (rgbaer)
rgbaer(pointer, jump,
@@ -443,19 +435,21 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
masker(pointer, jump,
((uint8_t *) mxim->data) + (y * (mxim->bytes_per_line)),
mxim->bytes_per_line, dw, hh, dx, dy + y, mat);
- h -= LINESIZE;
}
+
/* free up our buffers and poit tables */
free(buf);
if (scaleinfo)
__imlib_FreeScaleInfo(scaleinfo);
free(back);
+
/* if we changed diplays or depth since last time... free old gc */
if ((gc) && ((last_depth != x11->depth) || (disp != x11->dpy)))
{
XFreeGC(disp, gc);
gc = 0;
}
+
/* if we didn't have a gc... create it */
if (!gc)
{
@@ -464,6 +458,7 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
gcv.graphics_exposures = False;
gc = XCreateGC(x11->dpy, w, GCGraphicsExposures, &gcv);
}
+
if (m)
{
/* if we changed diplays since last time... free old gc */
@@ -485,6 +480,7 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
else
XPutImage(x11->dpy, m, gcm, mxim, 0, 0, dx, dy, dw, dh);
}
+
/* write the image */
if (shm)
/* write shm XImage */
@@ -492,6 +488,7 @@ __imlib_RenderImage(const ImlibContextX11 * x11, ImlibImage * im,
/* write regular XImage */
else
XPutImage(x11->dpy, w, gc, xim, 0, 0, dx, dy, dw, dh);
+
/* free the XImage and put onto our free list */
/* wait for the write to be done */
if (shm)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.