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 d64ac1906ef8d0e8b8dc7de1dd9f54f3011990eb
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 21:56:54 2026 -0600

    evas/map: correct the perspective of anti-aliased mapped textures
    
    Smooth maps of anti-aliased objects, which elm_transit uses for its
    effects, are drawn by their own rasterizer. It splits a face into a mesh
    of triangles around screen midpoints and spreads the texture evenly on
    each, so faces seen at an angle did not foreshorten.
    
    Those faces are now two triangles, split on the diagonal the GL engine
    uses, that divide by depth for every pixel. Flat faces keep the mesh and
    give the same pixels. Vertex colors are still interpolated without
    perspective.
    
    The steep face of the map tests is now steeper, and checked on every
    row: it no longer caught straight pieces left too long. Its corners also
    did not describe a rectangle in space.
    
    800x600 canvas, one smooth anti-aliased face, release build, Ryzen 7
    6800U, ms per frame, before -> after:
    
      flat face     5.35 -> 5.24
      angled face   3.60 -> 3.91
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/evas/common/evas_map_image_internal_high.c | 203 +++++++++++++++------
 src/tests/evas/evas_test_map.c                     |  39 +++-
 2 files changed, 173 insertions(+), 69 deletions(-)

diff --git a/src/lib/evas/common/evas_map_image_internal_high.c b/src/lib/evas/common/evas_map_image_internal_high.c
index ecd08026d2..9b36675f75 100644
--- a/src/lib/evas/common/evas_map_image_internal_high.c
+++ b/src/lib/evas/common/evas_map_image_internal_high.c
@@ -1,6 +1,9 @@
 typedef struct
 {
    float x, y, u, v;
+   /* 1 over depth on a face seen at an angle, where u and v are over depth
+    * too; unused elsewhere. */
+   float q;
    DATA32 c;
 } Map_Vertex;
 
@@ -26,6 +29,7 @@ typedef struct AASpans
 static float dudx, dvdx, dcdx[4];
 static float dxdya, dxdyb, dudya, dvdya, dcdya[4];
 static float xa, xb, ua, va, ca[4];
+static float dqdx, dqdya, qa;
 
 #define SWAP(a, b, tmp) \
    tmp = a; \
@@ -337,14 +341,16 @@ _map_aa_apply(AASpans *aa_spans, DATA32 *dst, int dw)
 #endif
 
 /************************** TEXTURE MAPPING CODE ******************************/
