This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit d527d3d63df77079c7ce2eb05e018780e69b60eb
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 15:03:53 2026 -0600
evas/filters: keep the mirror line of an offset vflip
The source and destination rows of the flip were each clamped to the
buffer on their own: when one range was cut and not the other, the
mirror line moved, as with an offset and a padding_set too small for
it. Rows whose mirror is outside are now left out.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../filters/evas_filter_transform.c | 57 ++++++----------------
1 file changed, 14 insertions(+), 43 deletions(-)
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_transform.c b/src/modules/evas/engines/software_generic/filters/evas_filter_transform.c
index 33128485bb..3d134c9b4d 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_filter_transform.c
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_transform.c
@@ -11,9 +11,8 @@ _vflip_cpu(Evas_Filter_Command *cmd)
{
unsigned int src_len, src_stride, dst_len, dst_stride;
uint8_t *in, *out = NULL;
- int w, h, sy, dy, oy, center, t, b, objh;
+ int w, h, sy, oy, center, t, b, objh, reach, sum, first, last;
Efl_Gfx_Colorspace cspace = cmd->output->alpha_only ? E_ALPHA : E_ARGB;
- int s0, s1, d0, d1;
Eina_Bool ret = 0;
if (!cmd->draw.A && (cmd->draw.rop == EFL_GFX_RENDER_OP_BLEND))
@@ -39,33 +38,19 @@ _vflip_cpu(Evas_Filter_Command *cmd)
objh = h - t - b;
center = t + objh / 2 + oy;
- if (oy >= 0)
- {
- s1 = d0 = center + (objh / 2) + oy;
- s0 = d1 = center - (objh / 2) - oy;
- }
- else
- {
- s1 = d0 = center + (objh / 2) - oy;
- s0 = d1 = center - (objh / 2) + oy;
- }
-
- /* avoid crashes */
- d0 = CLAMP(0, d0, h - 1);
- d1 = CLAMP(0, d1, h - 1);
- s0 = CLAMP(0, s0, h - 1);
- s1 = CLAMP(0, s1, h - 1);
+ /* Rows mirror each other around the line before row "center". Those of
+ * the object, moved by the offset, are flipped: a row whose mirror is
+ * outside of the buffer is left out, the others keep their place. */
+ reach = objh / 2 + abs(oy);
+ sum = (2 * center) - 1;
+ first = MAX(0, MAX(center - reach, sum - (h - 1)));
+ last = MIN(h - 1, MIN(center + reach - 1, sum));
if (cmd->input->buffer == cmd->output->buffer)
{
/* flip a single buffer --> override its own contents */
- for (sy = s0, dy = d0; (dy >= d1) && (sy <= s1); sy++, dy--)
- {
- uint8_t* src = "" + src_stride * sy;
- uint8_t* dst = out + dst_stride * dy;
-
- memcpy(dst, src, src_stride);
- }
+ for (sy = first; sy <= last; sy++)
+ memcpy(out + dst_stride * (sum - sy), in + src_stride * sy, src_stride);
}
else if (cspace == E_ALPHA)
{
@@ -73,13 +58,8 @@ _vflip_cpu(Evas_Filter_Command *cmd)
Draw_Func_Alpha func = efl_draw_alpha_func_get(cmd->draw.rop, EINA_FALSE);
EINA_SAFETY_ON_NULL_GOTO(func, end);
- for (sy = s0, dy = d0; (dy >= d1) && (sy <= s1); sy++, dy--)
- {
- uint8_t* src = "" + src_stride * sy;
- uint8_t* dst = out + dst_stride * dy;
-
- func(dst, src, w);
- }
+ for (sy = first; sy <= last; sy++)
+ func(out + dst_stride * (sum - sy), in + src_stride * sy, w);
}
else
{
@@ -90,24 +70,15 @@ _vflip_cpu(Evas_Filter_Command *cmd)
func = efl_draw_func_span_get(cmd->draw.rop, color, EINA_TRUE);
EINA_SAFETY_ON_NULL_GOTO(func, end);
- for (sy = s0, dy = d0; (dy >= d1) && (sy <= s1); sy++, dy--)
+ for (sy = first; sy <= last; sy++)
{
uint32_t* src = "" *) (in + src_stride * sy);
- uint32_t* dst = (uint32_t *) (out + dst_stride * dy);
+ uint32_t* dst = (uint32_t *) (out + dst_stride * (sum - sy));
func(dst, src, w, color, 255);
}
}
- /* fill out outer areas */
- if (cmd->draw.rop == EFL_GFX_RENDER_OP_COPY)
- {
- if (d1 > 0)
- memset(out, 0, dst_stride * d1);
- if (d0 < (h - 1))
- memset(out + dst_stride * d0, 0, dst_stride * (h - d0 - 1));
- }
-
ret = EINA_TRUE;
end:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.