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 5383c88d706aea687a28eae9bf6fa4e75b1a95ba
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 12:29:09 2026 -0600

    evas: size a mapped mask from its map's bounding box
    
    A mask is rendered into a surface sized and placed from the mask's
    unmapped geometry, and that same rectangle tells its clippees where
    the mask lies. A mapped clipper however clips its clippees to the
    bounding box of its map (evas_object_clip_recalc_do()), which is
    larger once the map rotates or scales it. The clippees then drew
    outside the mask surface.
    
    With the software engine the mapped mask was cut to its unmapped
    rectangle and the sample scaler read and wrote past the surface,
    crashing when the window was larger than the mask (expedite "Image
    Mask 9" at 1080p). The GL engine took the image_scaled_update fast
    path, which uploads the mask image without its map: the clippees were
    masked by the unrotated image stretched over the mapped bounding box,
    and blanked where it did not reach.
    
    The mask area is now the map's bounding box when the mask is mapped,
    still cut by the static clippers above it, for the surface and for
    every user of the mask position. The scaled image fast path is
    skipped for a mapped mask, as it can not apply the map. Software and
    buffer engines now render the expedite test identically, and GL only
    differs on the antialiased edges.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/evas/canvas/evas_render.c | 63 +++++++++++++++++++++++++++++----------
 1 file changed, 47 insertions(+), 16 deletions(-)

diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index d0cf451375..9ca654d75b 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -294,6 +294,40 @@ _evas_render_smallest_static_clipped_geometry_get(const Evas_Object_Protected_St
    return (Eina_Rectangle){cx, cy, cw, ch};
 }
 
+static inline Eina_Bool
+_evas_render_mask_mapped(const Evas_Object_Protected_Data *mask)
+{
+   return (mask->map && mask->map->cur.map && mask->map->cur.usemap);
+}
+
+/* Area covered by a mask surface, in canvas coordinates.
+ *
+ * A mapped mask does not cover its unmapped geometry but the bounding box of
+ * its map, which is also what its clippees are clipped to (see
+ * evas_object_clip_recalc_do()). Sizing the surface from the unmapped geometry
+ * cuts the mapped mask off and leaves the clippees drawing outside of the
+ * surface. */
+static inline Eina_Rectangle
+_evas_render_mask_geometry_get(const Evas_Object_Protected_Data *mask)
+{
+   Eina_Rectangle clip, mapped;
+
+   clip = _evas_render_smallest_static_clipped_geometry_get(mask->cur);
+   if (!_evas_render_mask_mapped(mask)) return clip;
+
+   mapped = mask->map->cur.map->normal_geometry;
+   if (mask->cur->clipper && mask->cur->has_fixed_size)
+     {
+        /* the static clippers above the mask still apply, the mask's own
+         * unmapped geometry does not */
+        Eina_Rectangle above =
+          _evas_render_smallest_static_clipped_geometry_get(mask->cur->clipper->cur);
+        RECTS_CLIP_TO_RECT(mapped.x, mapped.y, mapped.w, mapped.h,
+                           above.x, above.y, above.w, above.h);
+     }
+   return mapped;
+}
+
 static Eina_Bool
 _evas_render_had_map(Evas_Object_Protected_Data *obj)
 {
@@ -1768,7 +1802,7 @@ _evas_render_mapped_mask(Evas_Public_Data *evas, Evas_Object_Protected_Data *obj
 
    if (mask->mask->surface)
      {
-        Eina_Rectangle clip = _evas_render_smallest_static_clipped_geometry_get(mask->cur);
+        Eina_Rectangle clip = _evas_render_mask_geometry_get(mask);
         ENFN->context_clip_image_set(ENC, ctx, mask->mask->surface,
                                      clip.x + off_x,
                                      clip.y + off_y,
@@ -2444,18 +2478,13 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
 
    is_image = efl_isa(mask->object, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
 
-   x = mask->cur->geometry.x;
-   y = mask->cur->geometry.y;
-   w = mask->cur->geometry.w;
-   h = mask->cur->geometry.h;
-   if (mask->cur->clipper && mask->cur->has_fixed_size)
-     {
-        Eina_Rectangle clip = _evas_render_smallest_static_clipped_geometry_get(mask->cur);
-        x = clip.x;
-        y = clip.y;
-        w = clip.w;
-        h = clip.h;
-     }
+   {
+      Eina_Rectangle clip = _evas_render_mask_geometry_get(mask);
+      x = clip.x;
+      y = clip.y;
+      w = clip.w;
+      h = clip.h;
+   }
 
    r = mask->cur->color.r;
    g = mask->cur->color.g;
@@ -2528,7 +2557,9 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
           if (bl || br || bt || bb)
             border = EINA_TRUE;
 
-          if (!border && filled && !prev_mask && mask->func->engine_data_get)
+          /* The scaled image fast path can not apply a map. */
+          if (!border && filled && !prev_mask && !_evas_render_mask_mapped(mask) &&
+              mask->func->engine_data_get)
             {
                eina_evlog("+mask_scaled_update", mask->object, 0.0, NULL);
                /* Fast path (for GL) that avoids creating a map surface, render the
@@ -2586,7 +2617,7 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
           ctx = ENFN->context_new(ENC);
           if (prev_mask)
             {
-               Eina_Rectangle pclip = _evas_render_smallest_static_clipped_geometry_get(prev_mask->cur);
+               Eina_Rectangle pclip = _evas_render_mask_geometry_get(prev_mask);
                ENFN->context_clip_image_set(ENC, ctx,
                                             prev_mask->mask->surface,
                                             pclip.x - x,
@@ -3098,7 +3129,7 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas,
 
                        if (mask->mask->surface)
                          {
-                            Eina_Rectangle clip = _evas_render_smallest_static_clipped_geometry_get(mask->cur);
+                            Eina_Rectangle clip = _evas_render_mask_geometry_get(mask);
                             ENFN->context_clip_image_set(ENC, context,
                                                          mask->mask->surface,
                                                          clip.x + off_x,

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

Reply via email to