This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch perf/map-span-simd
in repository efl.
View the commit online.
commit d367d8022afa429c14f80d7422b76b17e244e607
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 22:14:01 2026 -0600
evas/map: do not extrapolate before the source in anti-aliased maps
The triangles of the anti-aliased rasterizer put some edge pixels a
hair before the source. The address was limited to the first texel, but
the blending weight was taken from the fraction of the negative
position, which is negative itself, so the color was pushed past that
texel, away from the second one. On stripes of 96 and 160 a turned map
drew grays down to 82.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/evas/common/evas_map_image_internal_high.c | 14 ++---
src/tests/evas/evas_test_map.c | 73 ++++++++++++++++++++++
2 files changed, 79 insertions(+), 8 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 4b6f303951..02069c865c 100644
--- a/src/lib/evas/common/evas_map_image_internal_high.c
+++ b/src/lib/evas/common/evas_map_image_internal_high.c
@@ -424,21 +424,19 @@ _map_triangle_scanlines(RGBA_Image *src, RGBA_Image *dst,
//Draw horizontal line
while (x++ < x2)
{
- su = u;
- sv = v;
+ /* the edges put pixels a hair before the source: the fraction
+ * of a negative position would blend beyond the first texel */
+ su = (u > 0) ? u : 0;
+ sv = (v > 0) ? v : 0;
if (persp)
{
z = (q > 1e-6f) ? (1 / q) : 1e6f;
- su = (u > 0) ? (u * z) : 0;
- sv = (v > 0) ? (v * z) : 0;
+ su *= z;
+ sv *= z;
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;
-
//Range exception handling
//OPTIMIZE ME, handle in advance?
if (uu >= sw) uu = sw - 1;
diff --git a/src/tests/evas/evas_test_map.c b/src/tests/evas/evas_test_map.c
index 9c6c0c10b0..b77b564df0 100644
--- a/src/tests/evas/evas_test_map.c
+++ b/src/tests/evas/evas_test_map.c
@@ -388,6 +388,78 @@ EFL_START_TEST(evas_object_map_perspective_colors_anti_alias)
}
EFL_END_TEST
+/* Blending between texels must stay between them. The edges of a turned map
+ * put pixels a hair before the source, where the anti-aliased rasterizer
+ * extrapolated away from the first row or column. */
+EFL_START_TEST(evas_object_map_anti_alias_edges)
+{
+ const int sw = 37, sh = 23;
+ Ecore_Evas *ee;
+ Evas_Object *bg, *img;
+ Evas_Map *map;
+ unsigned int *source;
+ const unsigned int *pixels;
+ int x, y, i, j, along, wrong = 0, low = 255, high = 0;
+
+ ee = ecore_evas_buffer_new(160, 120);
+ ecore_evas_show(ee);
+ bg = evas_object_rectangle_add(ecore_evas_get(ee));
+ evas_object_resize(bg, 160, 120);
+ evas_object_show(bg);
+ img = evas_object_image_filled_add(ecore_evas_get(ee));
+ evas_object_image_size_set(img, sw, sh);
+ evas_object_resize(img, sw, sh);
+ evas_object_anti_alias_set(img, EINA_TRUE);
+ evas_object_show(img);
+ map = evas_map_new(4);
+
+ /* stripes of two grays, across then down: a checker would average the
+ * overshoot of one row with that of the next */
+ for (along = 0; along < 2; along++)
+ {
+ source = evas_object_image_data_get(img, EINA_TRUE);
+ for (y = 0; y < sh; y++)
+ for (x = 0; x < sw; x++)
+ source[(y * sw) + x] = ((along ? y : x) & 1) ? 0xffa0a0a0 : 0xff606060;
+ evas_object_image_data_set(img, source);
+ evas_object_image_data_update_add(img, 0, 0, sw, sh);
+
+ for (i = 0; i < 100; i++)
+ {
+ const int w = 20 + ((i * 37) % 90), h = 15 + ((i * 23) % 80);
+
+ evas_map_util_points_populate_from_geometry
+ (map, 10 + ((i * 13) % 50), 5 + ((i * 7) % 30), w, h, 0);
+ for (j = 0; j < 4; j++)
+ evas_map_point_image_uv_set(map, j, ((j == 1) || (j == 2)) ? sw : 0,
+ (j >= 2) ? sh : 0);
+ evas_map_util_rotate(map, 3.7 * (i + 1), 80, 60);
+ evas_map_smooth_set(map, EINA_TRUE);
+ evas_object_map_set(img, map);
+ evas_object_map_enable_set(img, EINA_TRUE);
+ evas_damage_rectangle_add(ecore_evas_get(ee), 0, 0, 160, 120);
+ ecore_evas_manual_render(ee);
+ pixels = ecore_evas_buffer_pixels_get(ee);
+ for (j = 0; j < (160 * 120); j++)
+ {
+ int gray = pixels[j] & 0xff;
+
+ /* the white around the map */
+ if (pixels[j] == 0xffffffff) continue;
+ if (gray < low) low = gray;
+ if (gray > high) high = gray;
+ if ((gray < 0x5f) || (gray > 0xa1)) wrong++;
+ }
+ }
+ }
+ ck_assert_msg(!wrong, "%d pixels outside the source grays, from %d to %d",
+ wrong, low, high);
+
+ evas_map_free(map);
+ ecore_evas_free(ee);
+}
+EFL_END_TEST
+
void evas_test_map(TCase *tc)
{
tcase_add_test(tc, evas_object_map_api);
@@ -398,4 +470,5 @@ void evas_test_map(TCase *tc)
tcase_add_test(tc, evas_object_map_perspective_anti_alias);
tcase_add_test(tc, evas_object_map_perspective_colors);
tcase_add_test(tc, evas_object_map_perspective_colors_anti_alias);
+ tcase_add_test(tc, evas_object_map_anti_alias_edges);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.