-static void
-_map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
+/* Inlined once with persp false and once with it true, so that flat faces
+ * do not pay for the division. */
+static EFL_ALWAYS_INLINE void
+_map_triangle_scanlines(RGBA_Image *src, RGBA_Image *dst,
                           int cx, int cy, int cw, int ch,
                           RGBA_Image *mask, int mx, int my,
                           int ystart, int yend,
                           DATA32 *tbuf, RGBA_Gfx_Func func, RGBA_Gfx_Func func2,
                           DATA32 mul_col, AASpans *aa_spans,
-                          Eina_Bool col_blend)
+                          Eina_Bool col_blend, const Eina_Bool persp)
 {
    float _dudx = dudx, _dvdx = dvdx;
    float _dxdya = dxdya, _dxdyb = dxdyb, _dudya = dudya, _dvdya = dvdya;
@@ -355,7 +361,8 @@ _map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
    int sh = src->cache_entry.h;
    int dw = dst->cache_entry.w;
    int x1, x2, x, y, uu, vv, ar, ab, iru, irv, px, ay;
-   float dx, u, v, iptr;
+   float dx, u, v, iptr, q = 1, su, sv;
+   float _dqdx = dqdx, _dqdya = dqdya, _qa = qa;
    float _dcdx[4], _dcdya[4], _ca[4];
    float c[4] = {0, 0, 0, 0};
    DATA32 *buf, *tmp;
@@ -398,6 +405,7 @@ _map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
         dx = 1 - (_xa - x1);
         u = _ua + dx * _dudx;
         v = _va + dx * _dvdx;
+        if (persp) q = _qa + dx * _dqdx;
 
         if (col_blend)
           {
@@ -416,8 +424,18 @@ _map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
         //Draw horizontal line
         while (x++ < x2)
           {
-             uu = (int) u;
-             vv = (int) v;
+             su = u;
+             sv = v;
+             if (persp)
+               {
+                  float z = (q > 1e-6f) ? (1 / q) : 1e6f;
+
+                  su = (u > 0) ? (u * z) : 0;
+                  sv = (v > 0) ? (v * z) : 0;
+                  q += _dqdx;
+               }
+             uu = (int) su;
+             vv = (int) sv;
              // FIXME: sometimes u and v are < 0 - don'tc crash
              if (uu < 0) uu = 0;
              if (vv < 0) vv = 0;
@@ -427,8 +445,8 @@ _map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
              if (uu >= sw) uu = sw - 1;
              if (vv >= sh) vv = sh - 1;
 
-             ar = (int)(255 * (1 - modff(u, &iptr)));
-             ab = (int)(255 * (1 - modff(v, &iptr)));
+             ar = (int)(255 * (1 - modff(su, &iptr)));
+             ab = (int)(255 * (1 - modff(sv, &iptr)));
              iru = uu + 1;
              irv = vv + 1;
              px = *(sbuf + (vv * sw) + uu);
@@ -496,6 +514,7 @@ next:
         _xb += _dxdyb;
         _ua += _dudya;
         _va += _dvdya;
+        if (persp) _qa += _dqdya;
 
         if (col_blend)
           {
@@ -511,6 +530,7 @@ next:
    xb = _xb;
    ua = _ua;
    va = _va;
+   qa = _qa;
 
    if (col_blend)
      {
@@ -521,6 +541,23 @@ next:
      }
 }
 
+static void
+_map_triangle_draw_linear(RGBA_Image *src, RGBA_Image *dst,
+                          int cx, int cy, int cw, int ch,
+                          RGBA_Image *mask, int mx, int my,
+                          int ystart, int yend,
+                          DATA32 *tbuf, RGBA_Gfx_Func func, RGBA_Gfx_Func func2,
+                          DATA32 mul_col, AASpans *aa_spans,
+                          Eina_Bool col_blend, Eina_Bool persp)
+{
+   if (persp)
+     _map_triangle_scanlines(src, dst, cx, cy, cw, ch, mask, mx, my, ystart, yend,
+                             tbuf, func, func2, mul_col, aa_spans, col_blend, EINA_TRUE);
+   else
+     _map_triangle_scanlines(src, dst, cx, cy, cw, ch, mask, mx, my, ystart, yend,
+                             tbuf, func, func2, mul_col, aa_spans, col_blend, EINA_FALSE);
+}
+
 /* This mapping algorithm is based on Mikael Kalms's. */
 static void
 _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
@@ -529,17 +566,18 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
                    DATA32 *tbuf, RGBA_Gfx_Func func, RGBA_Gfx_Func func2,
                    Map_Tripoly *poly, DATA32 mul_col,
                    AASpans *aa_spans, Eina_Bool smooth EINA_UNUSED,
-                   Eina_Bool col_blend)
+                   Eina_Bool col_blend, Eina_Bool persp)
 {
    float x[3] = { poly->v[0].x, poly->v[1].x, poly->v[2].x };
    float y[3] = { poly->v[0].y, poly->v[1].y, poly->v[2].y };
    float u[3] = { poly->v[0].u, poly->v[1].u, poly->v[2].u };
    float v[3] = { poly->v[0].v, poly->v[1].v, poly->v[2].v };
+   float q[3] = { poly->v[0].q, poly->v[1].q, poly->v[2].q };
    DATA32 c[3] = { poly->v[0].c, poly->v[1].c, poly->v[2].c };
    float off_y;
    float denom;
    float dxdy[3] = {0, 0, 0};
-   float dudy, dvdy, dcdy[4];
+   float dudy, dvdy, dqdy, dcdy[4];
    float tmp;
    int mc[3][4];     //3 vertex, 4 color channels.
    DATA32 tmpc;
@@ -553,6 +591,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
         SWAP(y[0], y[1], tmp);
         SWAP(u[0], u[1], tmp);
         SWAP(v[0], v[1], tmp);
+        SWAP(q[0], q[1], tmp);
         SWAP(c[0], c[1], tmpc);
      }
    if (y[0] > y[2])
@@ -561,6 +600,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
         SWAP(y[0], y[2], tmp);
         SWAP(u[0], u[2], tmp);
         SWAP(v[0], v[2], tmp);
+        SWAP(q[0], q[2], tmp);
         SWAP(c[0], c[2], tmpc);
 
      }
