diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-23 13:04:55 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-05-23 13:04:55 +0000 |
commit | c245c9a32687edd068bd9eacb16e966c3b6dd8c8 (patch) | |
tree | a69b2d2e289e6a3c638682ead7ae71814b4c89e9 | |
parent | d0593c69728e839d22fd3afad53107395d57b0b9 (diff) | |
download | libpencil-c245c9a32687edd068bd9eacb16e966c3b6dd8c8.tar.gz libpencil-c245c9a32687edd068bd9eacb16e966c3b6dd8c8.tar.bz2 |
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
-rw-r--r-- | pencil_save.c | 15 |
1 files 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; |