From: Karryanna Date: Wed, 10 Jun 2015 09:04:06 +0000 (+0200) Subject: Labelling: Better dump of bitmaps X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=7865d1a16768295af746bb085e464527226f74c8;p=leo.git Labelling: Better dump of bitmaps ... now it really supports non-rectangular bitmaps O:) --- diff --git a/labeller.c b/labeller.c index 7b24543..da3bb52 100644 --- a/labeller.c +++ b/labeller.c @@ -923,12 +923,16 @@ void dump_bitmaps(struct individual *individual) continue; } - for (int row = max2(p->y, 0); row < min2(p->y + v->height, page_height_int); row++) + int base_x = p->x; int base_y = p->y; + for (int dr = max2(0, 0-p->y); dr < v->height; dr++) { - for (int col = max2(p->x, 0); col < min2(p->x + v->width, page_width_int); col++) + for (int dc = max2(0, 0-p->x); dc < v->width; dc++) { - if (bitmap[row * page_width_int + col] == 1) total += 1; - bitmap[row * page_width_int + col] = 1; + if (v->bitmap[dr * v->width + dc]) + { + if (bitmap[(base_y + dr) * page_width_int + (base_x + dc)]) total += 1; + bitmap[(base_y + dr) * page_width_int + (base_x + dc)] = 1; + } } } }