summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-23 16:59:45 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-23 16:59:45 -0300
commitee5aca2e6cc5a60ea8356e56ca315609c7ea7bc3 (patch)
treef972f65ac121d03eb461b1c663bf3c38de8f2669 /gfx
parent25061ecb551c4d789bd3c7efda8143f740d56365 (diff)
downloadeeshow-ee5aca2e6cc5a60ea8356e56ca315609c7ea7bc3.tar.gz
eeshow-ee5aca2e6cc5a60ea8356e56ca315609c7ea7bc3.tar.bz2
eeshow-ee5aca2e6cc5a60ea8356e56ca315609c7ea7bc3.zip
gfx/cro.c (cro_get_size, cro_img_write): make returning the size optional
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 1e229d5..4a52bcb 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -315,15 +315,18 @@ static struct cro_ctx *init_common(int argc, char *const *argv)
void cro_get_size(const struct cro_ctx *cc, int *w, int *h, int *x, int *y)
{
+ int bw, bh;
int xmin, ymin;
- record_bbox(&cc->record, &xmin, &ymin, w, h);
+ record_bbox(&cc->record, &xmin, &ymin, &bw, &bh);
-// fprintf(stderr, "%dx%d%+d%+d\n", *w, *h, xmin, ymin);
+// fprintf(stderr, "%dx%d%+d%+d\n", bw, bh, xmin, ymin);
*x = xmin;
*y = ymin;
- *w = cd(cc, *w);
- *h = cd(cc, *h);
+ if (w)
+ *w = cd(cc, bw);
+ if (h)
+ *h = cd(cc, bh);
// fprintf(stderr, "%dx%d%+d%+d\n", *w, *h, xmin, ymin);
}
@@ -535,8 +538,10 @@ void cro_img_write(struct cro_ctx *cc, const char *name)
void cro_canvas_end(struct cro_ctx *cc, int *w, int *h, int *xmin, int *ymin)
{
end_common(cc, w, h, xmin, ymin);
- *w /= cc->scale;
- *h /= cc->scale;
+ if (w)
+ *w /= cc->scale;
+ if (h)
+ *h /= cc->scale;
}