diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-05-31 18:34:20 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-05-31 18:36:16 +0100 |
commit | 7db12511cd4a7c5e7d367c9f0d510783550c6d7d (patch) | |
tree | dbc31cbabdd6af70b7aac030215e9cf1f96373af /source/pdf | |
parent | 1385f91ef297de29942256f933ca6ce777da59fe (diff) | |
download | mupdf-7db12511cd4a7c5e7d367c9f0d510783550c6d7d.tar.xz |
Bug 696813: Fix Lab colorspaces.
Lab colorspaces had been broken due to incorrect clipping of
color values introduced in an effort to fix Bug 696796.
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-op-run.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index e502cf69..03b45725 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -1136,13 +1136,23 @@ pdf_set_color(fz_context *ctx, pdf_run_processor *pr, int what, float *v) { case PDF_MAT_PATTERN: case PDF_MAT_COLOR: + /* ICC Colorspaces would be handled here too, if we handled them */ if (fz_colorspace_is_indexed(ctx, mat->colorspace)) { mat->v[0] = fz_clamp(v[0], 0, 1) / 255; break; } - for (i = 0; i < mat->colorspace->n; i++) - mat->v[i] = fz_clamp(v[i], 0, 1); + else if (fz_colorspace_is_lab(ctx, mat->colorspace)) + { + /* input is in range (0..100, -128..127, -128..127) not (0..1, 0..1, 0..1) */ + for (i = 0; i < mat->colorspace->n; i++) + mat->v[i] = fz_clamp(v[i], i ? -128 : 0, i ? 127 : 100); + } + else + { + for (i = 0; i < mat->colorspace->n; i++) + mat->v[i] = fz_clamp(v[i], 0, 1); + } break; default: fz_warn(ctx, "color incompatible with material"); |