|
From: <and...@us...> - 2013-11-21 22:19:14
|
Revision: 12733
http://sourceforge.net/p/plplot/code/12733
Author: andrewross
Date: 2013-11-21 22:19:11 +0000 (Thu, 21 Nov 2013)
Log Message:
-----------
Allow the passing of NULL arguments to plsvect which will reset the arrow style to the default.
Modified Paths:
--------------
trunk/src/plcore.c
trunk/src/plvect.c
Modified: trunk/src/plcore.c
===================================================================
--- trunk/src/plcore.c 2013-11-21 12:43:11 UTC (rev 12732)
+++ trunk/src/plcore.c 2013-11-21 22:19:11 UTC (rev 12733)
@@ -2224,8 +2224,6 @@
void
c_plinit( void )
{
- PLFLT def_arrow_x[6] = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 };
- PLFLT def_arrow_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 };
PLFLT lx, ly, xpmm_loc, ypmm_loc, aspect_old, aspect_new;
PLINT inc = 0, del = 2000;
@@ -2350,7 +2348,8 @@
pllsty( 1 );
plpat( 1, &inc, &del );
- plsvect( def_arrow_x, def_arrow_y, 6, 0 );
+ // Set up default arrow style;
+ plsvect( NULL, NULL, 6, 0 );
// Set clip limits.
Modified: trunk/src/plvect.c
===================================================================
--- trunk/src/plvect.c 2013-11-21 12:43:11 UTC (rev 12732)
+++ trunk/src/plvect.c 2013-11-21 22:19:11 UTC (rev 12733)
@@ -40,12 +40,23 @@
c_plsvect( const PLFLT *arrowx, const PLFLT *arrowy, PLINT npts, PLINT fill )
{
int i;
+ PLFLT def_arrow_x[6] = { -0.5, 0.5, 0.3, 0.5, 0.3, 0.5 };
+ PLFLT def_arrow_y[6] = { 0.0, 0.0, 0.2, 0.0, -0.2, 0.0 };
if ( plsc->arrow_x )
free_mem( plsc->arrow_x );
if ( plsc->arrow_y )
free_mem( plsc->arrow_y );
+ // Reset default arrow if null pointers are passed.
+ if (arrowx == NULL && arrowy == NULL)
+ {
+ arrowx = def_arrow_x;
+ arrowy = def_arrow_y;
+ npts = 6;
+ fill = 0;
+ }
+
if ( ( ( plsc->arrow_x = (PLFLT *) malloc( (size_t) npts * sizeof ( PLFLT ) ) ) == NULL ) ||
( ( plsc->arrow_y = (PLFLT *) malloc( (size_t) npts * sizeof ( PLFLT ) ) ) == NULL ) )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|