[gs-cvs] rev 8202 - branches/gs-ghostpdl-1.50/src
giles at ghostscript.com
giles at ghostscript.com
Fri Aug 24 09:46:38 PDT 2007
Author: giles
Date: 2007-08-24 09:46:38 -0700 (Fri, 24 Aug 2007)
New Revision: 8202
Modified:
branches/gs-ghostpdl-1.50/src/gdevimdi.c
branches/gs-ghostpdl-1.50/src/gdevwts.c
Log:
Change the path to the icc link profile to the current working
directory, the same path used for the wts_* halftone files and
for link.icc in gdevimdi.c.
Throw an diagnostic error if the wts_plane_* halftone files cannot
be opened. Propagate the error and clean up properly to avoid a
segfault.
Also #ifdef DEBUG protects some debug printouts to reduce noise.
These changes correspond to r8188 and r8189 from trunk.
Modified: branches/gs-ghostpdl-1.50/src/gdevimdi.c
===================================================================
--- branches/gs-ghostpdl-1.50/src/gdevimdi.c 2007-08-23 18:00:19 UTC (rev 8201)
+++ branches/gs-ghostpdl-1.50/src/gdevimdi.c 2007-08-24 16:46:38 UTC (rev 8202)
@@ -138,10 +138,12 @@
luo->spaces(luo, &ins, &inn, &outs, &outn, &alg, NULL, NULL, NULL);
+#ifdef DEBUG
dprintf3("%s -> %s [%s]\n",
icm2str(icmColorSpaceSignature, ins),
icm2str(icmColorSpaceSignature, outs),
icm2str(icmLuAlg, alg));
+#endif
if (inn != 3)
return gs_throw1(-1, "profile must have 3 input channels. got %d.", inn);
Modified: branches/gs-ghostpdl-1.50/src/gdevwts.c
===================================================================
--- branches/gs-ghostpdl-1.50/src/gdevwts.c 2007-08-23 18:00:19 UTC (rev 8201)
+++ branches/gs-ghostpdl-1.50/src/gdevwts.c 2007-08-24 16:46:38 UTC (rev 8202)
@@ -17,7 +17,7 @@
/* $Id$ */
/* ALPHA: Sample Device that provides WTS screening and IMDI color management */
/* TODO: this should be configurable */
-#define LINK_ICC_NAME "../../link.icc"
+#define LINK_ICC_NAME "link.icc"
#include "errno_.h"
#include "string_.h"
@@ -343,7 +343,7 @@
sprintf(wts_fn, "wts_plane_%d", i);
code = wts_load_halftone(wdev->memory, &wdev->wcooked[i], wts_fn);
if (code < 0)
- return code;
+ return gs_throw1(code, "could not open file '%s'", wts_fn);
}
}
return 0;
@@ -367,7 +367,8 @@
int i, unused_color_cache_slots;
/* Initialize the wts halftones. */
- wts_init_halftones(wdev, n_planes);
+ code = wts_init_halftones(wdev, n_planes);
+ if (code < 0) goto out;
cmyk_line = (byte *)gs_malloc(pdev->memory, cmyk_bytes, 1, "wtscmyk_print_page(in)");
if (cmyk_line == 0) {
@@ -511,10 +512,12 @@
luo->spaces(luo, &ins, &inn, &outs, &outn, &alg, NULL, NULL, NULL);
+#ifdef DEBUG
dprintf3("%s -> %s [%s]\n",
icm2str(icmColorSpaceSignature, ins),
icm2str(icmColorSpaceSignature, outs),
icm2str(icmLuAlg, alg));
+#endif
if (inn != 3)
return gs_throw1(-1, "profile must have 3 input channels. got %d.", inn);
@@ -1062,7 +1065,7 @@
gx_device_wtsimdi *idev = (gx_device_wtsimdi*)pdev;
int n_planes = 4;
byte * halftoned_data;
- byte * halftoned_buffer;
+ byte * halftoned_buffer = NULL;
int halftoned_bytes, y;
int i, code = 0;
int unused_color_cache_slots;
@@ -1081,7 +1084,8 @@
/*
* Initialize the WTS halftones.
*/
- wts_init_halftones((gx_device_wts *)idev, n_planes);
+ code = wts_init_halftones((gx_device_wts *)idev, n_planes);
+ if (code < 0) goto cleanup;
/*
* Allocate a buffer to hold the halftoned data. This is 1 bit per
@@ -1126,20 +1130,24 @@
write_pkmraw_row(width, halftoned_data, prn_stream);
}
cleanup:
+ if (idev->color_cache != NULL) {
#ifdef DEBUG
- for (i=0,unused_color_cache_slots=0; i<COLOR_CACHE_SIZE; i++)
+ for (i=0,unused_color_cache_slots=0; i<COLOR_CACHE_SIZE; i++)
if (idev->color_cache[i].color_index == gx_no_color_index)
unused_color_cache_slots++;
- if_debug5(':',"wtsimdi_print_page color cache stats: current=%ld, hits=%ld,"
- " collisions=%ld, fill=%ld, unused_slots=%d\n",
- idev->color_is_current, idev->color_cache_hit, idev->color_cache_collision,
- idev->cache_fill_empty, unused_color_cache_slots);
+ if_debug5(':',"wtsimdi_print_page color cache stats:"
+ " current=%ld, hits=%ld,"
+ " collisions=%ld, fill=%ld, unused_slots=%d\n",
+ idev->color_is_current, idev->color_cache_hit,
+ idev->color_cache_collision, idev->cache_fill_empty,
+ unused_color_cache_slots);
#endif
- gs_free(pdev->memory, idev->color_cache, COLOR_CACHE_SIZE, sizeof(cached_color),
- "wtscmyk_print_page(color_cache)");
+ gs_free(pdev->memory, idev->color_cache, COLOR_CACHE_SIZE,
+ sizeof(cached_color), "wtscmyk_print_page(color_cache)");
+ }
if (halftoned_buffer != NULL)
gs_free(pdev->memory, halftoned_buffer, halftoned_bytes * n_planes, 1,
"wtsimdi_print_page(halftoned_buffer)");
set_dev_proc(pdev, get_bits, save_get_bits);
- return 0;
+ return code;
}
More information about the gs-cvs
mailing list