diff options
-rw-r--r-- | source/pdf/pdf-op-filter.c | 4 | ||||
-rw-r--r-- | source/pdf/pdf-op-run.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c index a8496e35..8eebe5cd 100644 --- a/source/pdf/pdf-op-filter.c +++ b/source/pdf/pdf-op-filter.c @@ -929,7 +929,7 @@ pdf_filter_SC_color(fz_context *ctx, pdf_processor *proc, int n, float *color) gstate->SC.shd = NULL; gstate->SC.n = n; for (i = 0; i < n; ++i) - gstate->SC.c[i] = color[i]; + gstate->SC.c[i] = fz_clamp(color[i], 0, 1); } static void @@ -943,7 +943,7 @@ pdf_filter_sc_color(fz_context *ctx, pdf_processor *proc, int n, float *color) gstate->sc.shd = NULL; gstate->sc.n = n; for (i = 0; i < n; ++i) - gstate->sc.c[i] = color[i]; + gstate->sc.c[i] = fz_clamp(color[i], 0, 1); } static void diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 012b5054..e502cf69 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -1138,11 +1138,11 @@ pdf_set_color(fz_context *ctx, pdf_run_processor *pr, int what, float *v) case PDF_MAT_COLOR: if (fz_colorspace_is_indexed(ctx, mat->colorspace)) { - mat->v[0] = v[0] / 255; + mat->v[0] = fz_clamp(v[0], 0, 1) / 255; break; } for (i = 0; i < mat->colorspace->n; i++) - mat->v[i] = v[i]; + mat->v[i] = fz_clamp(v[i], 0, 1); break; default: fz_warn(ctx, "color incompatible with material"); |