summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gs/psi/zform.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gs/psi/zform.c b/gs/psi/zform.c
index 383c8000b..a84f11dd0 100644
--- a/gs/psi/zform.c
+++ b/gs/psi/zform.c
@@ -40,6 +40,8 @@ static int zbeginform(i_ctx_t *i_ctx_p)
40 int code; 40 int code;
41 float BBox[4], Matrix[6]; 41 float BBox[4], Matrix[6];
42 gs_form_template_t tmplate; 42 gs_form_template_t tmplate;
43 gs_point pt;
44 gs_fixed_rect box;
43 45
44 check_type(*op, t_dictionary); 46 check_type(*op, t_dictionary);
45 check_dict_read(*op); 47 check_dict_read(*op);
@@ -55,8 +57,8 @@ static int zbeginform(i_ctx_t *i_ctx_p)
55 return_error(e_undefined); 57 return_error(e_undefined);
56 tmplate.BBox.p.x = BBox[0]; 58 tmplate.BBox.p.x = BBox[0];
57 tmplate.BBox.p.y = BBox[1]; 59 tmplate.BBox.p.y = BBox[1];
58 tmplate.BBox.q.x = BBox[2]; 60 pt.x = tmplate.BBox.q.x = BBox[2];
59 tmplate.BBox.q.y = BBox[3]; 61 pt.y = tmplate.BBox.q.y = BBox[3];
60 62
61 code = dict_floats_param(imemory, op, "Matrix", 6, Matrix, NULL); 63 code = dict_floats_param(imemory, op, "Matrix", 6, Matrix, NULL);
62 if (code < 0) 64 if (code < 0)
@@ -80,9 +82,8 @@ static int zbeginform(i_ctx_t *i_ctx_p)
80 */ 82 */
81 if (code > 0) 83 if (code > 0)
82 { 84 {
83 gs_fixed_rect box;
84
85 gs_setmatrix(igs, &tmplate.CTM); 85 gs_setmatrix(igs, &tmplate.CTM);
86 gs_distance_transform(tmplate.BBox.q.x, tmplate.BBox.q.y, &tmplate.CTM, &pt);
86 87
87 /* A form can legitimately have negative co-ordinates in paths 88 /* A form can legitimately have negative co-ordinates in paths
88 * because it can be translated. But we always clip paths to the 89 * because it can be translated. But we always clip paths to the
@@ -92,17 +93,18 @@ static int zbeginform(i_ctx_t *i_ctx_p)
92 * So here we temporarily set the clip to permit negative values, 93 * So here we temporarily set the clip to permit negative values,
93 * fortunately this works..... 94 * fortunately this works.....
94 */ 95 */
95 code = gx_default_clip_box(igs, &box);
96 if (code < 0)
97 return code;
98 /* We choose to permit negative values of the same magnitude as the 96 /* We choose to permit negative values of the same magnitude as the
99 * positive ones. 97 * positive ones.
100 */ 98 */
101 box.p.x = box.q.x * -1; 99 box.p.x = float2fixed(pt.x * -1);
102 box.p.y = box.q.y * -1; 100 box.p.y = float2fixed(pt.y * -1);
101 box.q.x = float2fixed(pt.x);
102 box.q.y = float2fixed(pt.y);
103
103 /* This gets undone when we grestore after the form is executed */ 104 /* This gets undone when we grestore after the form is executed */
104 code = gx_clip_to_rectangle(igs, &box); 105 code = gx_clip_to_rectangle(igs, &box);
105 } 106 }
107
106 pop(2); 108 pop(2);
107 return code; 109 return code;
108} 110}