summaryrefslogtreecommitdiff
path: root/fitz/dev_list.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-18 15:49:09 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-19 12:40:24 +0000
commit40f4ed22806b88ba0e26c458915d4695f1f7c201 (patch)
treebacdebee1932d294f8233a8fb14cb86383e5f107 /fitz/dev_list.c
parent2c836b57d5295b47655988cf8deaffda731e1c3c (diff)
downloadmupdf-40f4ed22806b88ba0e26c458915d4695f1f7c201.tar.xz
Multi-threading support for MuPDF
When we moved over to a context based system, we laid the foundation for a thread-safe mupdf. This commit should complete that process. Firstly, fz_clone_context is properly implemented so that it makes a new context, but shares certain sections (currently just the allocator, and the store). Secondly, we add locking (to parts of the code that have previously just had placeholder LOCK/UNLOCK comments). Functions to lock and unlock a mutex are added to the allocator structure; omit these (as is the case today) and no multithreading is (safely) possible. The context will refuse to clone if these are not provided. Finally we flesh out the LOCK/UNLOCK comments to be real calls of the functions - unfortunately this requires us to plumb fz_context into the fz_keep_storable function (and all the fz_keep_xxx functions that call it). This is the largest section of the patch. No changes expected to any test files.
Diffstat (limited to 'fitz/dev_list.c')
-rw-r--r--fitz/dev_list.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 0c273c57..7f36ce88 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -80,7 +80,7 @@ fz_new_display_node(fz_context *ctx, fz_display_command cmd, fz_matrix ctm,
node->ctm = ctm;
if (colorspace)
{
- node->colorspace = fz_keep_colorspace(colorspace);
+ node->colorspace = fz_keep_colorspace(ctx, colorspace);
if (color)
{
for (i = 0; i < node->colorspace->n; i++)
@@ -430,7 +430,7 @@ fz_list_fill_shade(fz_device *dev, fz_shade *shade, fz_matrix ctm, float alpha)
fz_context *ctx = dev->ctx;
node = fz_new_display_node(ctx, FZ_CMD_FILL_SHADE, ctm, NULL, NULL, alpha);
node->rect = fz_bound_shade(shade, ctm);
- node->item.shade = fz_keep_shade(shade);
+ node->item.shade = fz_keep_shade(ctx, shade);
fz_append_display_node(dev->user, node);
}
@@ -440,7 +440,7 @@ fz_list_fill_image(fz_device *dev, fz_pixmap *image, fz_matrix ctm, float alpha)
fz_display_node *node;
node = fz_new_display_node(dev->ctx, FZ_CMD_FILL_IMAGE, ctm, NULL, NULL, alpha);
node->rect = fz_transform_rect(ctm, fz_unit_rect);
- node->item.image = fz_keep_pixmap(image);
+ node->item.image = fz_keep_pixmap(dev->ctx, image);
fz_append_display_node(dev->user, node);
}
@@ -451,7 +451,7 @@ fz_list_fill_image_mask(fz_device *dev, fz_pixmap *image, fz_matrix ctm,
fz_display_node *node;
node = fz_new_display_node(dev->ctx, FZ_CMD_FILL_IMAGE_MASK, ctm, colorspace, color, alpha);
node->rect = fz_transform_rect(ctm, fz_unit_rect);
- node->item.image = fz_keep_pixmap(image);
+ node->item.image = fz_keep_pixmap(dev->ctx, image);
fz_append_display_node(dev->user, node);
}
@@ -463,7 +463,7 @@ fz_list_clip_image_mask(fz_device *dev, fz_pixmap *image, fz_rect *rect, fz_matr
node->rect = fz_transform_rect(ctm, fz_unit_rect);
if (rect)
node->rect = fz_intersect_rect(node->rect, *rect);
- node->item.image = fz_keep_pixmap(image);
+ node->item.image = fz_keep_pixmap(dev->ctx, image);
fz_append_display_node(dev->user, node);
}