From 95df6c363421575cd7ed1749bde8d50c604049cf Mon Sep 17 00:00:00 2001 From: Karryanna Date: Wed, 13 May 2015 18:52:00 +0200 Subject: [PATCH] Labelling: Overlaps outside of map are not considered --- labeller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labeller.c b/labeller.c index 1db25fc..1799bd0 100644 --- a/labeller.c +++ b/labeller.c @@ -1286,8 +1286,8 @@ int overlaps(struct placement *p1, struct placement *p2) int p2x = p2->x; int p2y = p2->y; int overlap = 0; - for (int y=max2(p1y, p2y); y<=min2(p1y+v1->height, p2y+v2->height); y++) - for (int x=max2(p1x, p2x); x<=min2(p1x+v1->width, p2x+v2->width); x++) + for (int y=max2(0, max2(p1y, p2y)); yheight, p2y+v2->height)); y++) + for (int x=max2(0, max2(p1x, p2x)); xwidth, p2x+v2->width)); x++) { if (v1->bitmap[(y-p1y)*v1->width + (x-p1x)] && v2->bitmap[(y-p2y)*v2->width + (x-p2x)]) -- 2.39.2