void-packages/srcpkgs/efl/patches/0002-evas-genetic-update-regions-smart-merge-merge-v-adja.patch
q66 0c87bf36c2 efl: fixes from git, use gles by default, backtraces on musl
This unbreaks accelerated E with Wayland for one.

Also, gles2 is now a suboption of opengl, as that makes more sense.
2020-06-11 17:07:16 +02:00

104 lines
3.8 KiB
Diff

From af2fd2ead002b10e9b1f56b41f4a9e24b56bfca4 Mon Sep 17 00:00:00 2001
From: "Carsten Haitzler (Rasterman)" <raster@rasterman.com>
Date: Thu, 4 Jun 2020 20:25:46 +0100
Subject: [PATCH 2/7] evas - genetic update regions smart merge - merge v
adjacent regions
regions sometimes produce box sets like:
// +---+
// | |
// +---+ +-------+
// | | | |
// +---+ +-------+---------+
// | |
// | |
// +-----------------+
so the upper-left 2 boxes can be merged into 1 and they have the same
x coords and are flush-aligned one above the other. that is what
this does - find these and merge them to have fewer rects
@fix
---
.../engines/software_generic/evas_engine.c | 54 ++++++++++++++++---
1 file changed, 48 insertions(+), 6 deletions(-)
diff --git src/modules/evas/engines/software_generic/evas_engine.c src/modules/evas/engines/software_generic/evas_engine.c
index 0309d620e9..19b60f6621 100644
--- src/modules/evas/engines/software_generic/evas_engine.c
+++ src/modules/evas/engines/software_generic/evas_engine.c
@@ -3958,7 +3958,6 @@ _smart_merge(Tilebuf *tb, Tilebuf_Rect *rects)
}
j++;
}
- n2 = n;
free(box);
box = box2;
if (!did_merge) break;
@@ -3976,15 +3975,58 @@ _smart_merge(Tilebuf *tb, Tilebuf_Rect *rects)
box = region_rects(region);
n = region_rects_num(region);
merged = calloc(1, n * sizeof(Tilebuf_Rect));
+ j = 0;
+#if 1
+ // regions sometimes produce box sets like:
+ // +---+
+ // | |
+ // +---+ +-------+
+ // | | | |
+ // +---+ +-------+---------+
+ // | |
+ // | |
+ // +-----------------+
+ // so the upper-left 2 boxes can be merged into 1 and they have the same
+ // x coords and are flush-aligned one above the other. that is what
+ // this does - find these and merge them to have fewer rects
for (i = 0; i < n; i++)
{
- merged[i].x = box[i].x1;
- merged[i].y = box[i].y1;
- merged[i].w = box[i].x2 - box[i].x1;
- merged[i].h = box[i].y2 - box[i].y1;
+ // skip empty boxes
+ if (box[i].x1 == box[i].x2) continue;
+ // walk all following boxes after this and see if they can be merged
+ // into box i
+ for (k = i + 1; k < n; k++)
+ {
+ // skip empty boxes after i
+ if (box[k].x1 == box[k].x2) continue;
+ // match x coords
+ if ((box[i].x1 == box[k].x1) && // if aligned vertically
+ (box[i].x2 == box[k].x2)) // exactly above/below
+ {
+ // right below, or right above
+ if (box[i].y2 == box[k].y1) // this box flush below
+ {
+ box[i].y2 = box[k].y2; // merge below i
+ box[k].x2 = box[k].x1; // empty this box - merged
+ }
+ else if (box[i].y1 == box[k].y2) // this box flush above
+ {
+ box[i].y2 = box[k].y2; // merge above i
+ box[k].x2 = box[k].x1; // empty this box - merged
+ }
+ }
+ }
+ // i may have expanded but will not be empty. future boxes after
+ // this may be empty though but handled at top of loop
+ merged[j].x = box[i].x1;
+ merged[j].y = box[i].y1;
+ merged[j].w = box[i].x2 - box[i].x1;
+ merged[j].h = box[i].y2 - box[i].y1;
mergelist = (Tilebuf_Rect *)eina_inlist_append
- (EINA_INLIST_GET(mergelist), EINA_INLIST_GET(&(merged[i])));
+ (EINA_INLIST_GET(mergelist), EINA_INLIST_GET(&(merged[j])));
+ j++;
}
+#endif
region_free(region);
rects = mergelist;
--
2.27.0