From b054f9d0764f38f576fff63bf61488d1de37a447 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 16 Apr 2013 17:45:37 +0100 Subject: Add new function to return the accurate bbox of a path. As requested by customer 530. --- draw/draw_device.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'draw') diff --git a/draw/draw_device.c b/draw/draw_device.c index 6eca2315..1a807a4c 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -2099,3 +2099,24 @@ fz_new_draw_device_type3(fz_context *ctx, fz_pixmap *dest) ddev->flags |= FZ_DRAWDEV_FLAGS_TYPE3; return dev; } + +fz_irect * +fz_bound_path_accurate(fz_context *ctx, fz_irect *bbox, const fz_irect *scissor, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, float flatness, float linewidth) +{ + fz_gel *gel = fz_new_gel(ctx); + + fz_reset_gel(gel, scissor); + if (stroke) + { + if (stroke->dash_len > 0) + fz_flatten_dash_path(gel, path, stroke, ctm, flatness, linewidth); + else + fz_flatten_stroke_path(gel, path, stroke, ctm, flatness, linewidth); + } + else + fz_flatten_fill_path(gel, path, ctm, flatness); + fz_bound_gel(gel, bbox); + fz_free_gel(gel); + + return bbox; +} -- cgit v1.2.3