From 5b49728e19b5539e5e9db4355f1cc7d7837e4d8e Mon Sep 17 00:00:00 2001 From: Henry Stiles Date: Sun, 7 Feb 1999 09:42:47 +0000 Subject: Addition to properly select and wrap the current pen. Adds an accessor function for getting the currently selected pen. git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@686 06663e23-700e-0410-b217-a244a6096597 --- pcl/pglfill.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pcl/pglfill.c') diff --git a/pcl/pglfill.c b/pcl/pglfill.c index b6edfdc95..ba0cf1264 100644 --- a/pcl/pglfill.c +++ b/pcl/pglfill.c @@ -392,8 +392,7 @@ hpgl_PW( /* * we maintain the line widths in plotter units, irrespective - * of current units (WU). They width argument to PW are mm - * (I suspect this is incorrect - jan) + * of current units (WU). */ if (hpgl_arg_c_real(pargs, ¶m)) { if (hpgl_arg_c_int(pargs, &pmin)) { @@ -621,13 +620,15 @@ hpgl_SP( ) { int pen = 0; - int npen = pcl_palette_get_num_entries(pgls->ppalet); + /* palette pen numbers are always consecutive integers starting + with 0 */ + int max_pen = pcl_palette_get_num_entries(pgls->ppalet) - 1; if (hpgl_arg_c_int(pargs, &pen)) { if (pen < 0) return e_Range; - else if (pen > npen) - pen = (pen % (npen - 1)) + 1; + while ( pen > max_pen ) + pen = pen - max_pen; } hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector)); pgls->g.pen.selected = pen; -- cgit v1.2.3