summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-colorspace.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-01-09 16:54:09 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-01-10 16:06:17 +0100
commitbec33a470ea600599d3ad9df472b815e7b46e824 (patch)
tree427f1a799d973a541e122c78207aaf76a7a98141 /source/pdf/pdf-colorspace.c
parentb70eb93f6936c03d8af52040bbca4d4a7db39079 (diff)
downloadmupdf-bec33a470ea600599d3ad9df472b815e7b46e824.tar.xz
Add colorspace type enum and use it instead of hardcoded checks on N.
Diffstat (limited to 'source/pdf/pdf-colorspace.c')
-rw-r--r--source/pdf/pdf-colorspace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index 44105f7b..44615977 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -173,14 +173,17 @@ load_devicen(fz_context *ctx, pdf_obj *array)
pdf_obj *tintobj = pdf_array_get(ctx, array, 3);
fz_colorspace *base;
pdf_function *tint = NULL;
+ char *colorspace_name;
int i, n;
- char *colorspace_name = "DeviceN";
fz_var(tint);
fz_var(devn);
if (pdf_is_array(ctx, nameobj))
+ {
n = pdf_array_len(ctx, nameobj);
+ colorspace_name = "DeviceN";
+ }
else
{
n = 1;
@@ -204,7 +207,7 @@ load_devicen(fz_context *ctx, pdf_obj *array)
devn->base = fz_keep_colorspace(ctx, base); /* We drop it during the devn free... */
devn->tint = tint;
- cs = fz_new_colorspace(ctx, colorspace_name, n, FZ_CS_SUBTRACTIVE | FZ_CS_DEVICE_N,
+ cs = fz_new_colorspace(ctx, colorspace_name, FZ_COLORSPACE_SEPARATION, 0, n,
fz_colorspace_is_icc(ctx, fz_device_rgb(ctx)) ? devicen_to_alt : devicen_to_rgb, NULL, base_devicen, NULL, free_devicen, devn,
sizeof(struct devicen) + base->size + pdf_function_size(ctx, tint));