[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-2050-gdb04633
[email protected] (Robin Watts) Mon, 6 Jan 2020 12:58:16 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via db046332dab8a9066dfb4886ca05d4e08f28efcb (commit)
from 1085ead1dd22e3908c341df160a722e71a9c7cfe (commit)
----------------------------------------------------------------------
commit db046332dab8a9066dfb4886ca05d4e08f28efcb
Author: Robin Watts <[email protected]>
Date: Mon Jan 6 12:56:52 2020 +0000
Bug 702018: Fix CAL build crash in tiffsep1.
The SSE code for CAL currently only copes with a maximum of 4
planes. Ensure the device falls back to non-CAL code in such
cases.
diff --git a/devices/gdevtsep.c b/devices/gdevtsep.c
index 6d301b2..ff67c80 100644
--- a/devices/gdevtsep.c
+++ b/devices/gdevtsep.c
@@ -2742,6 +2742,7 @@ tiffsep1_print_page(gx_device_printer * pdev, gp_file * file)
int pixel, y;
gs_get_bits_params_t params;
gs_int_rect rect;
+ uint32_t *dithered_line = NULL;
#ifdef WITH_CAL
cal_context *cal = pdev->memory->gs_lib_ctx->core->cal_ctx;
@@ -2760,29 +2761,23 @@ tiffsep1_print_page(gx_device_printer * pdev, gp_file * file)
pdev->width,
pdev->height,
0);
- if (cal_ht == NULL) {
- code = gs_error_VMerror;
- goto done;
- }
-
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- if (cal_halftone_add_screen(cal,
- pdev->memory->non_gc_memory,
- cal_ht,
- 0,
- tfdev->thresholds[comp_num].dwidth,
- tfdev->thresholds[comp_num].dheight,
- 0,
- 0,
- tfdev->thresholds[comp_num].dstart) < 0) {
- goto cal_fail;
- }
- }
-#else
+ if (cal_ht != NULL) {
+ for (comp_num = 0; comp_num < num_comp; comp_num++)
+ if (cal_halftone_add_screen(cal,
+ pdev->memory->non_gc_memory,
+ cal_ht,
+ 0,
+ tfdev->thresholds[comp_num].dwidth,
+ tfdev->thresholds[comp_num].dheight,
+ 0,
+ 0,
+ tfdev->thresholds[comp_num].dstart) < 0)
+ goto cal_fail;
+ } else
+#endif
/* the dithered_line is assumed to be 32-bit aligned by the alloc */
- uint32_t *dithered_line = (uint32_t *)gs_alloc_bytes(pdev->memory, dithered_raster,
+ dithered_line = (uint32_t *)gs_alloc_bytes(pdev->memory, dithered_raster,
"tiffsep1_print_page");
-#endif
memset(planes, 0, sizeof(*planes) * GS_CLIENT_COLOR_MAX_COMPONENTS);
@@ -2803,11 +2798,7 @@ tiffsep1_print_page(gx_device_printer * pdev, gp_file * file)
}
}
- if (code < 0
-#ifndef WITH_CAL
- || dithered_line == NULL
-#endif
- ) {
+ if (code < 0 || (cal_ht == NULL && dithered_line == NULL)) {
code = gs_note_error(gs_error_VMerror);
goto cleanup;
}
@@ -2829,13 +2820,15 @@ tiffsep1_print_page(gx_device_printer * pdev, gp_file * file)
break;
#ifdef WITH_CAL
- if (cal_halftone_process_planar(cal_ht,
- pdev->memory->non_gc_memory,
- ¶ms.data[0],
- ht_callback,
- tfdev) < 0)
- goto cal_fail;
-#else
+ if(cal_ht != NULL) {
+ if (cal_halftone_process_planar(cal_ht,
+ pdev->memory->non_gc_memory,
+ ¶ms.data[0],
+ ht_callback,
+ tfdev) < 0)
+ goto cal_fail;
+ } else
+#endif
/* Dither the separation and write it out */
for (comp_num = 0; comp_num < num_comp; comp_num++ ) {
@@ -2902,7 +2895,6 @@ tiffsep1_print_page(gx_device_printer * pdev, gp_file * file)
#endif /* SKIP_HALFTONING_FOR_TIMING */
TIFFWriteScanline(tfdev->tiff[comp_num], (tdata_t)dithered_line, y, 0);
} /* end component loop */
-#endif
}
/* Update the strip data */
for (comp_num = 0; comp_num < num_comp; comp_num++ ) {
@@ -2935,9 +2927,7 @@ cal_fail:
/* free any allocations and exit with code */
cleanup:
-#ifndef WITH_CAL
gs_free_object(pdev->memory, dithered_line, "tiffsep1_print_page");
-#endif
for (comp_num = 0; comp_num < num_comp; comp_num++) {
gs_free_object(pdev->memory, planes[comp_num], "tiffsep1_print_page");
}
Summary of changes:
devices/gdevtsep.c | 62 +++++++++++++++++++++++-------------------------------
1 file changed, 26 insertions(+), 36 deletions(-)