summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2015-01-15 13:41:06 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2015-01-20 11:38:00 -0800
commitfc05b51c2b198dcc5553f6de1b8fb0e22e7d28ae (patch)
tree4ac3d618db05c3d9d140c9d5d22a09ecd9efcc89
parentd4ab3cb0b857699c523272bb192752041c77e5e7 (diff)
downloadmupdf-fc05b51c2b198dcc5553f6de1b8fb0e22e7d28ae.tar.xz
Fix reference counting of display lists in Cache.cpp
Fred Ross-Perry found some issues with the display list counting. This fixes the problems. Also he found a spot where we should have been doing just the page contents as opposed to the page.
-rw-r--r--platform/windows/mupdfwinrt/Cache.cpp4
-rw-r--r--platform/windows/mupdfwinrt/muctx.cpp8
2 files changed, 2 insertions, 10 deletions
diff --git a/platform/windows/mupdfwinrt/Cache.cpp b/platform/windows/mupdfwinrt/Cache.cpp
index b129710f..d2567bc2 100644
--- a/platform/windows/mupdfwinrt/Cache.cpp
+++ b/platform/windows/mupdfwinrt/Cache.cpp
@@ -22,7 +22,6 @@ void Cache::Empty(fz_context *mu_ctx)
cache_entry_t *old_entry = curr_entry;
curr_entry = old_entry->next;
fz_drop_display_list(mu_ctx, old_entry->dlist);
-
delete old_entry;
}
this->size = 0;
@@ -76,8 +75,6 @@ void Cache::Add(int value, int width_in, int height_in, fz_display_list *dlist,
head = new_entry;
}
size++;
- /* We are going to use this item now */
- fz_keep_display_list(mu_ctx, new_entry->dlist);
}
fz_display_list* Cache::Use(int value, int *width_out, int *height_out, fz_context *mu_ctx)
@@ -93,7 +90,6 @@ fz_display_list* Cache::Use(int value, int *width_out, int *height_out, fz_conte
}
if (curr_entry != NULL)
{
- fz_keep_display_list(mu_ctx, curr_entry->dlist);
/* Move this to the front */
if (curr_entry != head)
{
diff --git a/platform/windows/mupdfwinrt/muctx.cpp b/platform/windows/mupdfwinrt/muctx.cpp
index d5c34c80..fbcb01f3 100644
--- a/platform/windows/mupdfwinrt/muctx.cpp
+++ b/platform/windows/mupdfwinrt/muctx.cpp
@@ -648,8 +648,6 @@ status_t muctx::RenderPageMT(void *dlist, void *a_dlist, int page_width, int pag
{
fz_free_device(dev);
fz_drop_pixmap(ctx_clone, pix);
- fz_drop_display_list(ctx_clone, display_list);
- fz_drop_display_list(ctx_clone, annot_displaylist);
}
fz_catch(ctx_clone)
{
@@ -689,11 +687,11 @@ status_t muctx::RenderPage(int page_num, unsigned char *bmp_data, int bmp_width,
bmp_height, bmp_data);
fz_clear_pixmap_with_value(mu_ctx, pix, 255);
dev = fz_new_draw_device(mu_ctx, pix);
- fz_run_page(mu_doc, page, dev, pctm, NULL);
+ fz_run_page_contents(mu_doc, page, dev, pctm, NULL);
fz_annot *annot;
for (annot = fz_first_annot(mu_doc, page); annot; annot = fz_next_annot(mu_doc, annot))
- fz_run_annot(mu_doc, page, annot, dev, &fz_identity, NULL);
+ fz_run_annot(mu_doc, page, annot, dev, pctm, NULL);
}
fz_always(mu_ctx)
{
@@ -879,8 +877,6 @@ status_t muctx::SavePage(char *filename, int page_num, int resolution, int type,
fz_drop_pixmap(mu_ctx, pix);
fz_free_device(dev);
fz_free_page(mu_doc, page);
- if (dlist != NULL)
- fz_drop_display_list(mu_ctx, dlist);
if (out != NULL)
{
fz_close_output(out);