Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2009 19:42:44 GMT
From:      Uwe Krüger <uwe_debbug@arcor.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/135931: ghostscript-8.64 produces empty output for -sDEVICE=bitrgb
Message-ID:  <200906221942.n5MJgimQ004933@www.freebsd.org>
Resent-Message-ID: <200906221950.n5MJo2eP023379@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         135931
>Category:       ports
>Synopsis:       ghostscript-8.64 produces empty output for -sDEVICE=bitrgb
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 22 19:50:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Uwe Krüger
>Release:        8.0-CURRENT-200906
>Organization:
>Environment:
FreeBSD asus.localdomain 8.0-CURRENT-200906 FreeBSD 8.0-CURRENT-200906 #0: Sat Jun 20 01:22:24 CEST 2009     root@eeepc.localdomain:/usr/obj/usr/src/sys/UWE  i386
>Description:
Trying to create a bitrgb-file from a postscript file results in a zero size file. Other bit* devices may also be affected.
>How-To-Repeat:
gs -sDEVICE=bitrgb -DNOPAUSE -dBATCH -sOutputFile=xy.rgb /usr/local/share/ghostscript/8.64/examples/tiger.eps

The size of the file xy.rgb is 0.
>Fix:
The following patch (from mainstream SVN via Debian) fixes the problem

Patch attached with submission follows:

--- base/gdevbit.c.orig
+++ base/gdevbit.c
@@ -653,7 +653,7 @@ bit_put_params(gx_device * pdev, gs_param_list * plist)
 		     pdev->color_info.depth == 32 ? cmyk_8bit_map_cmyk_color :
 		     bit_map_cmyk_color);
     }
-    /* Reset the sparable and linear shift, masks, bits. */
+    /* Reset the separable and linear shift, masks, bits. */
     set_linear_color_bits_mask_shift(pdev);
     pdev->color_info.separable_and_linear = GX_CINFO_SEP_LIN;
     ((gx_device_bit *)pdev)->FirstLine = FirstLine;
@@ -671,16 +671,18 @@ bit_print_page(gx_device_printer * pdev, FILE * prn_stream)
     byte *in = gs_alloc_bytes(pdev->memory, line_size, "bit_print_page(in)");
     byte *data;
     int nul = !strcmp(pdev->fname, "nul") || !strcmp(pdev->fname, "/dev/null");
-    int lnum = ((gx_device_bit *)pdev)->FirstLine;
-    int bottom = ((gx_device_bit *)pdev)->LastLine;
+    int lnum = ((gx_device_bit *)pdev)->FirstLine >= pdev->height ?  pdev->height - 1 :
+		 ((gx_device_bit *)pdev)->FirstLine;
+    int bottom = ((gx_device_bit *)pdev)->LastLine >= pdev->height ?  pdev->height - 1 :
+		 ((gx_device_bit *)pdev)->LastLine;
     int line_count = any_abs(bottom - lnum);
     int i, step = lnum > bottom ? -1 : 1;
 
     if (in == 0)
 	return_error(gs_error_VMerror);
     if ((lnum == 0) && (bottom == 0))
-	bottom = pdev->height - 1;
-    for (i = 0; i < line_count; i++, lnum += step) {
+	line_count = pdev->height - 1;		/* default when LastLine == 0, FirstLine == 0 */
+    for (i = 0; i <= line_count; i++, lnum += step) {
 	gdev_prn_get_bits(pdev, lnum, in, &data);
 	if (!nul)
 	    fwrite(data, 1, line_size, prn_stream);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906221942.n5MJgimQ004933>