1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## cups-raster-fix-memory-reallocation.dpatch by <till.kamppeter@gmail.com>
4
## All lines beginning with `## DP:' are a description of the patch.
8
diff -urNad ghostscript-8.71.dfsg.1~/cups/gdevcups.c ghostscript-8.71.dfsg.1/cups/gdevcups.c
9
--- ghostscript-8.71.dfsg.1~/cups/gdevcups.c 2010-01-22 18:46:02.000000000 +0100
10
+++ ghostscript-8.71.dfsg.1/cups/gdevcups.c 2010-03-09 17:46:32.415232494 +0100
12
frac k, /* I - Black value */
13
frac *out) /* O - Device colors */
15
- int c0, c1, c2, c3; /* Temporary color values */
17
+ c2 = 0, c3 = 0; /* Temporary color values */
18
float rr, rg, rb, /* Real RGB colors */
19
ciex, ciey, ciez, /* CIE XYZ colors */
20
ciey_yn, /* Normalized luminance */
21
@@ -2703,9 +2704,13 @@
22
int color_set; /* Were the color attrs set? */
23
gdev_prn_space_params sp; /* Space parameter data */
24
int width, /* New width of page */
25
- height; /* New height of page */
26
+ height, /* New height of page */
27
+ colorspace, /* New color space */
28
+ bitspercolor; /* New bits per color */
29
static int width_old = 0, /* Previous width */
30
- height_old = 0; /* Previous height */
31
+ height_old = 0, /* Previous height */
32
+ colorspace_old = 0,/* Previous color space */
33
+ bitspercolor_old = 0;/* Previous bits per color */
34
ppd_attr_t *backside = NULL,
35
*backsiderequiresflippedmargins = NULL;
37
@@ -2800,9 +2805,10 @@
40
dprintf1("DEBUG: Setting %s to", sname); \
41
- for (i = 0; i < count; i ++) \
42
- dprintf1(" %d", (unsigned)(arrayval.data[i])); \
43
- cups->header.name[i] = (unsigned)arrayval.data[i]; \
44
+ for (i = 0; i < count; i ++) { \
45
+ dprintf1(" %d", (unsigned)(arrayval.data[i])); \
46
+ cups->header.name[i] = (unsigned)(arrayval.data[i]); \
51
@@ -3243,23 +3249,31 @@
53
#endif /* CUPS_RASTER_SYNCv1 */
55
+ colorspace = cups->header.cupsColorSpace;
56
+ bitspercolor = cups->header.cupsBitsPerColor;
59
* Don't reallocate memory unless the device has been opened...
60
* Also reallocate only if the size has actually changed...
63
- if (pdev->is_open && (width != width_old || height != height_old))
64
+ if (pdev->is_open &&
65
+ (width != width_old || height != height_old ||
66
+ colorspace != colorspace_old || bitspercolor != bitspercolor_old))
71
+ colorspace_old = colorspace;
72
+ bitspercolor_old = bitspercolor;
75
* Device is open and size has changed, so reallocate...
78
- dprintf4("DEBUG2: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n",
79
- pdev->MediaSize[0], pdev->MediaSize[1], width, height);
80
+ dprintf6("DEBUG2: Reallocating memory, [%.0f %.0f] = %dx%d pixels, color space: %d, bits per color: %d...\n",
81
+ pdev->MediaSize[0], pdev->MediaSize[1], width, height,
82
+ colorspace, bitspercolor);
84
sp = ((gx_device_printer *)pdev)->space_params;