diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/stext-device.c | 4 | ||||
-rw-r--r-- | source/fitz/util.c | 12 | ||||
-rw-r--r-- | source/tools/mudraw.c | 7 |
3 files changed, 18 insertions, 5 deletions
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 55f2033b..607dcbab 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -456,10 +456,10 @@ fz_lookup_stext_style(fz_context *ctx, fz_stext_sheet *sheet, fz_text_span *span } fz_stext_page * -fz_new_stext_page(fz_context *ctx) +fz_new_stext_page(fz_context *ctx, const fz_rect *mediabox) { fz_stext_page *page = fz_malloc(ctx, sizeof(*page)); - page->mediabox = fz_empty_rect; + page->mediabox = *mediabox; page->len = 0; page->cap = 0; page->blocks = NULL; diff --git a/source/fitz/util.c b/source/fitz/util.c index cefac962..ff1464fc 100644 --- a/source/fitz/util.c +++ b/source/fitz/util.c @@ -269,8 +269,12 @@ fz_new_stext_page_from_display_list(fz_context *ctx, fz_display_list *list, fz_s { fz_stext_page *text; fz_device *dev; + fz_rect mediabox; - text = fz_new_stext_page(ctx); + if (list == NULL) + return NULL; + + text = fz_new_stext_page(ctx, fz_bound_display_list(ctx, list, &mediabox)); fz_try(ctx) { dev = fz_new_stext_device(ctx, sheet, text); @@ -295,8 +299,12 @@ fz_new_stext_page_from_page(fz_context *ctx, fz_page *page, fz_stext_sheet *shee { fz_stext_page *text; fz_device *dev; + fz_rect *mediabox; + + if (page == NULL) + return NULL; - text = fz_new_stext_page(ctx); + text = fz_new_stext_page(ctx, fz_bound_page(ctx, page, &mediabox)); fz_try(ctx) { dev = fz_new_stext_device(ctx, sheet, text); diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 16e12b6b..e7dc629b 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -620,7 +620,12 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in fz_try(ctx) { - text = fz_new_stext_page(ctx); + fz_rect mediabox; + if (list) + fz_bound_display_list(ctx, list, &mediabox); + else + fz_bound_page(ctx, page, &mediabox); + text = fz_new_stext_page(ctx, &mediabox); dev = fz_new_stext_device(ctx, sheet, text); if (lowmemory) fz_enable_device_hints(ctx, dev, FZ_NO_CACHE); |