@@ -570,6 +610,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
         SWAP(y[1], y[2], tmp);
         SWAP(u[1], u[2], tmp);
         SWAP(v[1], v[2], tmp);
+        SWAP(q[1], q[2], tmp);
         SWAP(c[1], c[2], tmpc);
      }
 
@@ -594,6 +635,8 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
    dvdx = ((v[2] - v[0]) * (y[1] - y[0]) - (v[1] - v[0]) * (y[2] - y[0])) * denom;
    dudy = ((u[1] - u[0]) * (x[2] - x[0]) - (u[2] - u[0]) * (x[1] - x[0])) * denom;
    dvdy = ((v[1] - v[0]) * (x[2] - x[0]) - (v[2] - v[0]) * (x[1] - x[0])) * denom;
+   dqdx = ((q[2] - q[0]) * (y[1] - y[0]) - (q[1] - q[0]) * (y[2] - y[0])) * denom;
+   dqdy = ((q[1] - q[0]) * (x[2] - x[0]) - (q[2] - q[0]) * (x[1] - x[0])) * denom;
 
    if (col_blend)
      {
@@ -629,6 +672,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
         dxdya = dxdy[1];
         dudya = dxdya * dudx + dudy;
         dvdya = dxdya * dvdx + dvdy;
+        dqdya = dxdya * dqdx + dqdy;
 
         if (col_blend)
           for (int i = 0; i < 4; i++)
@@ -639,6 +683,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
         xa = x[0] + dy * dxdya;
         ua = u[0] + dy * dudya;
         va = v[0] + dy * dvdya;
+        qa = q[0] + dy * dqdya;
 
         if (col_blend)
           for (int i = 0; i < 4; i++)
@@ -651,6 +696,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
              xa += (off_y * dxdya);
              ua += (off_y * dudya);
              va += (off_y * dvdya);
+             qa += (off_y * dqdya);
 
              if (col_blend)
                for (int i = 0; i < 4; i++)
@@ -662,7 +708,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
              _map_triangle_draw_linear(src, dst, cx, cy, cw, ch, mask, mx, my,
                                        yi[0], yi[1], tbuf, func,
                                        func2, mul_col, aa_spans,
-                                       col_blend);
+                                       col_blend, persp);
              upper = EINA_TRUE;
           }
         //Draw lower segment if possibly visible
@@ -674,6 +720,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
                   xa += (off_y * dxdya);
                   ua += (off_y * dudya);
                   va += (off_y * dvdya);
+                  qa += (off_y * dqdya);
 
                   if (col_blend)
                     for (int i = 0; i < 4; i++)
@@ -685,7 +732,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
              xb = x[1] + (1 - (y[1] - yi[1])) * dxdyb + (off_y * dxdyb);
              _map_triangle_draw_linear(src, dst, cx, cy, cw, ch, mask, mx, my,
                                        yi[1], yi[2], tbuf, func, func2,
-                                       mul_col, aa_spans, col_blend);
+                                       mul_col, aa_spans, col_blend, persp);
           }
      }
    //Longer edge is on the right side
@@ -706,10 +753,12 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
              dxdya = dxdy[0];
              dudya = dxdya * dudx + dudy;
              dvdya = dxdya * dvdx + dvdy;
+             dqdya = dxdya * dqdx + dqdy;
 
              xa = x[0] + dy * dxdya + (off_y * dxdya);
              ua = u[0] + dy * dudya + (off_y * dudya);
              va = v[0] + dy * dvdya + (off_y * dvdya);
