diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2013-05-16 22:29:27 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-05-16 23:47:14 +0100 |
commit | 93bd1ff05bf315ed11b305d32eb510bd9a9a7e92 (patch) | |
tree | 10c2d846ed1193624a5119853bbc2ef9651e197c /pdf/pdf_colorspace.c | |
parent | 558ad511446cfa1d70891d9e7c9fb1ba942d3d9a (diff) | |
download | mupdf-93bd1ff05bf315ed11b305d32eb510bd9a9a7e92.tar.xz |
Add colorspace context.
To prepare for color management, we have to make the device colorspaces
per-context and able to be overridden by users.
Diffstat (limited to 'pdf/pdf_colorspace.c')
-rw-r--r-- | pdf/pdf_colorspace.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c index a398b44f..21d67eeb 100644 --- a/pdf/pdf_colorspace.c +++ b/pdf/pdf_colorspace.c @@ -12,9 +12,9 @@ load_icc_based(pdf_document *xref, pdf_obj *dict) switch (n) { - case 1: return fz_device_gray; - case 3: return fz_device_rgb; - case 4: return fz_device_cmyk; + case 1: return fz_device_gray(xref->ctx); + case 3: return fz_device_rgb(xref->ctx); + case 4: return fz_device_cmyk(xref->ctx); } fz_throw(xref->ctx, "syntaxerror: ICCBased must have 1, 3 or 4 components"); @@ -224,19 +224,19 @@ pdf_load_colorspace_imp(pdf_document *xref, pdf_obj *obj) { const char *str = pdf_to_name(obj); if (!strcmp(str, "Pattern")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "G")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "RGB")) - return fz_device_rgb; + return fz_device_rgb(ctx); else if (!strcmp(str, "CMYK")) - return fz_device_cmyk; + return fz_device_cmyk(ctx); else if (!strcmp(str, "DeviceGray")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "DeviceRGB")) - return fz_device_rgb; + return fz_device_rgb(ctx); else if (!strcmp(str, "DeviceCMYK")) - return fz_device_cmyk; + return fz_device_cmyk(ctx); else fz_throw(ctx, "unknown colorspace: %s", pdf_to_name(obj)); } @@ -250,23 +250,23 @@ pdf_load_colorspace_imp(pdf_document *xref, pdf_obj *obj) { /* load base colorspace instead */ if (!strcmp(str, "G")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "RGB")) - return fz_device_rgb; + return fz_device_rgb(ctx); else if (!strcmp(str, "CMYK")) - return fz_device_cmyk; + return fz_device_cmyk(ctx); else if (!strcmp(str, "DeviceGray")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "DeviceRGB")) - return fz_device_rgb; + return fz_device_rgb(ctx); else if (!strcmp(str, "DeviceCMYK")) - return fz_device_cmyk; + return fz_device_cmyk(ctx); else if (!strcmp(str, "CalGray")) - return fz_device_gray; + return fz_device_gray(ctx); else if (!strcmp(str, "CalRGB")) - return fz_device_rgb; + return fz_device_rgb(ctx); else if (!strcmp(str, "CalCMYK")) - return fz_device_cmyk; + return fz_device_cmyk(ctx); else if (!strcmp(str, "Lab")) return fz_device_lab; else @@ -295,7 +295,7 @@ pdf_load_colorspace_imp(pdf_document *xref, pdf_obj *obj) pobj = pdf_array_get(obj, 1); if (!pobj) { - cs = fz_device_gray; + cs = fz_device_gray(ctx); break; } |