From: <ai...@us...> - 2013-10-20 04:41:09
|
Revision: 12612 http://sourceforge.net/p/plplot/code/12612 Author: airwin Date: 2013-10-20 04:41:07 +0000 (Sun, 20 Oct 2013) Log Message: ----------- For the ps, psttf, and hpgl device drivers change all macros concerning pen width to floating point so that no casts are implicitly made when comparing to plsc->width. Of course, these device drivers all write integer pen widths to the file so make the appropriate casts concerning that. ToDo (some day for somebody else). Investigate whether the PostScript standard allows floating values for the pen width, and if so, do not do the cast and instead write out to the floating point value of the width to the file. Modified Paths: -------------- trunk/drivers/hpgl.c trunk/drivers/psttf.cc trunk/include/ps.h Modified: trunk/drivers/hpgl.c =================================================================== --- trunk/drivers/hpgl.c 2013-10-20 04:33:13 UTC (rev 12611) +++ trunk/drivers/hpgl.c 2013-10-20 04:41:07 UTC (rev 12612) @@ -78,9 +78,9 @@ #define LJIII_YMAX 7700 #define OF pls->OutFile -#define MIN_WIDTH 1 // Minimum pen width -#define MAX_WIDTH 10 // Maximum pen width -#define DEF_WIDTH 1 // Default pen width +#define MIN_WIDTH 1. // Minimum pen width +#define MAX_WIDTH 10. // Maximum pen width +#define DEF_WIDTH 1. // Default pen width static void hpgl_dispatch_init_helper( PLDispatchTable *pdt, char *menustr, char *devnam, @@ -349,9 +349,9 @@ { case PLSTATE_WIDTH: case PLSTATE_COLOR0: { - int width = + int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : - ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width; + ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); if ( pls->icol0 < 1 || pls->icol0 > 8 ) fputs( "\nInvalid pen selection.", stderr ); Modified: trunk/drivers/psttf.cc =================================================================== --- trunk/drivers/psttf.cc 2013-10-20 04:33:13 UTC (rev 12611) +++ trunk/drivers/psttf.cc 2013-10-20 04:41:07 UTC (rev 12612) @@ -670,9 +670,9 @@ switch ( op ) { case PLSTATE_WIDTH: { - int width = + int width = (int) ( ( pls->width < MIN_WIDTH ) ? DEF_WIDTH : - ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width; + ( pls->width > MAX_WIDTH ) ? MAX_WIDTH : pls->width ); doc->osBody() << " S\n" << width << " W"; Modified: trunk/include/ps.h =================================================================== --- trunk/include/ps.h 2013-10-20 04:33:13 UTC (rev 12611) +++ trunk/include/ps.h 2013-10-20 04:41:07 UTC (rev 12612) @@ -22,9 +22,9 @@ #define PSX XPSSIZE - 1 #define PSY YPSSIZE - 1 #define OF pls->OutFile -#define MIN_WIDTH 1 // Minimum pen width -#define MAX_WIDTH 30 // Maximum pen width -#define DEF_WIDTH 3 // Default pen width +#define MIN_WIDTH 1. // Minimum pen width +#define MAX_WIDTH 30. // Maximum pen width +#define DEF_WIDTH 3. // Default pen width // These are for covering the page with the background color This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |