summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-21 14:18:08 +0100
committerSam James <sam@gentoo.org>2022-10-02 04:31:25 +0100
commita529111f77ff46f4836fe7312e70953bc16587cf (patch)
tree9dc3924cb1a6ef3ef853b7bb45f735365e0b4e6d /jpeg/wrppm.c
parentImport Ghostscript 9.56.1 (diff)
downloadghostscript-gpl-patches-ghostscript-10.tar.gz
ghostscript-gpl-patches-ghostscript-10.tar.bz2
ghostscript-gpl-patches-ghostscript-10.zip
Import Ghostscript 10.0ghostscript-10.0ghostscript-10
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'jpeg/wrppm.c')
-rw-r--r--jpeg/wrppm.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/jpeg/wrppm.c b/jpeg/wrppm.c
index eb8bdf40..c9e03ad1 100644
--- a/jpeg/wrppm.c
+++ b/jpeg/wrppm.c
@@ -2,7 +2,7 @@
* wrppm.c
*
* Copyright (C) 1991-1996, Thomas G. Lane.
- * Modified 2009-2019 by Guido Vollbeding.
+ * Modified 2009-2020 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -111,7 +111,7 @@ copy_pixel_rows (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
register JSAMPROW ptr;
register JDIMENSION col;
- ptr = dest->pub.buffer[0];
+ ptr = dest->pixrow;
bufferptr = dest->iobuffer;
for (col = dest->samples_per_row; col > 0; col--) {
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(*ptr++));
@@ -138,7 +138,7 @@ put_demapped_rgb (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
register JSAMPROW color_map2 = cinfo->colormap[2];
register JDIMENSION col;
- ptr = dest->pub.buffer[0];
+ ptr = dest->pixrow;
bufferptr = dest->iobuffer;
for (col = cinfo->output_width; col > 0; col--) {
pixval = GETJSAMPLE(*ptr++);
@@ -159,7 +159,7 @@ put_demapped_gray (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo,
register JSAMPROW color_map0 = cinfo->colormap[0];
register JDIMENSION col;
- ptr = dest->pub.buffer[0];
+ ptr = dest->pixrow;
bufferptr = dest->iobuffer;
for (col = cinfo->output_width; col > 0; col--) {
PUTPPMSAMPLE(bufferptr, GETJSAMPLE(color_map0[GETJSAMPLE(*ptr++)]));
@@ -239,10 +239,9 @@ jinit_write_ppm (j_decompress_ptr cinfo)
* that's separate from the physical I/O buffer. We also need a
* separate buffer if pixel format translation must take place.
*/
- dest->pub.buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->output_width * cinfo->output_components, (JDIMENSION) 1);
- dest->pub.buffer_height = 1;
+ dest->pixrow = (JSAMPROW) (*cinfo->mem->alloc_large)
+ ((j_common_ptr) cinfo, JPOOL_IMAGE, (size_t) cinfo->output_width *
+ (size_t) cinfo->output_components * SIZEOF(JSAMPLE));
if (! cinfo->quantize_colors)
dest->pub.put_pixel_rows = copy_pixel_rows;
else if (cinfo->out_color_space == JCS_GRAYSCALE)
@@ -251,13 +250,13 @@ jinit_write_ppm (j_decompress_ptr cinfo)
dest->pub.put_pixel_rows = put_demapped_rgb;
} else {
/* We will fwrite() directly from decompressor output buffer. */
- /* Synthesize a JSAMPARRAY pointer structure */
/* Cast here implies near->far pointer conversion on PCs */
dest->pixrow = (JSAMPROW) dest->iobuffer;
- dest->pub.buffer = & dest->pixrow;
- dest->pub.buffer_height = 1;
dest->pub.put_pixel_rows = put_pixel_rows;
}
+ /* Synthesize a JSAMPARRAY pointer structure */
+ dest->pub.buffer = & dest->pixrow;
+ dest->pub.buffer_height = 1;
return &dest->pub;
}