+             qa = q[0] + dy * dqdya + (off_y * dqdya);
 
              if (col_blend)
                for (int i = 0; i < 4; i++)
@@ -719,7 +768,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
                  }
              _map_triangle_draw_linear(src, dst, cx, cy, cw, ch, mask, mx, my,
                                        yi[0], yi[1], tbuf, func, func2,
-                                       mul_col, aa_spans, col_blend);
+                                       mul_col, aa_spans, col_blend, persp);
              upper = EINA_TRUE;
           }
         //Draw lower segment if possibly visible
@@ -733,10 +782,12 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
              dxdya = dxdy[2];
              dudya = dxdya * dudx + dudy;
              dvdya = dxdya * dvdx + dvdy;
+             dqdya = dxdya * dqdx + dqdy;
              dy = 1 - (y[1] - yi[1]);
              xa = x[1] + dy * dxdya + (off_y * dxdya);
              ua = u[1] + dy * dudya + (off_y * dudya);
              va = v[1] + dy * dvdya + (off_y * dvdya);
+             qa = q[1] + dy * dqdya + (off_y * dqdya);
 
              if (col_blend)
                for (int i = 0; i < 4; i++)
@@ -746,7 +797,7 @@ _map_triangle_draw(RGBA_Image *src, RGBA_Image *dst,
                  }
              _map_triangle_draw_linear(src, dst, cx, cy, cw, ch, mask, mx, my,
                                        yi[1], yi[2], tbuf, func, func2,
-                                       mul_col, aa_spans, col_blend);
+                                       mul_col, aa_spans, col_blend, persp);
           }
      }
 }
