[cairo-commit] src/cairo-ps-surface.c
Adrian Johnson
ajohnson at kemper.freedesktop.org
Thu Feb 2 04:34:53 PST 2012
src/cairo-ps-surface.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
New commits:
commit 477bcd89d716be372ebecc2b89381f4d9745f5e2
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Thu Feb 2 22:58:06 2012 +1030
ps: ensure shading domain is [ 0 1 ]
Printing to a printer with an Adobe PostScript 3 interpreter fails
with rangecheck when the shading domain is not [ 0 1 ]. Workaround
this by using a type 3 function to map from [ 0 1] to the required
domain.
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f20bd4f..62b7d64 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3722,10 +3722,6 @@ _cairo_ps_surface_emit_gradient (cairo_ps_surface_t *surface,
MAX (end.radius, 0));
}
- _cairo_output_stream_printf (surface->stream,
- " /Domain [ %f %f ]\n",
- domain[0], domain[1]);
-
if (pattern->base.extend != CAIRO_EXTEND_NONE) {
_cairo_output_stream_printf (surface->stream,
" /Extend [ true true ]\n");
@@ -3734,8 +3730,22 @@ _cairo_ps_surface_emit_gradient (cairo_ps_surface_t *surface,
" /Extend [ false false ]\n");
}
+ if (domain[0] == 0.0 && domain[1] == 1.0) {
+ _cairo_output_stream_printf (surface->stream,
+ " /Function CairoFunction\n");
+ } else {
+ _cairo_output_stream_printf (surface->stream,
+ " /Function <<\n"
+ " /FunctionType 3\n"
+ " /Domain [ 0 1 ]\n"
+ " /Bounds [ ]\n"
+ " /Encode [ %f %f ]\n"
+ " /Functions [ CairoFunction ]\n"
+ " >>\n",
+ domain[0], domain[1]);
+ }
+
_cairo_output_stream_printf (surface->stream,
- " /Function CairoFunction\n"
" >>\n");
if (is_ps_pattern) {
More information about the cairo-commit
mailing list