diff --git a/client/include/util.h b/client/include/util.h index 3fbfb5c4..de9fb3f8 100644 --- a/client/include/util.h +++ b/client/include/util.h @@ -40,7 +40,6 @@ bool util_guestCurToLocal(struct DoublePoint *local); void util_localCurToGuest(struct DoublePoint *guest); void util_rotatePoint(struct DoublePoint *point); bool util_hasGLExt(const char * exts, const char * ext); -int util_mergeOverlappingRects(FrameDamageRect * rects, int count); static inline double util_clamp(double x, double min, double max) { diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 98a14f3e..38ac9928 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -24,6 +24,7 @@ #include "common/KVMFR.h" #include "common/option.h" #include "common/sysinfo.h" +#include "common/rects.h" #include "common/time.h" #include "common/locking.h" #include "app.h" @@ -955,7 +956,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate, ); } - accumulated->count = util_mergeOverlappingRects(accumulated->rects, accumulated->count); + accumulated->count = rectsMergeOverlapping(accumulated->rects, accumulated->count); } ++this->overlayHistoryIdx; diff --git a/client/src/util.c b/client/src/util.c index ada73d5f..9b106902 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -219,48 +219,6 @@ bool util_hasGLExt(const char * exts, const char * ext) return str_containsValue(exts, ' ', ext); } -static bool rectIntersects(const FrameDamageRect * r1, const FrameDamageRect * r2) -{ - return r1->x < r2->x + r2->width && - r1->x + r1->width > r2->x && - r1->y < r2->y + r2->height && - r2->y + r1->height > r2->y; -} - -int util_mergeOverlappingRects(FrameDamageRect * rects, int count) -{ - bool removed[count]; - bool changed; - - memset(removed, 0, sizeof(removed)); - - do - { - changed = false; - for (int i = 0; i < count; ++i) - if (!removed[i]) - for (int j = i + 1; j < count; ++j) - if (!removed[j] && rectIntersects(rects + i, rects + j)) - { - uint32_t x2 = max(rects[i].x + rects[i].width, rects[j].x + rects[j].width); - uint32_t y2 = max(rects[i].y + rects[i].height, rects[j].y + rects[j].height); - rects[i].x = min(rects[i].x, rects[j].x); - rects[i].y = min(rects[i].y, rects[j].y); - rects[i].width = x2 - rects[i].x; - rects[i].height = y2 - rects[i].y; - removed[j] = true; - changed = true; - } - } - while (changed); - - int o = 0; - for (int i = 0; i < count; ++i) - if (!removed[i]) - rects[o++] = rects[i]; - return o; -} - bool util_initUIFonts(void) { if (FontConfig)