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 3818c4e2780958d637c462585256cab94c37217d
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 11:37:53 2026 -0600

    evas: keep an image's orientation when its data is set
    
    evas_object_image_data_set() with a new pixel buffer makes the engine
    build a new image, and that image is not turned: both the software and
    the GL engine create it with no orientation. The object kept its
    orientation all the same, so orient_get() reported a turn that was not
    drawn, and setting the same orientation again did nothing, as
    _evas_image_orientation_set() compared against that stale value.
    
    A compositor hits this on every frame: it hands the image each new
    buffer a client draws, and a client that set a buffer transform saw
    only its first frame turned. Enlightenment's wl_surface
    set_buffer_transform support needs this fixed.
    
    data_set() now applies the object's orientation to the image it set,
    and the orientation is applied again whenever the engine image does
    not carry it. The pixels given to data_set() are therefore the
    unturned image, as they already are for the first frame. Handing back
    the buffer data_get() returned keeps the same engine image, so it is
    not turned twice.
    
    evas_object_image_orient_data_set gives a fresh buffer to an image
    under each orientation for two frames, through size_set() then
    data_set() as a compositor does, and checks the rendered corner and
    orient_get(). It fails without either half of the change. Tested on
    the software engine through the buffer engine; the GL engine builds
    its image the same way and goes through the same call.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/evas/canvas/evas_image_legacy.c |  2 +
 src/lib/evas/canvas/evas_object_image.c |  5 +-
 src/tests/evas/evas_test_image.c        | 96 +++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_image_legacy.c b/src/lib/evas/canvas/evas_image_legacy.c
index b45f308f0b..121f4abe1c 100644
--- a/src/lib/evas/canvas/evas_image_legacy.c
+++ b/src/lib/evas/canvas/evas_image_legacy.c
@@ -665,6 +665,8 @@ evas_object_image_data_set(Eo *eo_obj, void *data)
                     state_write->image.stride = stride;
                   EINA_COW_IMAGE_STATE_WRITE_END(o, state_write);
                }
+
+             _evas_image_orientation_set(eo_obj, o, o->cur->orient);
          }
        o->written = EINA_TRUE;
      }
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index c05cbc5d72..aa81b029a0 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -381,7 +381,10 @@ _evas_image_orientation_set(Eo *eo_obj, Evas_Image_Data *o, Evas_Image_Orient or
    Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
    int iw, ih;
 
-   if (o->cur->orient == orient) return;
+   if ((o->cur->orient == orient) &&
+       ((!o->engine_data) ||
+        (ENFN->image_orient_get(ENC, o->engine_data) == orient)))
+     return;
 
    if ((o->preload & EVAS_IMAGE_PRELOADING) && (o->engine_data))
      {
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index ec93043c85..b77587bd29 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -348,6 +348,101 @@ EFL_START_TEST(evas_object_image_orient)
 }
 EFL_END_TEST
 
+#define ORIENT_TL 0xffff0000
+#define ORIENT_TR 0xff00ff00
+#define ORIENT_BL 0xff0000ff
+#define ORIENT_BR 0xffffff00
+
+static unsigned int *
+_orient_quadrants_new(int w, int h)
+{
+   unsigned int *data = "" * h * 4);
+   int x, y;
+
+   fail_if(!data);
+   for (y = 0; y < h; y++)
+     for (x = 0; x < w; x++)
+       {
+          if (y < (h / 2))
+            data[(y * w) + x] = (x < (w / 2)) ? ORIENT_TL : ORIENT_TR;
+          else
+            data[(y * w) + x] = (x < (w / 2)) ? ORIENT_BL : ORIENT_BR;
+       }
+   return data;
+}
+
+/* Hands the image a new buffer of w x h, as a compositor does for every
+ * frame a client draws, and returns the rendered top-left corner. */
+static unsigned int
+_orient_frame_render(Ecore_Evas *ee, Evas_Object *o, int w, int h)
+{
+   unsigned int *data = "" h);
+   const unsigned int *pix;
+   unsigned int tl;
+
+   evas_object_image_size_set(o, w, h);
+   evas_object_image_data_set(o, data);
+   evas_object_image_data_update_add(o, 0, 0, w, h);
+   ecore_evas_manual_render(ee);
+   pix = ecore_evas_buffer_pixels_get(ee);
+   fail_if(!pix);
+   tl = pix[0];
+   evas_object_image_data_set(o, NULL);
+   free(data);
+   return tl;
+}
+
+EFL_START_TEST(evas_object_image_orient_data_set)
+{
+   static const struct {
+      Evas_Image_Orient orient;
+      unsigned int tl;
+   } tc[] = {
+      { EVAS_IMAGE_ORIENT_90, ORIENT_BL },
+      { EVAS_IMAGE_ORIENT_180, ORIENT_BR },
+      { EVAS_IMAGE_ORIENT_270, ORIENT_TR },
+      { EVAS_IMAGE_FLIP_HORIZONTAL, ORIENT_TR },
+      { EVAS_IMAGE_FLIP_VERTICAL, ORIENT_BL },
+      { EVAS_IMAGE_FLIP_TRANSPOSE, ORIENT_TL },
+      { EVAS_IMAGE_FLIP_TRANSVERSE, ORIENT_BR },
+   };
+   unsigned int i, tl;
+   int frame;
+
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(tc); i++)
+     {
+        Ecore_Evas *ee = ecore_evas_buffer_new(8, 8);
+        Evas_Object *o;
+
+        fail_if(!ee);
+        ecore_evas_show(ee);
+        ecore_evas_manual_render_set(ee, EINA_TRUE);
+        o = evas_object_image_add(ecore_evas_get(ee));
+        evas_object_image_alpha_set(o, EINA_FALSE);
+        evas_object_image_filled_set(o, EINA_TRUE);
+        evas_object_resize(o, 8, 8);
+        evas_object_show(o);
+
+        for (frame = 0; frame < 2; frame++)
+          {
+             if (frame == 0)
+               {
+                  evas_object_image_size_set(o, 8, 4);
+                  evas_object_image_orient_set(o, tc[i].orient);
+               }
+             tl = _orient_frame_render(ee, o, 8, 4);
+             ck_assert_msg(tl == tc[i].tl,
+                           "orient %d, frame %d: top-left was %#x, wanted %#x",
+                           tc[i].orient, frame, tl, tc[i].tl);
+             ck_assert_int_eq(evas_object_image_orient_get(o), tc[i].orient);
+          }
+
+        evas_object_del(o);
+        ecore_evas_free(ee);
+     }
+}
+EFL_END_TEST
+
 #ifdef BUILD_LOADER_TGV
 EFL_START_TEST(evas_object_image_tgv_loader_data)
 {
@@ -1525,6 +1620,7 @@ void evas_test_image_object(TCase *tc)
    tcase_add_test(tc, evas_object_image_loader);
    tcase_add_test(tc, evas_object_image_loader_orientation);
    tcase_add_test(tc, evas_object_image_orient);
+   tcase_add_test(tc, evas_object_image_orient_data_set);
 #if BUILD_LOADER_PNG
 # if BUILD_LOADER_TGV
    tcase_add_test(tc, evas_object_image_tgv_loader_data);

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

Reply via email to