diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-18 15:49:09 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-01-19 12:40:24 +0000 |
commit | 40f4ed22806b88ba0e26c458915d4695f1f7c201 (patch) | |
tree | bacdebee1932d294f8233a8fb14cb86383e5f107 /fitz/res_pixmap.c | |
parent | 2c836b57d5295b47655988cf8deaffda731e1c3c (diff) | |
download | mupdf-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/res_pixmap.c')
-rw-r--r-- | fitz/res_pixmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c index 008781b4..1998c7fc 100644 --- a/fitz/res_pixmap.c +++ b/fitz/res_pixmap.c @@ -1,9 +1,9 @@ #include "fitz.h" fz_pixmap * -fz_keep_pixmap(fz_pixmap *pix) +fz_keep_pixmap(fz_context *ctx, fz_pixmap *pix) { - return (fz_pixmap *)fz_keep_storable(&pix->storable); + return (fz_pixmap *)fz_keep_storable(ctx, &pix->storable); } void @@ -46,7 +46,7 @@ fz_new_pixmap_with_data(fz_context *ctx, fz_colorspace *colorspace, int w, int h if (colorspace) { - pix->colorspace = fz_keep_colorspace(colorspace); + pix->colorspace = fz_keep_colorspace(ctx, colorspace); pix->n = 1 + colorspace->n; } |