summaryrefslogtreecommitdiff
path: root/gs/psi/zupath.c
diff options
context:
space:
mode:
Diffstat (limited to 'gs/psi/zupath.c')
-rw-r--r--gs/psi/zupath.c600
1 files changed, 299 insertions, 301 deletions
diff --git a/gs/psi/zupath.c b/gs/psi/zupath.c
index a3d1757da..89691341a 100644
--- a/gs/psi/zupath.c
+++ b/gs/psi/zupath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -117,19 +117,19 @@ zinustroke(i_ctx_t *i_ctx_p)
gx_device hdev;
if (code < 0)
- return code;
+ return code;
if ((spop = upath_stroke(i_ctx_p, &mat, false)) < 0) {
- gs_grestore(igs);
- return spop;
+ gs_grestore(igs);
+ return spop;
}
if ((npop = in_path(op - spop, i_ctx_p, &hdev)) < 0) {
- gs_grestore(igs);
- return npop;
+ gs_grestore(igs);
+ return npop;
}
if (npop > 1) /* matrix was supplied */
- code = gs_concat(igs, &mat);
+ code = gs_concat(igs, &mat);
if (code >= 0)
- code = gs_stroke(igs);
+ code = gs_stroke(igs);
return in_upath_result(i_ctx_p, npop + spop, code);
}
@@ -145,7 +145,7 @@ in_test(i_ctx_t *i_ctx_p, int (*paintproc)(gs_state *))
int code;
if (npop < 0)
- return npop;
+ return npop;
code = (*paintproc)(igs);
return in_path_result(i_ctx_p, npop, code);
}
@@ -159,46 +159,46 @@ in_path(os_ptr oppath, i_ctx_t *i_ctx_p, gx_device * phdev)
double uxy[2];
if (code < 0)
- return code;
+ return code;
code = num_params(oppath, 2, uxy);
if (code >= 0) { /* Aperture is a single pixel. */
- gs_point dxy;
- gs_fixed_rect fr;
-
- gs_transform(igs, uxy[0], uxy[1], &dxy);
- fr.p.x = fixed_floor(float2fixed(dxy.x));
- fr.p.y = fixed_floor(float2fixed(dxy.y));
- fr.q.x = fr.p.x + fixed_1;
- fr.q.y = fr.p.y + fixed_1;
- code = gx_clip_to_rectangle(igs, &fr);
- npop = 2;
+ gs_point dxy;
+ gs_fixed_rect fr;
+
+ gs_transform(igs, uxy[0], uxy[1], &dxy);
+ fr.p.x = fixed_floor(float2fixed(dxy.x));
+ fr.p.y = fixed_floor(float2fixed(dxy.y));
+ fr.q.x = fr.p.x + fixed_1;
+ fr.q.y = fr.p.y + fixed_1;
+ code = gx_clip_to_rectangle(igs, &fr);
+ npop = 2;
} else if (code == e_stackunderflow) {
- /* If 0 elements, definitely a stackunderflow; otherwise, */
- /* only 1 number, also a stackunderflow. */
- npop = code;
+ /* If 0 elements, definitely a stackunderflow; otherwise, */
+ /* only 1 number, also a stackunderflow. */
+ npop = code;
} else { /* Aperture is a user path. */
- /* We have to set the clipping path without disturbing */
- /* the current path. */
- gx_path *ipath = igs->path;
- gx_path save;
-
- gx_path_init_local(&save, imemory);
- gx_path_assign_preserve(&save, ipath);
- gs_newpath(igs);
- code = upath_append(oppath, i_ctx_p, false);
- if (code >= 0)
- code = gx_clip_to_path(igs);
- gx_path_assign_free(igs->path, &save);
- npop = 1;
+ /* We have to set the clipping path without disturbing */
+ /* the current path. */
+ gx_path *ipath = igs->path;
+ gx_path save;
+
+ gx_path_init_local(&save, imemory);
+ gx_path_assign_preserve(&save, ipath);
+ gs_newpath(igs);
+ code = upath_append(oppath, i_ctx_p, false);
+ if (code >= 0)
+ code = gx_clip_to_path(igs);
+ gx_path_assign_free(igs->path, &save);
+ npop = 1;
}
if (code < 0) {
- gs_grestore(igs);
- return code;
+ gs_grestore(igs);
+ return code;
}
/* Install the hit detection device. */
gx_set_device_color_1(igs);
gx_device_init((gx_device *) phdev, (const gx_device *)&gs_hit_device,
- NULL, true);
+ NULL, true);
phdev->width = phdev->height = max_int;
gx_device_fill_in_procs(phdev);
gx_set_device_only(igs, phdev);
@@ -214,11 +214,11 @@ in_path_result(i_ctx_t *i_ctx_p, int npop, int code)
gs_grestore(igs); /* matches gsave in in_path */
if (code == gs_hit_detected)
- result = true;
+ result = true;
else if (code == 0) /* completed painting without a hit */
- result = false;
+ result = false;
else /* error */
- return code;
+ return code;
npop--;
pop(npop);
op -= npop;
@@ -236,7 +236,7 @@ in_utest(i_ctx_t *i_ctx_p, int (*paintproc)(gs_state *))
int code;
if (npop < 0)
- return npop;
+ return npop;
code = (*paintproc)(igs);
return in_upath_result(i_ctx_p, npop, code);
}
@@ -251,12 +251,12 @@ in_upath(i_ctx_t *i_ctx_p, gx_device * phdev)
int npop;
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, false)) < 0 ||
- (code = npop = in_path(op - 1, i_ctx_p, phdev)) < 0
- ) {
- gs_grestore(igs);
- return code;
+ (code = npop = in_path(op - 1, i_ctx_p, phdev)) < 0
+ ) {
+ gs_grestore(igs);
+ return code;
}
return npop + 1;
}
@@ -346,12 +346,12 @@ zuappend(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, false)) >= 0)
- code = gs_upmergepath(igs);
+ code = gs_upmergepath(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -364,12 +364,12 @@ zueofill(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, gs_currentcpsimode(imemory))) >= 0)
- code = gs_eofill(igs);
+ code = gs_eofill(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -382,12 +382,12 @@ zufill(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, gs_currentcpsimode(imemory))) >= 0)
- code = gs_fill(igs);
+ code = gs_fill(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -401,12 +401,12 @@ zustroke(i_ctx_t *i_ctx_p)
int npop;
if (code < 0)
- return code;
+ return code;
if ((code = npop = upath_stroke(i_ctx_p, NULL, gs_currentcpsimode(imemory))) >= 0)
- code = gs_stroke(igs);
+ code = gs_stroke(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -421,23 +421,23 @@ zustrokepath(i_ctx_t *i_ctx_p)
int npop, code = gs_currentmatrix(igs, &saved_matrix);
if (code < 0)
- return code;
+ return code;
/* Save and reset the path. */
gx_path_init_local(&save, imemory);
gx_path_assign_preserve(&save, igs->path);
if ((code = npop = upath_stroke(i_ctx_p, NULL, false)) < 0 ||
- (code = gs_strokepath(igs)) < 0
- ) {
- gx_path_assign_free(igs->path, &save);
- return code;
+ (code = gs_strokepath(igs)) < 0
+ ) {
+ gx_path_assign_free(igs->path, &save);
+ return code;
}
/*
* If a matrix was specified then restore the previous matrix.
*/
if (npop > 1) {
if ((code = gs_setmatrix(igs, &saved_matrix)) < 0) {
- gx_path_assign_free(igs->path, &save);
- return code;
+ gx_path_assign_free(igs->path, &save);
+ return code;
}
}
gx_path_free(&save, "ustrokepath");
@@ -449,7 +449,7 @@ zustrokepath(i_ctx_t *i_ctx_p)
/* We do all the work in a procedure that is also used to construct */
/* the UnpaintedPath user path for ImageType 2 images. */
int make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
- bool with_ucache);
+ bool with_ucache);
static int
zupath(i_ctx_t *i_ctx_p)
{
@@ -460,7 +460,7 @@ zupath(i_ctx_t *i_ctx_p)
}
/* Compute the path length for user path purposes. */
-static int
+static int
path_length_for_upath(const gx_path *ppath)
{
gs_path_enum penum;
@@ -469,27 +469,27 @@ path_length_for_upath(const gx_path *ppath)
gx_path_enum_init(&penum, ppath);
while ((op = gx_path_enum_next(&penum, pts)) != 0) {
- switch (op) {
- case gs_pe_moveto:
- case gs_pe_lineto:
- size += 3;
- continue;
- case gs_pe_curveto:
- size += 7;
- continue;
- case gs_pe_closepath:
- size += 1;
- continue;
- default:
- return_error(e_unregistered);
- }
+ switch (op) {
+ case gs_pe_moveto:
+ case gs_pe_lineto:
+ size += 3;
+ continue;
+ case gs_pe_curveto:
+ size += 7;
+ continue;
+ case gs_pe_closepath:
+ size += 1;
+ continue;
+ default:
+ return_error(e_unregistered);
+ }
}
return size;
}
int
make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
- bool with_ucache)
+ bool with_ucache)
{
int size = (with_ucache ? 6 : 5);
gs_path_enum penum;
@@ -498,18 +498,17 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
ref *next;
int code;
-
/* Compute the bounding box. */
if ((code = gs_upathbbox(pgs, &bbox, true)) < 0) {
- /*
- * Note: Adobe throws 'nocurrentpoint' error, but the PLRM does
- * not list this as a possible error from 'upath', so if we are
- * not in CPSI compatibility mode, we set a reasonable default
- * bbox instead.
- */
- if (code != e_nocurrentpoint || gs_currentcpsimode(imemory))
- return code;
- bbox.p.x = bbox.p.y = bbox.q.x = bbox.q.y = 0;
+ /*
+ * Note: Adobe throws 'nocurrentpoint' error, but the PLRM does
+ * not list this as a possible error from 'upath', so if we are
+ * not in CPSI compatibility mode, we set a reasonable default
+ * bbox instead.
+ */
+ if (code != e_nocurrentpoint || gs_currentcpsimode(imemory))
+ return code;
+ bbox.p.x = bbox.p.y = bbox.q.x = bbox.q.y = 0;
}
code = path_length_for_upath(ppath);
@@ -520,16 +519,16 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
return_error(e_limitcheck);
code = ialloc_ref_array(rupath, a_all | a_executable, size,
- "make_upath");
+ "make_upath");
if (code < 0)
- return code;
+ return code;
/* Construct the path. */
next = rupath->value.refs;
if (with_ucache) {
if ((code = name_enter_string(pgs->memory, "ucache", next)) < 0)
- return code;
- r_set_attrs(next, a_executable | l_new);
- ++next;
+ return code;
+ r_set_attrs(next, a_executable | l_new);
+ ++next;
}
make_real_new(next, bbox.p.x);
make_real_new(next + 1, bbox.p.y);
@@ -537,57 +536,56 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
make_real_new(next + 3, bbox.q.y);
next += 4;
if ((code = name_enter_string(pgs->memory, "setbbox", next)) < 0)
- return code;
+ return code;
r_set_attrs(next, a_executable | l_new);
++next;
{
- gs_point pts[3];
-
- /* Patch the path in the gstate to set up the enumerator. */
- gx_path *save_path = pgs->path;
-
- pgs->path = ppath;
- gs_path_enum_copy_init(&penum, pgs, false);
- pgs->path = save_path;
- while ((op = gs_path_enum_next(&penum, pts)) != 0) {
- const char *opstr;
-
- switch (op) {
- case gs_pe_moveto:
- opstr = "moveto";
- goto ml;
- case gs_pe_lineto:
- opstr = "lineto";
- ml:make_real_new(next, pts[0].x);
- make_real_new(next + 1, pts[0].y);
- next += 2;
- break;
- case gs_pe_curveto:
- opstr = "curveto";
- make_real_new(next, pts[0].x);
- make_real_new(next + 1, pts[0].y);
- make_real_new(next + 2, pts[1].x);
- make_real_new(next + 3, pts[1].y);
- make_real_new(next + 4, pts[2].x);
- make_real_new(next + 5, pts[2].y);
- next += 6;
- break;
- case gs_pe_closepath:
- opstr = "closepath";
- break;
- default:
- return_error(e_unregistered);
- }
- if ((code = name_enter_string(pgs->memory, opstr, next)) < 0)
- return code;
- r_set_attrs(next, a_executable);
- ++next;
- }
+ gs_point pts[3];
+
+ /* Patch the path in the gstate to set up the enumerator. */
+ gx_path *save_path = pgs->path;
+
+ pgs->path = ppath;
+ gs_path_enum_copy_init(&penum, pgs, false);
+ pgs->path = save_path;
+ while ((op = gs_path_enum_next(&penum, pts)) != 0) {
+ const char *opstr;
+
+ switch (op) {
+ case gs_pe_moveto:
+ opstr = "moveto";
+ goto ml;
+ case gs_pe_lineto:
+ opstr = "lineto";
+ ml:make_real_new(next, pts[0].x);
+ make_real_new(next + 1, pts[0].y);
+ next += 2;
+ break;
+ case gs_pe_curveto:
+ opstr = "curveto";
+ make_real_new(next, pts[0].x);
+ make_real_new(next + 1, pts[0].y);
+ make_real_new(next + 2, pts[1].x);
+ make_real_new(next + 3, pts[1].y);
+ make_real_new(next + 4, pts[2].x);
+ make_real_new(next + 5, pts[2].y);
+ next += 6;
+ break;
+ case gs_pe_closepath:
+ opstr = "closepath";
+ break;
+ default:
+ return_error(e_unregistered);
+ }
+ if ((code = name_enter_string(pgs->memory, opstr, next)) < 0)
+ return code;
+ r_set_attrs(next, a_executable);
+ ++next;
+ }
}
return 0;
}
-
static int
zgetpath(i_ctx_t *i_ctx_p)
{
@@ -607,9 +605,9 @@ zgetpath(i_ctx_t *i_ctx_p)
return 0;
if (dict_find_string(systemdict, "moveto", &operators[1]) <= 0 ||
- dict_find_string(systemdict, "lineto", &operators[2]) <= 0 ||
- dict_find_string(systemdict, "curveto", &operators[3]) <= 0 ||
- dict_find_string(systemdict, "closepath", &operators[4]) <= 0)
+ dict_find_string(systemdict, "lineto", &operators[2]) <= 0 ||
+ dict_find_string(systemdict, "curveto", &operators[3]) <= 0 ||
+ dict_find_string(systemdict, "closepath", &operators[4]) <= 0)
return_error(e_undefined);
main_ref = op->value.refs;
@@ -624,8 +622,8 @@ zgetpath(i_ctx_t *i_ctx_p)
int pe, j, k;
gs_path_enum penum;
static const int oper_count[5] = { 0, 2, 2, 6, 0 };
- gs_point pts[3];
- const double *fts[6];
+ gs_point pts[3];
+ const double *fts[6];
fts[0] = &pts[0].x;
fts[1] = &pts[0].y;
@@ -635,7 +633,7 @@ zgetpath(i_ctx_t *i_ctx_p)
fts[5] = &pts[2].y;
main_ref = op->value.refs;
- gs_path_enum_copy_init(&penum, igs, false);
+ gs_path_enum_copy_init(&penum, igs, false);
pe = gs_path_enum_next(&penum, pts);
if (pe < 0)
return pe;
@@ -644,7 +642,7 @@ zgetpath(i_ctx_t *i_ctx_p)
for (i = 0; i < leaf_count; i++) {
int leaf_size = ( i == leaf_count - 1) ? path_size - i * max_array_size : max_array_size;
ref *leaf_ref = main_ref[i].value.refs;
-
+
for (j = 0; j < leaf_size; j++) {
if (k < oper_count[pe])
make_real_new(&leaf_ref[j], (float)*fts[k++]);
@@ -673,156 +671,156 @@ upath_append_aux(os_ptr oppath, i_ctx_t *i_ctx_p, int *pnargs, bool upath_compat
ref opcodes;
if (r_has_type(oppath, t__invalid))
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_is_array(oppath))
- return_error(e_typecheck);
+ return_error(e_typecheck);
check_read(*oppath);
gs_newpath(igs);
/****** ROUND tx AND ty ******/
-
+
if ( r_size(oppath) == 2 &&
- array_get(imemory, oppath, 1, &opcodes) >= 0 &&
+ array_get(imemory, oppath, 1, &opcodes) >= 0 &&
r_has_type(&opcodes, t_string)
- ) { /* 1st element is operands, 2nd is operators */
- ref operands;
- int code, format;
- int repcount = 1;
- const byte *opp;
- uint ocount, i = 0;
+ ) { /* 1st element is operands, 2nd is operators */
+ ref operands;
+ int code, format;
+ int repcount = 1;
+ const byte *opp;
+ uint ocount, i = 0;
array_get(imemory, oppath, 0, &operands);
code = num_array_format(&operands);
- if (code < 0)
- return code;
- format = code;
- check_read(opcodes);
- opp = opcodes.value.bytes;
- ocount = r_size(&opcodes);
- while (ocount--) {
- byte opx = *opp++;
-
- if (opx > UPATH_REPEAT)
- repcount = opx - UPATH_REPEAT;
- else if (opx > UPATH_MAX_OP)
- return_error(e_rangecheck);
- else { /* operator */
- const up_data_t data = up_data[opx];
-
- *pnargs = 0; /* in case of error */
- if (upath_compat && opx == upath_op_ucache) {
- /* CPSI does not complain about incorrect ucache
- placement, even though PLRM3 says it's illegal. */
- ups = ups > UPS_UCACHE ? ups : data.state_after;
- } else {
- if (!(ups & data.states_before))
- return_error(e_typecheck);
- ups = data.state_after;
- }
- do {
- os_ptr op = osp;
- byte opargs = data.num_args;
-
- while (opargs--) {
- push(1);
- (*pnargs)++; /* in case of error */
- code = num_array_get(imemory, &operands, format, i++, op);
- switch (code) {
- case t_integer:
- r_set_type_attrs(op, t_integer, 0);
- break;
- case t_real:
- r_set_type_attrs(op, t_real, 0);
- break;
- default:
- return_error(e_typecheck);
- }
- }
- code = (*up_ops[opx])(i_ctx_p);
- if (code < 0)
- return code;
- }
- while (--repcount);
- repcount = 1;
- }
- }
+ if (code < 0)
+ return code;
+ format = code;
+ check_read(opcodes);
+ opp = opcodes.value.bytes;
+ ocount = r_size(&opcodes);
+ while (ocount--) {
+ byte opx = *opp++;
+
+ if (opx > UPATH_REPEAT)
+ repcount = opx - UPATH_REPEAT;
+ else if (opx > UPATH_MAX_OP)
+ return_error(e_rangecheck);
+ else { /* operator */
+ const up_data_t data = up_data[opx];
+
+ *pnargs = 0; /* in case of error */
+ if (upath_compat && opx == upath_op_ucache) {
+ /* CPSI does not complain about incorrect ucache
+ placement, even though PLRM3 says it's illegal. */
+ ups = ups > UPS_UCACHE ? ups : data.state_after;
+ } else {
+ if (!(ups & data.states_before))
+ return_error(e_typecheck);
+ ups = data.state_after;
+ }
+ do {
+ os_ptr op = osp;
+ byte opargs = data.num_args;
+
+ while (opargs--) {
+ push(1);
+ (*pnargs)++; /* in case of error */
+ code = num_array_get(imemory, &operands, format, i++, op);
+ switch (code) {
+ case t_integer:
+ r_set_type_attrs(op, t_integer, 0);
+ break;
+ case t_real:
+ r_set_type_attrs(op, t_real, 0);
+ break;
+ default:
+ return_error(e_typecheck);
+ }
+ }
+ code = (*up_ops[opx])(i_ctx_p);
+ if (code < 0)
+ return code;
+ }
+ while (--repcount);
+ repcount = 1;
+ }
+ }
} else { /* Ordinary executable array. */
- const ref *arp = oppath;
- uint ocount = r_size(oppath);
- long index = 0;
- int argcount = 0;
- op_proc_t oproc;
- int opx, code;
-
- for (; index < ocount; index++) {
- ref rup;
- ref *defp;
- os_ptr op = osp;
- up_data_t data;
-
- *pnargs = argcount;
- array_get(imemory, arp, index, &rup);
- switch (r_type(&rup)) {
- case t_integer:
- case t_real:
- argcount++;
- push(1);
- *op = rup;
- break;
- case t_name:
- if (!r_has_attr(&rup, a_executable) ||
- dict_find(systemdict, &rup, &defp) <= 0 ||
- r_btype(defp) != t_operator)
- return_error(e_typecheck); /* all errors = typecheck */
- goto xop;
- case t_operator:
- defp = &rup;
- xop:if (!r_has_attr(defp, a_executable))
- return_error(e_typecheck);
- oproc = real_opproc(defp);
- for (opx = 0; opx <= UPATH_MAX_OP; opx++)
- if (oproc == up_ops[opx])
- break;
- if (opx > UPATH_MAX_OP)
- return_error(e_typecheck);
- data = up_data[opx];
- if (argcount != data.num_args)
- return_error(e_typecheck);
- if (upath_compat && opx == upath_op_ucache) {
- /* CPSI does not complain about incorrect ucache
- placement, even though PLRM3 says it's illegal. */
- ups = ups > UPS_UCACHE ? ups : data.state_after;
- } else {
- if (!(ups & data.states_before))
- return_error(e_typecheck);
- ups = data.state_after;
- }
- code = (*up_ops[opx])(i_ctx_p);
- if (code < 0) {
- if (code == e_nocurrentpoint)
+ const ref *arp = oppath;
+ uint ocount = r_size(oppath);
+ long index = 0;
+ int argcount = 0;
+ op_proc_t oproc;
+ int opx, code;
+
+ for (; index < ocount; index++) {
+ ref rup;
+ ref *defp;
+ os_ptr op = osp;
+ up_data_t data;
+
+ *pnargs = argcount;
+ array_get(imemory, arp, index, &rup);
+ switch (r_type(&rup)) {
+ case t_integer:
+ case t_real:
+ argcount++;
+ push(1);
+ *op = rup;
+ break;
+ case t_name:
+ if (!r_has_attr(&rup, a_executable) ||
+ dict_find(systemdict, &rup, &defp) <= 0 ||
+ r_btype(defp) != t_operator)
+ return_error(e_typecheck); /* all errors = typecheck */
+ goto xop;
+ case t_operator:
+ defp = &rup;
+ xop:if (!r_has_attr(defp, a_executable))
+ return_error(e_typecheck);
+ oproc = real_opproc(defp);
+ for (opx = 0; opx <= UPATH_MAX_OP; opx++)
+ if (oproc == up_ops[opx])
+ break;
+ if (opx > UPATH_MAX_OP)
+ return_error(e_typecheck);
+ data = up_data[opx];
+ if (argcount != data.num_args)
+ return_error(e_typecheck);
+ if (upath_compat && opx == upath_op_ucache) {
+ /* CPSI does not complain about incorrect ucache
+ placement, even though PLRM3 says it's illegal. */
+ ups = ups > UPS_UCACHE ? ups : data.state_after;
+ } else {
+ if (!(ups & data.states_before))
+ return_error(e_typecheck);
+ ups = data.state_after;
+ }
+ code = (*up_ops[opx])(i_ctx_p);
+ if (code < 0) {
+ if (code == e_nocurrentpoint)
return_error(e_rangecheck); /* CET 11-22 */
return code;
- }
+ }
argcount = 0;
- break;
- default:
- return_error(e_typecheck);
- }
- }
- if (argcount) {
- *pnargs = argcount;
- return_error(e_typecheck); /* leftover args */
- }
+ break;
+ default:
+ return_error(e_typecheck);
+ }
+ }
+ if (argcount) {
+ *pnargs = argcount;
+ return_error(e_typecheck); /* leftover args */
+ }
}
if (ups < UPS_SETBBOX)
- return_error(e_typecheck); /* no setbbox */
+ return_error(e_typecheck); /* no setbbox */
if (ups == UPS_SETBBOX && upath_compat) {
- /*
- * In CPSI compatibility mode, an empty path with a setbbox also
- * does a moveto (but only if the path is empty). Since setbbox
- * was the last operator, its operands are still on the o-stack.
- */
- osp += 2;
- return zmoveto(i_ctx_p);
+ /*
+ * In CPSI compatibility mode, an empty path with a setbbox also
+ * does a moveto (but only if the path is empty). Since setbbox
+ * was the last operator, its operands are still on the o-stack.
+ */
+ osp += 2;
+ return zmoveto(i_ctx_p);
}
return 0;
}
@@ -833,9 +831,9 @@ upath_append(os_ptr oppath, i_ctx_t *i_ctx_p, bool upath_compat)
int code = upath_append_aux(oppath, i_ctx_p, &nargs, upath_compat);
if (code < 0) {
- /* Pop args on error, to match Adobe interpreters. */
- pop(nargs);
- return code;
+ /* Pop args on error, to match Adobe interpreters. */
+ pop(nargs);
+ return code;
}
return 0;
}
@@ -850,18 +848,18 @@ upath_stroke(i_ctx_t *i_ctx_p, gs_matrix *pmat, bool upath_compat)
gs_matrix mat;
if ((code = read_matrix(imemory, op, &mat)) >= 0) {
- if ((code = upath_append(op - 1, i_ctx_p, upath_compat)) >= 0) {
- if (pmat)
- *pmat = mat;
- else
- code = gs_concat(igs, &mat);
- }
- npop = 2;
+ if ((code = upath_append(op - 1, i_ctx_p, upath_compat)) >= 0) {
+ if (pmat)
+ *pmat = mat;
+ else
+ code = gs_concat(igs, &mat);
+ }
+ npop = 2;
} else {
- if ((code = upath_append(op, i_ctx_p, upath_compat)) >= 0)
- if (pmat)
- gs_make_identity(pmat);
- npop = 1;
+ if ((code = upath_append(op, i_ctx_p, upath_compat)) >= 0)
+ if (pmat)
+ gs_make_identity(pmat);
+ npop = 1;
}
return (code < 0 ? code : npop);
}
@@ -871,14 +869,14 @@ upath_stroke(i_ctx_t *i_ctx_p, gs_matrix *pmat, bool upath_compat)
const op_def zupath_l2_op_defs[] =
{
op_def_begin_level2(),
- /* Insideness testing */
+ /* Insideness testing */
{"1ineofill", zineofill},
{"1infill", zinfill},
{"1instroke", zinstroke},
{"2inueofill", zinueofill},
{"2inufill", zinufill},
{"2inustroke", zinustroke},
- /* User paths */
+ /* User paths */
{"1uappend", zuappend},
{"0ucache", zucache},
{"1ueofill", zueofill},
@@ -886,7 +884,7 @@ const op_def zupath_l2_op_defs[] =
{"1upath", zupath},
{"1ustroke", zustroke},
{"1ustrokepath", zustrokepath},
- /* Path access for PDF */
+ /* Path access for PDF */
{"0.getpath", zgetpath},
op_def_end(0)
};