summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2021-08-11 16:09:13 +0100
committerRobin Watts <Robin.Watts@artifex.com>2021-09-06 10:44:43 +0100
commit28bb0fa34b35181d5905d4f6d32fdcded2df5b04 (patch)
tree0518e6556d75925411ce1e18d68a2cf157e98387
parent9a919128db855e58d5ba8b27bb15eae3d78a8d04 (diff)
downloadghostpdl-28bb0fa34b35181d5905d4f6d32fdcded2df5b04.tar.gz
PCL: Ensure we read the page matrix at least once every page.
This allows us to cope with Nup where the device initial matrix may change on every page.
-rw-r--r--pcl/pcl/pcpage.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/pcl/pcl/pcpage.c b/pcl/pcl/pcpage.c
index 14342ec56..6ea60c121 100644
--- a/pcl/pcl/pcpage.c
+++ b/pcl/pcl/pcpage.c
@@ -336,6 +336,36 @@ reset_margins(pcl_state_t * pcs, bool for_passthrough)
reset_vertical_margins(pcs, for_passthrough);
}
+static void
+reset_default_transformation(pcl_state_t *pcs)
+{
+ gs_gstate *pgs = pcs->pgs;
+ gs_matrix mat;
+ double height_pts = pcs->xfm_state.paper_size->height * 0.01;
+
+ /*
+ * Reset the default transformation.
+ *
+ * The graphic library provides a coordinate system in points, with the
+ * origin at the lower left corner of the page. The PCL code uses a
+ * coordinate system in centi-points, with the origin at the upper left
+ * corner of the page.
+ */
+ gs_setdefaultmatrix(pgs, NULL);
+ gs_initmatrix(pgs);
+ gs_currentmatrix(pgs, &mat);
+
+ if (pcs->personality != rtl) {
+ gs_matrix_translate(&mat, 0.0, height_pts, &mat);
+ gs_matrix_scale(&mat, 0.01, -0.01, &mat);
+ } else {
+ gs_matrix_rotate(&mat, -90, &mat);
+ gs_matrix_scale(&mat, -0.01, 0.01, &mat);
+ }
+
+ gs_setdefaultmatrix(pgs, &mat);
+}
+
/*
* Reset all parameters which must be reset whenever the page size changes.
*
@@ -352,8 +382,6 @@ new_page_size(pcl_state_t * pcs,
double height_pts = psize->height * 0.01;
float page_size[2];
float old_page_size[2];
- gs_gstate *pgs = pcs->pgs;
- gs_matrix mat;
bool changed_page_size;
int code = 0;
@@ -366,28 +394,8 @@ new_page_size(pcl_state_t * pcs,
code = put_param1_float_array(pcs, "PageSize", page_size);
if (code < 0) return code;
- /*
- * Reset the default transformation.
- *
- * The graphic library provides a coordinate system in points, with the
- * origin at the lower left corner of the page. The PCL code uses a
- * coordinate system in centi-points, with the origin at the upper left
- * corner of the page.
- */
- gs_setdefaultmatrix(pgs, NULL);
- gs_initmatrix(pgs);
- gs_currentmatrix(pgs, &mat);
-
- if (pcs->personality != rtl) {
- gs_matrix_translate(&mat, 0.0, height_pts, &mat);
- gs_matrix_scale(&mat, 0.01, -0.01, &mat);
- } else {
- gs_matrix_rotate(&mat, -90, &mat);
- gs_matrix_scale(&mat, -0.01, 0.01, &mat);
- }
-
- gs_setdefaultmatrix(pgs, &mat);
pcs->xfm_state.paper_size = psize;
+ reset_default_transformation(pcs);
pcs->overlay_enabled = false;
update_xfm_state(pcs, reset_initial);
reset_margins(pcs, for_passthrough);
@@ -664,6 +672,7 @@ pcl_end_page(pcl_state_t * pcs, pcl_print_condition_t condition)
pcs->back_side = false;
}
code = put_param1_bool(pcs,"FirstSide", !pcs->back_side);
+ reset_default_transformation(pcs);
update_xfm_state(pcs, 0);
pcl_continue_underline(pcs);