summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/stext-device.c4
-rw-r--r--source/fitz/util.c12
2 files changed, 12 insertions, 4 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);