summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2013-08-30 22:09:27 +0200
committerRobin Watts <robin.watts@artifex.com>2013-09-10 14:09:03 +0100
commit6904674fceaa8b289ef70b692ffa2aa7f7afb726 (patch)
treeac376ea8970e8feee8344b1cf1a3c219cf5f5500
parentef983195f1c593f8aa01a484cd2e9b26ce7923ae (diff)
downloadmupdf-6904674fceaa8b289ef70b692ffa2aa7f7afb726.tar.xz
correctly set indexed colors in pdf_set_color
Required for 1879_-_Indexed_colors_wrongly_converted.pdf Also, removing broken code in the same place (where mat->v[] is overwritten right after being set in the L*a*b* case).
-rw-r--r--source/pdf/pdf-image.c6
-rw-r--r--source/pdf/pdf-interpret.c7
2 files changed, 5 insertions, 8 deletions
diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c
index 10ae89ff..ef93d96b 100644
--- a/source/pdf/pdf-image.c
+++ b/source/pdf/pdf-image.c
@@ -85,9 +85,7 @@ pdf_load_image_imp(pdf_document *doc, pdf_obj *rdb, pdf_obj *dict, fz_stream *cs
}
colorspace = pdf_load_colorspace(doc, obj);
-
- if (!strcmp(colorspace->name, "Indexed"))
- indexed = 1;
+ indexed = fz_colorspace_is_indexed(colorspace);
n = colorspace->n;
}
@@ -219,7 +217,7 @@ pdf_load_jpx(pdf_document *doc, pdf_obj *dict, int forcemask)
if (obj)
{
colorspace = pdf_load_colorspace(doc, obj);
- indexed = !strcmp(colorspace->name, "Indexed");
+ indexed = fz_colorspace_is_indexed(colorspace);
}
img = fz_load_jpx(ctx, buf->data, buf->len, colorspace, indexed);
diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c
index 9de4c833..b498d54d 100644
--- a/source/pdf/pdf-interpret.c
+++ b/source/pdf/pdf-interpret.c
@@ -1270,11 +1270,10 @@ pdf_set_color(pdf_csi *csi, int what, float *v)
{
case PDF_MAT_PATTERN:
case PDF_MAT_COLOR:
- if (!strcmp(mat->colorspace->name, "Lab"))
+ if (fz_colorspace_is_indexed(mat->colorspace))
{
- mat->v[0] = v[0] / 100;
- mat->v[1] = (v[1] + 100) / 200;
- mat->v[2] = (v[2] + 100) / 200;
+ mat->v[0] = v[0] / 255;
+ break;
}
for (i = 0; i < mat->colorspace->n; i++)
mat->v[i] = v[i];