@@ -769,10 +820,14 @@ _evas_common_map_rgba_internal_high(RGBA_Image *src, RGBA_Image *dst,
    Eina_Bool ssrc_alpha = src->cache_entry.flags.alpha_sparse;
    Eina_Bool dst_alpha = dst->cache_entry.flags.alpha;
    Eina_Bool col_blend = EINA_FALSE;   //Necessary blending vertex color?
+   Eina_Bool persp;
+   float q[4] = { 1, 1, 1, 1 };
 
    //FIXME: we cannot apply anti_aliasing per polygons.
    anti_alias = EINA_FALSE;
 
+   persp = _map_persp_get(p, q);
+
    /* Prepare points data.
       Convert to float,
       shift XY coordinates to match the sub-pixeling technique.
@@ -787,13 +842,18 @@ _evas_common_map_rgba_internal_high(RGBA_Image *src, RGBA_Image *dst,
 
         /* Exceptions:
            Limit u,v coords of points to be within the source image */
+        /* At an angle every pixel is limited after dividing by depth, and
+         * moving a corner here would stretch the whole face. */
         if (u[i] < 0) u[i] = 0;
         else if (u[i] >= (float) src->cache_entry.w)
-          u[i] = (float) (src->cache_entry.w - 1);
+          u[i] = (float) (persp ? src->cache_entry.w : src->cache_entry.w - 1);
 
         if (v[i] < 0) v[i] = 0;
         else if (v[i] >= (float) src->cache_entry.h)
-          v[i] = (float) (src->cache_entry.h - 1);
+          v[i] = (float) (persp ? src->cache_entry.h : src->cache_entry.h - 1);
+
+        u[i] *= q[i];
+        v[i] *= q[i];
 
         if ((c[i] >> 24) < 0xff) have_alpha = EINA_TRUE;
         if (c[i] < 0xffffffff) col_blend = EINA_TRUE;
@@ -858,53 +918,78 @@ _evas_common_map_rgba_internal_high(RGBA_Image *src, RGBA_Image *dst,
        3 -- 5 -- 2
    */
 
-   //Interpolated color info
-   DATA32 tmpc[5] = {
-      INTERP_256(128, c[0], c[1]),
-      INTERP_256(128, c[3], c[2]),
-      INTERP_256(128, c[0], c[3]),
-      INTERP_256(128, c[1], c[2]),
-      INTERP_256(128, tmpc[2], tmpc[3])};
-
-   //9 vertices (see above figure)
-   Map_Vertex vert[9] = {
-      {x[0], y[0], u[0], v[0], c[0]},
-      {x[1], y[1], u[1], v[1], c[1]},
-      {x[2], y[2], u[2], v[2], c[2]},
-      {x[3], y[3], u[3], v[3], c[3]},
-      {x[0] + (x[1] - x[0]) * 0.5, y[0] + (y[1] - y[0]) * 0.5, u[0] + (u[1] - u[0]) * 0.5, v[0] + (v[1] - v[0]) * 0.5, tmpc[0]},
-      {x[3] + (x[2] - x[3]) * 0.5, y[3] + (y[2] - y[3]) * 0.5, u[3] + (u[2] - u[3]) * 0.5, v[3] + (v[2] - v[3]) * 0.5, tmpc[1]},
-      {x[0] + (x[3] - x[0]) * 0.5, y[0] + (y[3] - y[0]) * 0.5, u[0] + (u[3] - u[0]) * 0.5, v[0] + (v[3] - v[0]) * 0.5, tmpc[2]},
-      {x[1] + (x[2] - x[1]) * 0.5, y[1] + (y[2] - y[1]) * 0.5, u[1] + (u[2] - u[1]) * 0.5, v[1] + (v[2] - v[1]) * 0.5, tmpc[3]},
-      {vert[6].x + (vert[7].x - vert[6].x) * 0.5, vert[4].y + (vert[5].y - vert[4].y) * 0.5, vert[6].u + (vert[7].u - vert[6].u) * 0.5, vert[4].v + (vert[5].v - vert[4].v) * 0.5, tmpc[4]}};
-
-   //Vertex Indices
-   int idx[4][4] = {{ 0, 4, 8, 6 }, {4, 1, 7, 8}, {6, 8, 5, 3}, {8, 7, 2, 5}};
-
-   Map_Tripoly poly;
-
-   //Draw a pair of triangles
-   for (int i = 0; i < 4; ++i)
+   if (persp)
      {
-        poly.v[0] = vert[idx[i][0]];
-        poly.v[1] = vert[idx[i][1]];
-        poly.v[2] = vert[idx[i][3]];
+        /* the two triangles the GL engine draws */
+        const int corners[2][3] = { { 0, 1, 2 }, { 0, 2, 3 } };
+        Map_Tripoly face;
 
-        _map_triangle_draw(src, dst, cx, cy, cw, ch,
-                           mask, mask_x, mask_y,
-                           tbuf, func, func2,
-                           &poly, mul_col, aa_spans,
-                           smooth, col_blend);
+        for (int i = 0; i < 2; ++i)
+          {
+             for (int j = 0; j < 3; ++j)
+               {
+                  int at = corners[i][j];
+                  Map_Vertex vertex = { x[at], y[at], u[at], v[at], q[at], c[at] };
 
-        poly.v[0] = vert[idx[i][1]];
-        poly.v[1] = vert[idx[i][3]];
-        poly.v[2] = vert[idx[i][2]];
+                  face.v[j] = vertex;
+               }
+             _map_triangle_draw(src, dst, cx, cy, cw, ch,
+                                mask, mask_x, mask_y,
+                                tbuf, func, func2,
+                                &face, mul_col, aa_spans,
+                                smooth, col_blend, EINA_TRUE);
+          }
+     }
+   else
+     {
+        //Interpolated color info
+        DATA32 tmpc[5] = {
+           INTERP_256(128, c[0], c[1]),
+           INTERP_256(128, c[3], c[2]),
+           INTERP_256(128, c[0], c[3]),
+           INTERP_256(128, c[1], c[2]),
+           INTERP_256(128, tmpc[2], tmpc[3])};
 
-        _map_triangle_draw(src, dst, cx, cy, cw, ch,
-                           mask, mask_x, mask_y,
-                           tbuf, func, func2,
-                           &poly, mul_col, aa_spans,
-                           smooth, col_blend);
+        //9 vertices (see above figure)
+        Map_Vertex vert[9] = {
+           {x[0], y[0], u[0], v[0], 1, c[0]},
+           {x[1], y[1], u[1], v[1], 1, c[1]},
+           {x[2], y[2], u[2], v[2], 1, c[2]},
+           {x[3], y[3], u[3], v[3], 1, c[3]},
+           {x[0] + (x[1] - x[0]) * 0.5, y[0] + (y[1] - y[0]) * 0.5, u[0] + (u[1] - u[0]) * 0.5, v[0] + (v[1] - v[0]) * 0.5, 1, tmpc[0]},
+           {x[3] + (x[2] - x[3]) * 0.5, y[3] + (y[2] - y[3]) * 0.5, u[3] + (u[2] - u[3]) * 0.5, v[3] + (v[2] - v[3]) * 0.5, 1, tmpc[1]},
+           {x[0] + (x[3] - x[0]) * 0.5, y[0] + (y[3] - y[0]) * 0.5, u[0] + (u[3] - u[0]) * 0.5, v[0] + (v[3] - v[0]) * 0.5, 1, tmpc[2]},
+           {x[1] + (x[2] - x[1]) * 0.5, y[1] + (y[2] - y[1]) * 0.5, u[1] + (u[2] - u[1]) * 0.5, v[1] + (v[2] - v[1]) * 0.5, 1, tmpc[3]},
+           {vert[6].x + (vert[7].x - vert[6].x) * 0.5, vert[4].y + (vert[5].y - vert[4].y) * 0.5, vert[6].u + (vert[7].u - vert[6].u) * 0.5, vert[4].v + (vert[5].v - vert[4].v) * 0.5, 1, tmpc[4]}};
+
+        //Vertex Indices
+        int idx[4][4] = {{ 0, 4, 8, 6 }, {4, 1, 7, 8}, {6, 8, 5, 3}, {8, 7, 2, 5}};
+
+        Map_Tripoly poly;
+
+        //Draw a pair of triangles
+        for (int i = 0; i < 4; ++i)
+          {
+             poly.v[0] = vert[idx[i][0]];
+             poly.v[1] = vert[idx[i][1]];
+             poly.v[2] = vert[idx[i][3]];
+
+             _map_triangle_draw(src, dst, cx, cy, cw, ch,
+                                mask, mask_x, mask_y,
+                                tbuf, func, func2,
+                                &poly, mul_col, aa_spans,
+                                smooth, col_blend, EINA_FALSE);
+
+             poly.v[0] = vert[idx[i][1]];
+             poly.v[1] = vert[idx[i][3]];
+             poly.v[2] = vert[idx[i][2]];
+
+             _map_triangle_draw(src, dst, cx, cy, cw, ch,
+                                mask, mask_x, mask_y,
+                                tbuf, func, func2,
+                                &poly, mul_col, aa_spans,
+                                smooth, col_blend, EINA_FALSE);
+          }
      }
 #ifdef MAP_HIGH_ANTI_ALIASING
    if (anti_alias)
diff --git a/src/tests/evas/evas_test_map.c b/src/tests/evas/evas_test_map.c
index e8ce7adb78..3e8b37faec 100644
--- a/src/tests/evas/evas_test_map.c
+++ b/src/tests/evas/evas_test_map.c
@@ -190,7 +190,7 @@ _persp_face_check(const unsigned int *pixels, int stride, const Persp_Face *face
 
         for (y = ((face->top > face->far_top) ? face->top : face->far_top) + 3;
              y < ((face->bottom < face->far_bottom) ? face->bottom : face->far_bottom) - 3;
-             y += 3)
+             y++)
           {
              const unsigned int pixel = pixels[(y * stride) + x];
              const double v = ((y + 0.5 - top) / (bottom - top)) * PERSP_TEX;
@@ -209,13 +209,14 @@ _persp_face_check(const unsigned int *pixels, int stride, const Persp_Face *face
                }
           }
      }
-   ck_assert_int_gt(checked, 2000);
+   ck_assert_int_gt(checked, 2500);
    ck_assert_msg(!wrong, "%d of %d pixels show the wrong texel, worst %d columns off at %d,%d",
                  wrong, checked, worst, worst_x, worst_y);
 }
 
 static void
