summaryrefslogtreecommitdiff
path: root/pcl
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2006-07-18 20:42:50 +0000
committerHenry Stiles <henry.stiles@artifex.com>2006-07-18 20:42:50 +0000
commitf59d06653c2c877dd7a594a870da22a5be7daddc (patch)
tree096c81fff730fd292538d1ff7b7dc251aa21b548 /pcl
parent544e5024b62fd9b059facedfee9e39e13803d6ba (diff)
emulate binding of soft clip window to plotter units. Also cleans up
a few compiler warnings. Progressions expected in the following cet files: 29-11.BIN 32-01.BIN 32-02.BIN 32-03.BIN 32-04.BIN 32-06.BIN 35-02.BIN 35-03.BIN 35-04.BIN 35-05.BIN 35-06.BIN git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@2468 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'pcl')
-rw-r--r--pcl/pcdraw.c14
-rw-r--r--pcl/pgconfig.c21
-rw-r--r--pcl/pgdraw.c13
-rw-r--r--pcl/pgstate.h8
4 files changed, 33 insertions, 23 deletions
diff --git a/pcl/pcdraw.c b/pcl/pcdraw.c
index 687a7b0ee..172daf7f0 100644
--- a/pcl/pcdraw.c
+++ b/pcl/pcdraw.c
@@ -53,18 +53,10 @@ pcl_set_ctm(
bool use_pd
)
{
- gs_setmatrix( pcs->pgs,
- ( use_pd ? &(pcs->xfm_state.pd2dev_mtx)
+ return gs_setmatrix( pcs->pgs,
+ ( use_pd ? &(pcs->xfm_state.pd2dev_mtx)
: &(pcs->xfm_state.lp2dev_mtx) )
- );
-#ifdef DEBUG
- {
- gs_matrix mcur, minv;
- gs_currentmatrix(pcs->pgs, &mcur);
- if (gs_matrix_invert(pcs->memory, &mcur, &minv) < 0)
- dprintf(pcs->memory, "non-invertible matrix\n");
- }
-#endif
+ );
}
/*
diff --git a/pcl/pgconfig.c b/pcl/pgconfig.c
index 9ca20fbf0..cb0b72c0c 100644
--- a/pcl/pgconfig.c
+++ b/pcl/pgconfig.c
@@ -414,7 +414,8 @@ hpgl_IW(hpgl_args_t *pargs, hpgl_state_t *pgls)
/* no args case disables the soft clip window */
if ( i == 0 ) {
- pgls->g.soft_clip_window.state = inactive;
+ pgls->g.soft_clip_window.active = false;
+ pgls->g.soft_clip_window.isbound = false;
return 0;
}
/* HAS needs error checking */
@@ -422,7 +423,7 @@ hpgl_IW(hpgl_args_t *pargs, hpgl_state_t *pgls)
pgls->g.soft_clip_window.rect.p.y = wxy[1];
pgls->g.soft_clip_window.rect.q.x = wxy[2];
pgls->g.soft_clip_window.rect.q.y = wxy[3];
- pgls->g.soft_clip_window.state = active;
+ pgls->g.soft_clip_window.active = true;
return 0;
}
@@ -549,8 +550,20 @@ hpgl_SC(hpgl_args_t *pargs, hpgl_state_t *pgls)
switch ( i )
{
case 0: /* set defaults */
- type = hpgl_scaling_none;
- break;
+ {
+ /* a naked SC implies the soft clip window is bound
+ to plotter units. */
+ gs_matrix umat;
+ type = hpgl_scaling_none;
+ hpgl_compute_user_units_to_plu_ctm(pgls, &umat);
+ /* in-place */
+ hpgl_call(gs_bbox_transform(pgls->memory,
+ &pgls->g.soft_clip_window.rect,
+ &umat,
+ &pgls->g.soft_clip_window.rect));
+ pgls->g.soft_clip_window.isbound = true;
+ break;
+ }
default:
return e_Range;
case 4:
diff --git a/pcl/pgdraw.c b/pcl/pgdraw.c
index 16a9a8eca..b770d952d 100644
--- a/pcl/pgdraw.c
+++ b/pcl/pgdraw.c
@@ -152,7 +152,6 @@ hpgl_set_plu_ctm(hpgl_state_t *pgls)
return 0;
}
-/* The CTM maps PLU to device units; adjust it to handle scaling, if any. */
int
hpgl_compute_user_units_to_plu_ctm(const hpgl_state_t *pgls, gs_matrix *pmat)
{ floatp origin_x = pgls->g.P1.x, origin_y = pgls->g.P1.y;
@@ -503,10 +502,18 @@ hpgl_set_clipping_region(hpgl_state_t *pgls, hpgl_rendering_mode_t render_mode)
space boxes replace the current box. Note that IW
coordinates are in current units and and the picture
frame in pcl coordinates. */
- if ( pgls->g.soft_clip_window.state == active ) {
+ if ( pgls->g.soft_clip_window.active ) {
gs_rect dev_soft_window_box;
gs_matrix ctm;
- hpgl_call(gs_currentmatrix(pgls->pgs, &ctm));
+ if (pgls->g.soft_clip_window.isbound) {
+ /* we need the plotter unit matrix */
+ hpgl_call(gs_currentmatrix(pgls->pgs, &save_ctm));
+ hpgl_call(hpgl_set_plu_ctm(pgls));
+ hpgl_call(gs_currentmatrix(pgls->pgs, &ctm));
+ hpgl_call(gs_setmatrix(pgls->pgs, &save_ctm));
+ } else {
+ hpgl_call(gs_currentmatrix(pgls->pgs, &ctm));
+ }
hpgl_call(gs_bbox_transform(pgls->memory,
&pgls->g.soft_clip_window.rect,
&ctm,
diff --git a/pcl/pgstate.h b/pcl/pgstate.h
index 7273b4083..47e66315e 100644
--- a/pcl/pgstate.h
+++ b/pcl/pgstate.h
@@ -163,11 +163,9 @@ typedef struct pcl_hpgl_state_s {
} scaling_type;
hpgl_scaling_params_t scaling_params;
struct soft_clip_window_ {
- enum {
- active, /* current unit window has be given */
- inactive, /* use picture frame */
- bound /* bound to plotter units */
- } state;
+ bool active; /* current unit window has be given,
+ if not use picture frame */
+ bool isbound; /* bound to plotter units */
gs_rect rect; /* clipping window (IW) */
} soft_clip_window;
int rotation;