diff options
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/device.c | 10 | ||||
-rw-r--r-- | source/fitz/document.c | 7 | ||||
-rw-r--r-- | source/fitz/svg-device.c | 10 |
3 files changed, 27 insertions, 0 deletions
diff --git a/source/fitz/device.c b/source/fitz/device.c index fa428764..d9249732 100644 --- a/source/fitz/device.c +++ b/source/fitz/device.c @@ -36,6 +36,16 @@ fz_disable_device_hints(fz_device *dev, int hints) } void +fz_rebind_device(fz_device *dev, fz_context *ctx) +{ + if (dev == NULL) + return; + dev->ctx = ctx; + if (dev->rebind) + dev->rebind(dev); +} + +void fz_begin_page(fz_device *dev, const fz_rect *rect, const fz_matrix *ctm) { if (dev->begin_page) diff --git a/source/fitz/document.c b/source/fitz/document.c index 3926255b..a86c2f6e 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -102,6 +102,13 @@ fz_close_document(fz_document *doc) doc->close(doc); } +void +fz_rebind_document(fz_document *doc, fz_context *ctx) +{ + if (doc != NULL && doc->rebind != NULL) + doc->rebind(doc, ctx); +} + int fz_needs_password(fz_document *doc) { diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index dd5a2e19..dc248f88 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -1027,6 +1027,15 @@ svg_dev_free_user(fz_device *dev) fz_free(ctx, sdev); } +void svg_rebind(fz_device *dev) +{ + svg_device *sdev = dev->user; + + sdev->ctx = dev->ctx; + fz_rebind_output(sdev->out, sdev->ctx); + fz_rebind_output(sdev->out_store, sdev->ctx); +} + fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height) { svg_device *sdev = fz_malloc_struct(ctx, svg_device); @@ -1047,6 +1056,7 @@ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, fz_rethrow(ctx); } + dev->rebind = svg_rebind; dev->free_user = svg_dev_free_user; dev->fill_path = svg_dev_fill_path; |