|
From: <ai...@us...> - 2014-03-06 00:05:32
|
Revision: 13044
http://sourceforge.net/p/plplot/code/13044
Author: airwin
Date: 2014-03-06 00:05:26 +0000 (Thu, 06 Mar 2014)
Log Message:
-----------
Solve scaling issue (https://sourceforge.net/p/plplot/bugs/143/)
demonstrated by the extXdrawable_demo application. Thanks to
Jens (https://sourceforge.net/u/jensplplot/profile/) for reporting
this issue which I was able to confirm by attempting to resize
the extXdrawable_demo GUI.
I have applied the fix suggested by Jens which in retrospect is
obvious; when you change the geometry by resizing the window, the
result is reported back by the call to XGetGeometry, and the scale
factor must be adjusted to compensate for that changed geometry right
after that call. After this fix, resizing the extXdrawable_demo GUI
produced no strange line artifacts (presumably caused by short
overflows) that were present before the fix.
Modified Paths:
--------------
trunk/drivers/cairo.c
Modified: trunk/drivers/cairo.c
===================================================================
--- trunk/drivers/cairo.c 2014-03-05 20:19:04 UTC (rev 13043)
+++ trunk/drivers/cairo.c 2014-03-06 00:05:26 UTC (rev 13044)
@@ -2186,6 +2186,12 @@
&x, &y, &w, &h, &b, &d );
pls->xlength = (PLINT) w;
pls->ylength = (PLINT) h;
+ // Calculate ratio of (smaller) external coordinates used for cairo
+ // devices to (larger) internal PLplot coordinates.
+ if ( pls->xlength > pls->ylength )
+ aStream->downscale = (double) pls->xlength / (double) ( PIXELS_X - 1 );
+ else
+ aStream->downscale = (double) pls->ylength / (double) PIXELS_Y;
plP_setphy( (PLINT) 0, (PLINT) ( pls->xlength / aStream->downscale ), (PLINT) 0,
(PLINT) ( pls->ylength / aStream->downscale ) );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|