diff options
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/bbox-device.c | 4 | ||||
-rw-r--r-- | source/fitz/device.c | 38 | ||||
-rw-r--r-- | source/fitz/draw-device.c | 4 | ||||
-rw-r--r-- | source/fitz/list-device.c | 2 | ||||
-rw-r--r-- | source/fitz/stext-device.c | 4 | ||||
-rw-r--r-- | source/fitz/svg-device.c | 4 |
6 files changed, 45 insertions, 11 deletions
diff --git a/source/fitz/bbox-device.c b/source/fitz/bbox-device.c index 247fdb30..42ca57ad 100644 --- a/source/fitz/bbox-device.c +++ b/source/fitz/bbox-device.c @@ -179,7 +179,7 @@ fz_bbox_end_tile(fz_context *ctx, fz_device *dev) } static void -fz_bbox_drop_imp(fz_context *ctx, fz_device *dev) +fz_bbox_close(fz_context *ctx, fz_device *dev) { fz_bbox_device *bdev = (fz_bbox_device*)dev; if (bdev->top > 0) @@ -191,7 +191,7 @@ fz_new_bbox_device(fz_context *ctx, fz_rect *result) { fz_bbox_device *dev = fz_new_device(ctx, sizeof *dev); - dev->super.drop_imp = fz_bbox_drop_imp; + dev->super.close = fz_bbox_close; dev->super.fill_path = fz_bbox_fill_path; dev->super.stroke_path = fz_bbox_stroke_path; diff --git a/source/fitz/device.c b/source/fitz/device.c index 5a293bce..df2d4f86 100644 --- a/source/fitz/device.c +++ b/source/fitz/device.c @@ -7,12 +7,46 @@ fz_new_device(fz_context *ctx, int size) } void +fz_close_device(fz_context *ctx, fz_device *dev) +{ + if (dev == NULL) + return; + if (dev->close) + dev->close(ctx, dev); + + /* Don't call more than once! */ + dev->close = NULL; + + /* And disable all further device calls. */ + dev->fill_path = NULL; + dev->stroke_path = NULL; + dev->clip_path = NULL; + dev->clip_stroke_path = NULL; + dev->fill_text = NULL; + dev->stroke_text = NULL; + dev->clip_text = NULL; + dev->clip_stroke_text = NULL; + dev->ignore_text = NULL; + dev->fill_shade = NULL; + dev->fill_image = NULL; + dev->fill_image_mask = NULL; + dev->clip_image_mask = NULL; + dev->pop_clip = NULL; + dev->begin_mask = NULL; + dev->end_mask = NULL; + dev->begin_group = NULL; + dev->end_group = NULL; + dev->begin_tile = NULL; + dev->end_tile = NULL; +} + +void fz_drop_device(fz_context *ctx, fz_device *dev) { if (dev == NULL) return; - if (dev->drop_imp) - dev->drop_imp(ctx, dev); + if (dev->close) + dev->close(ctx, dev); fz_free(ctx, dev->container); fz_free(ctx, dev); } diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index 83195cd1..b9db1558 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -2013,7 +2013,7 @@ fz_draw_end_tile(fz_context *ctx, fz_device *devp) } static void -fz_draw_drop_imp(fz_context *ctx, fz_device *devp) +fz_draw_close(fz_context *ctx, fz_device *devp) { fz_draw_device *dev = (fz_draw_device*)devp; fz_gel *gel = dev->gel; @@ -2056,7 +2056,7 @@ fz_new_draw_device(fz_context *ctx, fz_pixmap *dest) { fz_draw_device *dev = fz_new_device(ctx, sizeof *dev); - dev->super.drop_imp = fz_draw_drop_imp; + dev->super.close = fz_draw_close; dev->super.fill_path = fz_draw_fill_path; dev->super.stroke_path = fz_draw_stroke_path; diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c index 156e50f6..5f7d69c8 100644 --- a/source/fitz/list-device.c +++ b/source/fitz/list-device.c @@ -1243,7 +1243,7 @@ fz_new_list_device(fz_context *ctx, fz_display_list *list) dev->super.render_flags = fz_list_render_flags; - dev->super.drop_imp = drop_writer; + dev->super.close = drop_writer; dev->list = list; dev->path = NULL; diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 35a6568a..94ff9fd6 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -1010,7 +1010,7 @@ fz_bidi_reorder_stext_page(fz_context *ctx, fz_stext_page *page) } static void -fz_stext_drop_imp(fz_context *ctx, fz_device *dev) +fz_stext_close(fz_context *ctx, fz_device *dev) { fz_stext_device *tdev = (fz_stext_device*)dev; @@ -1034,7 +1034,7 @@ fz_new_stext_device(fz_context *ctx, fz_stext_sheet *sheet, fz_stext_page *page) dev->super.hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE; - dev->super.drop_imp = fz_stext_drop_imp; + dev->super.close = fz_stext_close; dev->super.fill_text = fz_stext_fill_text; dev->super.stroke_text = fz_stext_stroke_text; dev->super.clip_text = fz_stext_clip_text; diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index e57b8f5a..d36a5872 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -1057,7 +1057,7 @@ svg_dev_end_tile(fz_context *ctx, fz_device *dev) } static void -svg_dev_drop_imp(fz_context *ctx, fz_device *dev) +svg_dev_close(fz_context *ctx, fz_device *dev) { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; @@ -1073,7 +1073,7 @@ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, { svg_device *dev = fz_new_device(ctx, sizeof *dev); - dev->super.drop_imp = svg_dev_drop_imp; + dev->super.close = svg_dev_close; dev->super.fill_path = svg_dev_fill_path; dev->super.stroke_path = svg_dev_stroke_path; |