[gs-cvs] rev 8632 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Apr 9 22:43:44 PDT 2008
Author: leonardo
Date: 2008-04-09 22:43:43 -0700 (Wed, 09 Apr 2008)
New Revision: 8632
Modified:
trunk/gs/src/gsptype1.c
trunk/gs/src/gxcht.c
trunk/gs/src/gxclpath.c
trunk/gs/src/gxclrast.c
trunk/gs/src/gxdcolor.c
trunk/gs/src/gxdcolor.h
trunk/gs/src/gxht.c
trunk/gs/src/gxwts.c
Log:
Enhancement (graphics) : Generalize prototypes of color serialization methods for big color data.
DETAILS :
This is a preparation for fixing
the bug 689440 "PostScript file generates infinitely large temp file".
The old serialization methods assume that color data can fit into a small buffer.
Now we want to drop this constraint to allow to write big patterns into clist.
See comment in code for details.
This change is algorithmically equivalent.
This patch adds a new argument to color serialization methods.
For a while the new actual parameter is always 0,
and the (untrivial) methods check for it.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gsptype1.c
===================================================================
--- trunk/gs/src/gsptype1.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gsptype1.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -1228,6 +1228,7 @@
const gx_device_color * pdevc,
const gx_device_color_saved * psdc,
const gx_device * dev,
+ uint offset,
byte * data,
uint * psize )
{
@@ -1240,6 +1241,7 @@
const gs_imager_state * pis,
const gx_device_color * prior_devc,
const gx_device * dev,
+ uint offset,
const byte * data,
uint size,
gs_memory_t * mem )
Modified: trunk/gs/src/gxcht.c
===================================================================
--- trunk/gs/src/gxcht.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxcht.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -185,6 +185,7 @@
const gx_device_color * pdevc,
const gx_device_color_saved * psdc0,
const gx_device * dev,
+ uint offset,
byte * pdata,
uint * psize )
{
@@ -197,6 +198,9 @@
const gx_device_color_saved * psdc = psdc0;
byte * pdata0 = pdata;
+ if (offset != 0)
+ return_error(gs_error_unregistered); /* Not implemented yet. */
+
/* sanity check */
if (pdevc->colors.colored.num_components != num_comps)
return_error(gs_error_unregistered); /* Must not happen. */
@@ -350,6 +354,7 @@
const gs_imager_state * pis,
const gx_device_color * prior_devc,
const gx_device * dev,
+ uint offset,
const byte * pdata,
uint size,
gs_memory_t * mem ) /* ignored */
@@ -360,6 +365,9 @@
const byte * pdata0 = pdata;
int flag_bits;
+ if (offset != 0)
+ return_error(gs_error_unregistered); /* Not implemented yet. */
+
/* if prior information is available, use it */
if (prior_devc != 0 && prior_devc->type == gx_dc_type_ht_colored)
devc = *prior_devc;
Modified: trunk/gs/src/gxclpath.c
===================================================================
--- trunk/gs/src/gxclpath.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxclpath.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -127,6 +127,7 @@
code = pdcolor->type->write( pdcolor,
psdc,
(gx_device *)cldev,
+ 0,
0,
&dc_size );
@@ -162,6 +163,7 @@
code = pdcolor->type->write( pdcolor,
&pcls->sdc,
(gx_device *)cldev,
+ 0,
dp,
&dc_size );
if (code < 0) {
Modified: trunk/gs/src/gxclrast.c
===================================================================
--- trunk/gs/src/gxclrast.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxclrast.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -1621,7 +1621,7 @@
return code;
}
code = pdct->read(&dev_color, &imager_state,
- &dev_color, tdev, cbp,
+ &dev_color, tdev, 0, cbp,
color_size, mem);
if (code < 0)
goto out;
Modified: trunk/gs/src/gxdcolor.c
===================================================================
--- trunk/gs/src/gxdcolor.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxdcolor.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -280,6 +280,7 @@
const gx_device_color * pdevc, /* ignored */
const gx_device_color_saved * psdc, /* ignored */
const gx_device * dev, /* ignored */
+ uint offset, /* ignored */
byte * data, /* ignored */
uint * psize )
{
@@ -293,6 +294,7 @@
const gs_imager_state * pis, /* ignored */
const gx_device_color * prior_devc, /* ignored */
const gx_device * dev, /* ignored */
+ uint offset, /* ignored */
const byte * pdata, /* ignored */
uint size, /* ignored */
gs_memory_t * mem ) /* ignored */
@@ -349,6 +351,7 @@
const gs_imager_state * pis, /* ignored */
const gx_device_color * prior_devc, /* ignored */
const gx_device * dev, /* ignored */
+ uint offset, /* ignored */
const byte * pdata, /* ignored */
uint size, /* ignored */
gs_memory_t * mem ) /* ignored */
@@ -475,6 +478,7 @@
const gx_device_color * pdevc,
const gx_device_color_saved * psdc, /* ignored */
const gx_device * dev,
+ uint offset, /* ignored */
byte * pdata,
uint * psize )
{
@@ -522,6 +526,7 @@
const gs_imager_state * pis, /* ignored */
const gx_device_color * prior_devc, /* ignored */
const gx_device * dev,
+ uint offset, /* ignored */
const byte * pdata,
uint size,
gs_memory_t * mem ) /* ignored */
Modified: trunk/gs/src/gxdcolor.h
===================================================================
--- trunk/gs/src/gxdcolor.h 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxdcolor.h 2008-04-10 05:43:43 UTC (rev 8632)
@@ -149,19 +149,27 @@
/*
* Serialize and deserialize a device color.
*
- * The "write" routine converts a device color into a string for
+ * The "write" routine converts a device color into a stream for
* writing to the command list. *psize is the amount of space
* available. If the saved color and the current color are the same,
* the routine sets *psize to 0 and returns 1. Otherwise, if *psize
* is large enough, the procedure sets *psize to the amount actually
- * used and returns 0. If *psize is too small and no other problem
+ * used and returns 0. If *psize is zero and no other problem
* is detected, *psize is set to the amount required and
- * gs_error_rangecheck is returned. If some other error is detected,
- * *psize is left unchanged and the error code is returned.
+ * gs_error_rangecheck is returned. If *psize is not zero,
+ * a data block is written into the buffer, and the function returns 0.
+ * Note the function always fills entire buffer of *psize length,
+ * except for the last block of the stream, which is written until
+ * the stream end. If some other error is detected, *psize is left unchanged
+ * and the error code is returned. When *psize is not zero,
+ * the offset operand specifies the position of the block in the stream.
*
- * The "read" routine converts the string representation back into
+ * The "read" routine converts the stream representation back into
* the full device color structure. The value returned is the number
* of bytes actually read, or < 0 in the event of an error.
+ * The offset operand specifies the position of the block in the stream.
+ * If the returned block length is smaller than *psize,
+ * then there is no more data in the stream.
*
* As with any instance of virtual serialization, the command list
* code must include its own identifier of the color space type in
@@ -190,7 +198,7 @@
* changed, so informaition from the prior device color will no
* longer be available.
*
- * For the read and method, the imager state is passed as an operand,
+ * For the read method, the imager state is passed as an operand,
* which allows the routine to access the current device halftone
* (always required). Also passed in a pointer to the existing device
* color, as this is not part of the imager state. If the writer was
@@ -207,12 +215,12 @@
*/
#define dev_color_proc_write(proc)\
int proc(const gx_device_color *pdevc, const gx_device_color_saved *psdc,\
- const gx_device * dev, byte *data, uint *psize)
+ const gx_device * dev, uint offset, byte *data, uint *psize)
dev_color_proc_write((*write));
#define dev_color_proc_read(proc)\
int proc(gx_device_color *pdevc, const gs_imager_state * pis,\
- const gx_device_color *prior_devc, const gx_device * dev,\
+ const gx_device_color *prior_devc, const gx_device * dev, uint offset,\
const byte *data, uint size, gs_memory_t *mem)
dev_color_proc_read((*read));
Modified: trunk/gs/src/gxht.c
===================================================================
--- trunk/gs/src/gxht.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxht.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -452,6 +452,7 @@
const gx_device_color * pdevc,
const gx_device_color_saved * psdc0,
const gx_device * dev,
+ uint offset,
byte * pdata,
uint * psize )
{
@@ -462,6 +463,9 @@
const gx_device_color_saved * psdc = psdc0;
int code;
+ if (offset != 0)
+ return_error(gs_error_unregistered); /* Not implemented yet. */
+
/* check if operand and saved colors are the same type */
if (psdc != 0 && psdc->type != pdevc->type)
psdc = 0;
@@ -581,6 +585,7 @@
const gs_imager_state * pis,
const gx_device_color * prior_devc,
const gx_device * dev, /* ignored */
+ uint offset,
const byte * pdata,
uint size,
gs_memory_t * mem ) /* ignored */
@@ -589,6 +594,9 @@
const byte * pdata0 = pdata;
int code, flag_bits;
+ if (offset != 0)
+ return_error(gs_error_unregistered); /* Not implemented yet. */
+
/* if prior information is available, use it */
if (prior_devc != 0 && prior_devc->type == gx_dc_type_ht_binary)
devc = *prior_devc;
Modified: trunk/gs/src/gxwts.c
===================================================================
--- trunk/gs/src/gxwts.c 2008-04-09 15:28:45 UTC (rev 8631)
+++ trunk/gs/src/gxwts.c 2008-04-10 05:43:43 UTC (rev 8632)
@@ -417,6 +417,7 @@
const gx_device_color * pdevc,
const gx_device_color_saved * psdc,
const gx_device * dev,
+ uint offset,
byte * pdata,
uint * psize )
{
@@ -430,6 +431,7 @@
const gs_imager_state * pis,
const gx_device_color * prior_devc,
const gx_device * dev,
+ uint offset,
const byte * pdata,
uint size,
gs_memory_t * mem )
More information about the gs-cvs
mailing list