This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/285/head
in repository efl.
View the commit online.
commit 2c9fa929594dc32d89d160f17de7f6c862f880a5
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 14:09:41 2026 -0600
evas/filters: shrink with grow, and allow in place operations
grow blurred into its destination, then drew the thresholded result
over that blur: it remained around the shape, so a negative radius
shrunk nothing. The threshold now replaces the blur, unless the
destination had content of its own.
GL can not draw into the buffer it reads: a one direction blur,
grayscale or inverse color in place left it empty. They go through a
temporary buffer.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/evas/filters/evas_filter.c | 121 +++++++++++++++++++++++++------------
1 file changed, 83 insertions(+), 38 deletions(-)
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index e721de7ebb..de34e09b25 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -748,6 +748,30 @@ evas_filter_command_fill_add(Evas_Filter_Context *ctx, void *draw_context,
return cmd;
}
+/* An operation which can not run in place goes through a temporary buffer:
+ * its result then replaces the buffer, whatever the drawing context says. */
+static Evas_Filter_Command *
+_command_copy_back(Evas_Filter_Context *ctx, void *draw_context,
+ const Evas_Filter_Buffer *from, const Evas_Filter_Buffer *to)
+{
+ Evas_Filter_Command *cmd;
+ int R, G, B, A, render_op;
+
+ ENFN->context_color_get(ENC, draw_context, &R, &G, &B, &A);
+ render_op = ENFN->context_render_op_get(ENC, draw_context);
+ ENFN->context_color_set(ENC, draw_context, 255, 255, 255, 255);
+ ENFN->context_render_op_set(ENC, draw_context, EVAS_RENDER_COPY);
+
+ cmd = evas_filter_command_blend_add(ctx, draw_context, from->id, to->id,
+ 0, 0, EVAS_FILTER_FILL_MODE_NONE,
+ to->alpha_only);
+
+ ENFN->context_color_set(ENC, draw_context, R, G, B, A);
+ ENFN->context_render_op_set(ENC, draw_context, render_op);
+
+ return cmd;
+}
+
static Evas_Filter_Command *
evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
Evas_Filter_Buffer *in, Evas_Filter_Buffer *out,
@@ -835,7 +859,14 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
}
else
{
- dx_out = out;
+ /* a pass can not draw into the buffer it reads */
+ if ((in == out) && (dy_out == out))
+ {
+ dy_out = evas_filter_temporary_buffer_get(ctx, in->w, in->h,
+ in->alpha_only, 1);
+ if (!dy_out) goto fail;
+ }
+ dx_out = dy_out;
dy_in = in;
}
@@ -1345,10 +1376,16 @@ evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
curve, EVAS_FILTER_CHANNEL_ALPHA);
EINA_SAFETY_ON_NULL_GOTO(threshcmd, fail);
- blendcmd = evas_filter_command_blend_add(ctx, draw_context, tmp->id,
- outbuf, 0, 0,
- EVAS_FILTER_FILL_MODE_NONE,
- alphaonly);
+ /* Blurred into the destination itself, the threshold replaces the blur: it
+ * would otherwise remain around a shrunk shape. Else it is drawn over what
+ * the destination holds. */
+ if (growbuf == outbuf)
+ blendcmd = _command_copy_back(ctx, draw_context, tmp, out);
+ else
+ blendcmd = evas_filter_command_blend_add(ctx, draw_context, tmp->id,
+ outbuf, 0, 0,
+ EVAS_FILTER_FILL_MODE_NONE,
+ alphaonly);
EINA_SAFETY_ON_NULL_GOTO(blendcmd, fail);
return blurcmd;
@@ -1360,30 +1397,6 @@ fail:
return NULL;
}
-/* An operation which can not run in place goes through a temporary buffer:
- * its result then replaces the buffer, whatever the drawing context says. */
-static Evas_Filter_Command *
-_command_copy_back(Evas_Filter_Context *ctx, void *draw_context,
- const Evas_Filter_Buffer *from, const Evas_Filter_Buffer *to)
-{
- Evas_Filter_Command *cmd;
- int R, G, B, A, render_op;
-
- ENFN->context_color_get(ENC, draw_context, &R, &G, &B, &A);
- render_op = ENFN->context_render_op_get(ENC, draw_context);
- ENFN->context_color_set(ENC, draw_context, 255, 255, 255, 255);
- ENFN->context_render_op_set(ENC, draw_context, EVAS_RENDER_COPY);
-
- cmd = evas_filter_command_blend_add(ctx, draw_context, from->id, to->id,
- 0, 0, EVAS_FILTER_FILL_MODE_NONE,
- to->alpha_only);
-
- ENFN->context_color_set(ENC, draw_context, R, G, B, A);
- ENFN->context_render_op_set(ENC, draw_context, render_op);
-
- return cmd;
-}
-
Evas_Filter_Command *
evas_filter_command_curve_add(Evas_Filter_Context *ctx,
void *draw_context EINA_UNUSED,
@@ -1628,11 +1641,11 @@ evas_filter_command_transform_add(Evas_Filter_Context *ctx,
Evas_Filter_Command *
evas_filter_command_grayscale_add(Evas_Filter_Context *ctx,
- void *draw_context EINA_UNUSED,
+ void *draw_context,
int inbuf, int outbuf)
{
Evas_Filter_Command *cmd;
- Evas_Filter_Buffer *in, *out;
+ Evas_Filter_Buffer *in, *out, *to;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
@@ -1642,19 +1655,35 @@ evas_filter_command_grayscale_add(Evas_Filter_Context *ctx,
out = _filter_buffer_get(ctx, outbuf);
EINA_SAFETY_ON_NULL_RETURN_VAL(out, NULL);
- cmd = _command_new(ctx, EVAS_FILTER_MODE_GRAYSCALE, in, NULL, out);
- EINA_SAFETY_ON_NULL_RETURN_VAL(out, NULL);
+ /* GL can not draw into the buffer it reads */
+ to = out;
+ if (in == out)
+ {
+ to = evas_filter_temporary_buffer_get(ctx, in->w, in->h,
+ in->alpha_only, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(to, NULL);
+ }
+
+ cmd = _command_new(ctx, EVAS_FILTER_MODE_GRAYSCALE, in, NULL, to);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL);
+
+ if ((to != out) && !_command_copy_back(ctx, draw_context, to, out))
+ {
+ _command_del(ctx, cmd);
+ cmd = NULL;
+ }
+ _filter_buffer_unlock_all(ctx);
return cmd;
}
Evas_Filter_Command *
evas_filter_command_inverse_color_add(Evas_Filter_Context *ctx,
- void *draw_context EINA_UNUSED,
- int inbuf, int outbuf)
+ void *draw_context,
+ int inbuf, int outbuf)
{
Evas_Filter_Command *cmd;
- Evas_Filter_Buffer *in, *out;
+ Evas_Filter_Buffer *in, *out, *to;
EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
@@ -1664,8 +1693,24 @@ evas_filter_command_inverse_color_add(Evas_Filter_Context *ctx,
out = _filter_buffer_get(ctx, outbuf);
EINA_SAFETY_ON_NULL_RETURN_VAL(out, NULL);
- cmd = _command_new(ctx, EVAS_FILTER_MODE_INVERSE_COLOR, in, NULL, out);
- EINA_SAFETY_ON_NULL_RETURN_VAL(out, NULL);
+ /* GL can not draw into the buffer it reads */
+ to = out;
+ if (in == out)
+ {
+ to = evas_filter_temporary_buffer_get(ctx, in->w, in->h,
+ in->alpha_only, 1);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(to, NULL);
+ }
+
+ cmd = _command_new(ctx, EVAS_FILTER_MODE_INVERSE_COLOR, in, NULL, to);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL);
+
+ if ((to != out) && !_command_copy_back(ctx, draw_context, to, out))
+ {
+ _command_del(ctx, cmd);
+ cmd = NULL;
+ }
+ _filter_buffer_unlock_all(ctx);
return cmd;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.