summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-03-09 14:39:10 -0600
committerRobin Watts <Robin.Watts@artifex.com>2017-03-11 10:16:57 -0600
commit2284a7eae8f13c181eb5e9f50ada3f4dbca42269 (patch)
treee572e3a8a7a8e8651066c70683cdf2eb1f26d8fe /source
parent49b6c0f132ec4624e50cd79660143624dd1fcd35 (diff)
downloadmupdf-2284a7eae8f13c181eb5e9f50ada3f4dbca42269.tar.xz
Fix PS image output.
Appears to have been broken since alphas were optional.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/output-ps.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
index daf0804c..915dc222 100644
--- a/source/fitz/output-ps.c
+++ b/source/fitz/output-ps.c
@@ -80,13 +80,13 @@ ps_write_header(fz_context *ctx, fz_band_writer *writer_)
fz_printf(ctx, out, "/DataFile currentfile /FlateDecode filter def\n\n");
switch(n)
{
- case 2:
+ case 1:
fz_printf(ctx, out, "/DeviceGray setcolorspace\n");
break;
- case 4:
+ case 3:
fz_printf(ctx, out, "/DeviceRGB setcolorspace\n");
break;
- case 5:
+ case 4:
fz_printf(ctx, out, "/DeviceCMYK setcolorspace\n");
break;
default:
@@ -192,7 +192,7 @@ ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_sta
if (band_start+band_height >= h)
band_height = h - band_start;
- required_input = w*(n-1)*band_height;
+ required_input = w*n*band_height;
required_output = (int)deflateBound(&writer->stream, required_input);
if (writer->input == NULL || writer->input_size < required_input)
@@ -216,9 +216,8 @@ ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_sta
{
for (x = 0; x < w; x++)
{
- for (i = n-1; i > 0; i--)
+ for (i = n; i > 0; i--)
*o++ = *samples++;
- samples++;
}
samples += stride - w*n;
}
@@ -237,12 +236,12 @@ ps_write_band(fz_context *ctx, fz_band_writer *writer_, int stride, int band_sta
fz_band_writer *fz_new_ps_band_writer(fz_context *ctx, fz_output *out)
{
- fz_band_writer *writer = fz_new_band_writer(ctx, fz_band_writer, out);
+ ps_band_writer *writer = fz_new_band_writer(ctx, ps_band_writer, out);
- writer->header = ps_write_header;
- writer->band = ps_write_band;
- writer->trailer = ps_write_trailer;
- writer->drop = ps_drop_band_writer;
+ writer->super.header = ps_write_header;
+ writer->super.band = ps_write_band;
+ writer->super.trailer = ps_write_trailer;
+ writer->super.drop = ps_drop_band_writer;
- return writer;
+ return &writer->super;
}