From c245c9a32687edd068bd9eacb16e966c3b6dd8c8 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 23 May 2009 13:04:55 +0000 Subject: Drop groups that contain only empty groups on the floor. This fixes the invalid bounding box errors in drawfiles exported from some sites. svn path=/trunk/pencil/; revision=7535 --- pencil_save.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pencil_save.c b/pencil_save.c index ee9faed..2d6bab4 100644 --- a/pencil_save.c +++ b/pencil_save.c @@ -180,9 +180,15 @@ void pencil_save_pass1(struct pencil_save_context *context, switch (item->type) { case pencil_GROUP: - if (!item->children || MAX_DEPTH <= depth) + if (!item->children || MAX_DEPTH <= depth || + (item->bbox.x0 == INT_MAX && + item->bbox.y0 == INT_MAX && + item->bbox.x1 == INT_MIN && + item->bbox.y1 == INT_MIN)) break; + context->size += 36; + break; case pencil_TEXT: { @@ -351,8 +357,13 @@ void pencil_save_pass2(struct pencil_save_context *context, switch (item->type) { case pencil_GROUP: - if (!item->children || MAX_DEPTH <= depth) + if (!item->children || MAX_DEPTH <= depth || + (item->bbox.x0 == INT_MAX && + item->bbox.y0 == INT_MAX && + item->bbox.x1 == INT_MIN && + item->bbox.y1 == INT_MIN)) break; + group = true; object->type = drawfile_TYPE_GROUP; object->size = 36; -- cgit v1.2.3