1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
Index: gs/src/gdevbmp.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevbmp.c,v
retrieving revision 1.10
diff -b -u -r1.10 gdevbmp.c
--- gs/src/gdevbmp.c 20 Sep 2004 22:14:59 -0000 1.10
+++ gs/src/gdevbmp.c 2 Aug 2005 12:02:44 -0000
@@ -147,6 +147,7 @@
if (row == 0) /* can't allocate row buffer */
return_error(gs_error_VMerror);
+ memset(row+raster, 0, bmp_raster - raster); /* clear the padding bytes */
/* Write the file header. */
@@ -174,7 +175,7 @@
bmp_cmyk_print_page(gx_device_printer * pdev, FILE * file)
{
int plane_depth = pdev->color_info.depth / 4;
- uint raster = bitmap_raster(pdev->width * plane_depth);
+ uint raster = (pdev->width * plane_depth + 7) >> 3;
/* BMP scan lines are padded to 32 bits. */
uint bmp_raster = raster + (-(int)raster & 3);
byte *row = gs_alloc_bytes(pdev->memory, bmp_raster, "bmp file buffer");
@@ -184,6 +185,7 @@
if (row == 0) /* can't allocate row buffer */
return_error(gs_error_VMerror);
+ memset(row+raster, 0, bmp_raster - raster); /* clear the padding bytes */
for (plane = 0; plane <= 3; ++plane) {
gx_render_plane_t render_plane;
Index: gs/src/gdevbmpc.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevbmpc.c,v
retrieving revision 1.7
diff -b -u -r1.7 gdevbmpc.c
--- gs/src/gdevbmpc.c 17 Oct 2002 06:09:33 -0000 1.7
+++ gs/src/gdevbmpc.c 2 Aug 2005 12:02:44 -0000
@@ -207,7 +207,7 @@
}
return write_bmp_depth_header(pdev, file, plane_depth,
(const byte *)palette,
- bitmap_raster(pdev->width * plane_depth));
+ (pdev->width*plane_depth + 7) >> 3);
}
/* 24-bit color mappers (taken from gdevmem2.c). */
|