This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch devs/cedric/gl-slice-add
in repository efl.

View the commit online.

commit 66fe0c418a779a93271a5bbe9777958ec9367451
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Nov 27 23:22:12 2026 -0600

    evas/gl: copy every row of a copied buffer
    
    efl_gfx_buffer_copy_set() on a GL canvas delivered a blank image. The
    copy loop in the GL engine's image_data_slice_add() indexed neither
    side by the row it was copying: every iteration read the row just past
    the end of the source, out of bounds, and wrote it over the second row
    of the destination. The rest of the image kept what the allocation
    held.
    
    The software engine had the same loop and was fixed in 6406624f64;
    this is the same fix for the GL copy of that function.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01DGDCUNaoKLQZTP2mPdMiUR
---
 src/modules/evas/engines/gl_generic/evas_engine.c |  6 ++--
 src/tests/evas/evas_test_image.c                  | 34 +++++++++++++++++++++++
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 4693ca49e4..ce25effd0a 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -3854,9 +3854,9 @@ eng_image_data_slice_add(void *engine, void *image,
              if (!im->im->image.data) goto fail;
              for (int y = 0; y < h; y++)
                {
-                  const unsigned char *src = "" + h * stride;
-                  unsigned char *dst = im->im->image.data8 + bpp * w;
-                  memcpy(dst, src, w * bpp);
+                  const unsigned char *src = "" + ((size_t) y * stride);
+                  unsigned char *dst = im->im->image.data8 + ((size_t) y * bpp * w);
+                  memcpy(dst, src, (size_t) w * bpp);
                }
           }
         else
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 6cbee4cebc..ec93043c85 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -1240,6 +1240,39 @@ EFL_START_TEST(evas_object_image_buffer_managed_gl)
 }
 EFL_END_TEST
 
+/* As evas_object_image_buffer_copy, on a GL canvas: a strided source, freed
+ * before the pixels are read back. */
+EFL_START_TEST(evas_object_image_buffer_copy_gl)
+{
+   const int w = 8, h = 4;
+   const int stride = (w + 3) * 4;
+   unsigned char *src;
+   Eina_Slice slice;
+   Ecore_Evas *ee;
+   Eo *o;
+
+   ee = _gl_ecore_evas_new();
+   if (ee)
+     {
+        src = "" stride * h);
+        fail_if(!src);
+        _buffer_pattern_fill(src, w, h, stride);
+
+        o = efl_add(EFL_CANVAS_IMAGE_CLASS, ecore_evas_get(ee));
+        slice = (Eina_Slice) { .len = (size_t) stride * h, .mem = src };
+        fail_if(!efl_gfx_buffer_copy_set(o, &slice, EINA_SIZE2D(w, h), stride,
+                                         EFL_GFX_COLORSPACE_ARGB8888, 0));
+
+        memset(src, 0xa5, (size_t) stride * h);
+        free(src);
+        _buffer_pattern_check(o, w, h);
+
+        efl_del(o);
+        ecore_evas_free(ee);
+     }
+}
+EFL_END_TEST
+
 #if BUILD_LOADER_JP2K
 EFL_START_TEST(evas_object_image_jp2k_loader_data)
 {
@@ -1513,6 +1546,7 @@ void evas_test_image_object(TCase *tc)
    if (getenv("DISPLAY"))
      {
         tcase_add_test(tc, evas_object_image_buffer_managed_gl);
+        tcase_add_test(tc, evas_object_image_buffer_copy_gl);
      }
    tcase_add_test(tc, evas_object_image_partially_load_orientation);
    tcase_add_test(tc, evas_object_image_cached_data_comparision);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to