[gs-cvs] rev 9119 - in trunk/ghostpdl: pcl pl

henrys at ghostscript.com henrys at ghostscript.com
Wed Sep 24 18:36:17 PDT 2008


Author: henrys
Date: 2008-09-24 18:36:16 -0700 (Wed, 24 Sep 2008)
New Revision: 9119

Modified:
   trunk/ghostpdl/pcl/pcstate.h
   trunk/ghostpdl/pcl/pctop.c
   trunk/ghostpdl/pcl/rtraster.c
   trunk/ghostpdl/pl/plmain.c
   trunk/ghostpdl/pl/plmain.h
   trunk/ghostpdl/pl/pltop.h
Log:
Support interpolation in pcl with the command line parameter
-dDOINTERPOLATE.  No expected differences.


Modified: trunk/ghostpdl/pcl/pcstate.h
===================================================================
--- trunk/ghostpdl/pcl/pcstate.h	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pcl/pcstate.h	2008-09-25 01:36:16 UTC (rev 9119)
@@ -348,6 +348,9 @@
     /* the current language personality */
     pcl_personality_t personality;
     
+    /* enable image interpolation */
+    bool interpolate;
+
     /* store a pointer to the command definitions for use by macros */
     void *pcl_commands;
     

Modified: trunk/ghostpdl/pcl/pctop.c
===================================================================
--- trunk/ghostpdl/pcl/pctop.c	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pcl/pctop.c	2008-09-25 01:36:16 UTC (rev 9119)
@@ -325,7 +325,7 @@
 /* if the device option string PCL is not given, the default
    arrangement is 1 bit devices use pcl5e other devices use pcl5c. */
 static pcl_personality_t
-pcl_set_personality(pl_interp_instance_t *instance, gx_device *device)
+pcl_get_personality(pl_interp_instance_t *instance, gx_device *device)
 {
     if ( !strcmp(instance->pcl_personality, "PCL5C" ) )
 	return pcl5c;
@@ -339,6 +339,12 @@
 	return pcl5c;
 }
 
+static bool
+pcl_get_interpolation(pl_interp_instance_t *instance)
+{
+    return instance->interpolate;
+}
+
 #include "plmain.h"
 
 /* Set a device into an interperter instance */
@@ -354,9 +360,12 @@
     enum {Sbegin, Ssetdevice, Sinitg, Sgsave1, Spclgsave, Sreset, Serase, Sdone} stage;
 
     stage = Sbegin;
-    /* set personality - pcl5c, pcl5e, or rtl */
-    pcli->pcs.personality = pcl_set_personality(instance, device);
+    /* get ad hoc paramaters personality and interpolation */
+    pcli->pcs.personality = pcl_get_personality(instance, device);
+    pcli->pcs.interpolate = pcl_get_interpolation(instance);
+
     /* Set the device into the pcl_state & gstate */
+
     stage = Ssetdevice;
     if ((code = gs_setdevice_no_erase(pcli->pcs.pgs, device)) < 0)	/* can't erase yet */
         goto pisdEnd;

Modified: trunk/ghostpdl/pcl/rtraster.c
===================================================================
--- trunk/ghostpdl/pcl/rtraster.c	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pcl/rtraster.c	2008-09-25 01:36:16 UTC (rev 9119)
@@ -60,7 +60,7 @@
      uint                indexed:1;          /* != 0 ==> indexed color space */
      uint                zero_is_white:1;    /* all planes 0 ==> white */
      uint                zero_is_black:1;    /* all planes 0 ==> solid color */
- 
+     uint                interpolate:1;      /* enable interpolation */
      int                 wht_indx;           /* white index, for indexed color
                                                 space only */
      const void *        remap_ary;          /* remap array, if needed */
@@ -491,6 +491,11 @@
     if ((prast->indexed) && (prast->wht_indx >= 1 << (nplanes * b_per_p)))
         use_image4 = 0;
 
+    /* we also don't use an image type 4 if the user has requested
+       interpolation */
+    if (prast->interpolate)
+        use_image4 = 0;
+
     if (use_image4)
         gs_image4_t_init( (gs_image4_t *) &image, pcspace);
     else
@@ -506,6 +511,8 @@
     else
         image.i1.BitsPerComponent = (nplanes * b_per_p) / num_comps;
 
+    image.i1.Interpolate = prast->interpolate;
+
     if (prast->indexed) {
 	if (use_image4)
             image.i4.MaskColor[0] = prast->wht_indx;
@@ -1089,6 +1096,8 @@
         prast->transparent = true;
     else
         prast->transparent = false;
+
+    prast->interpolate = pcs->interpolate;
     prast->src_height_set = pcs->raster_state.src_height_set;
     prast->pcs = pcs;
     pcl_cs_indexed_init_from(prast->pindexed, pindexed);

Modified: trunk/ghostpdl/pl/plmain.c
===================================================================
--- trunk/ghostpdl/pl/plmain.c	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pl/plmain.c	2008-09-25 01:36:16 UTC (rev 9119)
@@ -682,8 +682,10 @@
 		universe->curr_device = desired_device;
 	}
 
-	/* NB fix me this parameter should not be passed this way */
+	/* NB fix me, these parameters should not be passed this way */
 	universe->curr_instance->pcl_personality = pti->pcl_personality;
+	universe->curr_instance->interpolate = pti->interpolate;
+
 	/* Select curr/new device into PDL instance */
 	if ( pl_set_device(universe->curr_instance, universe->curr_device) < 0 ) {
 	    if (err_str)
@@ -742,6 +744,7 @@
     pti->page_count = 0;
     pti->saved_hwres = false;
     pti->mem_cleanup = true;
+    pti->interpolate = false;
     strncpy(&pti->pcl_personality[0], "PCL", sizeof(pti->pcl_personality)-1);
 }
 
@@ -835,6 +838,11 @@
 		pmi->pause = false;
 		continue;
 	    }
+            if ( !strcmp(arg, "DOINTERPOLATE") ) {
+                pmi->interpolate = true;
+                continue;
+            }
+
 	    { 
 		/* We're setting a device parameter to a non-string value. */
 		char *eqp = strchr(arg, '=');

Modified: trunk/ghostpdl/pl/plmain.h
===================================================================
--- trunk/ghostpdl/pl/plmain.h	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pl/plmain.h	2008-09-25 01:36:16 UTC (rev 9119)
@@ -53,6 +53,7 @@
     char pcl_personality[6];      /* a character string to set pcl's
                                      personality - rtl, pcl5c, pcl5e, and
                                      pcl == default.  NB doesn't belong here. */
+    bool interpolate;
 
 } pl_main_instance_t;
 

Modified: trunk/ghostpdl/pl/pltop.h
===================================================================
--- trunk/ghostpdl/pl/pltop.h	2008-09-24 11:07:46 UTC (rev 9118)
+++ trunk/ghostpdl/pl/pltop.h	2008-09-25 01:36:16 UTC (rev 9119)
@@ -37,9 +37,10 @@
 } pl_interp_t;
 
 typedef struct pl_interp_instance_s {
-	pl_interp_t     *interp;            /* interpreter instance refers to */
-	vm_spaces       spaces;             /* spaces for GC */
-        char *          pcl_personality;
+    pl_interp_t     *interp;            /* interpreter instance refers to */
+    vm_spaces       spaces;             /* spaces for GC */
+    char *          pcl_personality;
+    bool            interpolate;
 } pl_interp_instance_t;
 
 /* Param data types */



More information about the gs-cvs mailing list