-_persp_check(const Persp_Face *faces, int count, Eina_Bool smooth)
+_persp_check(const Persp_Face *faces, int count, Eina_Bool smooth,
+             Eina_Bool anti_alias)
 {
    Ecore_Evas *ee;
    Evas *e;
@@ -245,6 +246,7 @@ _persp_check(const Persp_Face *faces, int count, Eina_Bool smooth)
      _persp_face_set(map, 4 * i, &faces[i]);
    evas_map_util_3d_perspective(map, 0, 150, 0, PERSP_FOC);
    evas_map_smooth_set(map, smooth);
+   evas_object_anti_alias_set(img, anti_alias);
    evas_object_map_set(img, map);
    evas_object_map_enable_set(img, EINA_TRUE);
    ecore_evas_manual_render(ee);
@@ -259,20 +261,21 @@ _persp_check(const Persp_Face *faces, int count, Eina_Bool smooth)
 
 /* right edge twice as far */
 static const Persp_Face _persp_slight = { 10, 210, 10, 290, 80, 220, 2 };
-/* right edge eight times as far: the texture is squeezed hard there */
-static const Persp_Face _persp_steep = { 10, 210, 10, 290, 130, 170, 8 };
+/* right edge fourteen times as far, so a fourteenth as high: the texture is
+ * squeezed hard there */
+static const Persp_Face _persp_steep = { 10, 210, 10, 290, 140, 160, 14 };
 
 EFL_START_TEST(evas_object_map_perspective_texture)
 {
-   _persp_check(&_persp_slight, 1, EINA_FALSE);
-   _persp_check(&_persp_slight, 1, EINA_TRUE);
+   _persp_check(&_persp_slight, 1, EINA_FALSE, EINA_FALSE);
+   _persp_check(&_persp_slight, 1, EINA_TRUE, EINA_FALSE);
 }
 EFL_END_TEST
 
 EFL_START_TEST(evas_object_map_perspective_steep)
 {
-   _persp_check(&_persp_steep, 1, EINA_FALSE);
-   _persp_check(&_persp_steep, 1, EINA_TRUE);
+   _persp_check(&_persp_steep, 1, EINA_FALSE, EINA_FALSE);
+   _persp_check(&_persp_steep, 1, EINA_TRUE, EINA_FALSE);
 }
 EFL_END_TEST
 
@@ -286,7 +289,22 @@ EFL_START_TEST(evas_object_map_perspective_many_faces)
       { 250, 450, 10, 290, 80, 220, 2 },
    };
 
-   _persp_check(faces, 2, EINA_FALSE);
+   _persp_check(faces, 2, EINA_FALSE, EINA_FALSE);
+}
+EFL_END_TEST
+
+/* Smooth maps of anti-aliased objects are drawn by another rasterizer */
+EFL_START_TEST(evas_object_map_perspective_anti_alias)
+{
+   const Persp_Face faces[2] =
+   {
+      { 10, 210, 10, 290, 80, 220, 2 },
+      { 250, 450, 10, 290, 80, 220, 2 },
+   };
+
+   _persp_check(&_persp_slight, 1, EINA_TRUE, EINA_TRUE);
+   _persp_check(&_persp_steep, 1, EINA_TRUE, EINA_TRUE);
+   _persp_check(faces, 2, EINA_TRUE, EINA_TRUE);
 }
 EFL_END_TEST
 
@@ -297,4 +315,5 @@ void evas_test_map(TCase *tc)
    tcase_add_test(tc, evas_object_map_perspective_texture);
    tcase_add_test(tc, evas_object_map_perspective_steep);
    tcase_add_test(tc, evas_object_map_perspective_many_faces);
+   tcase_add_test(tc, evas_object_map_perspective_anti_alias);
 }

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

Reply via email to