@@ -69,7 +69,7 @@ static void unregisterOne(pGEDevDesc dd, int systemNumber) {
69
69
if (dd -> gesd [systemNumber ] != NULL ) {
70
70
/* Defensive */
71
71
if (dd -> gesd [systemNumber ]-> callback != NULL ) {
72
- (dd -> gesd [systemNumber ]-> callback )(GE_FinaliseState , dd ,
72
+ (dd -> gesd [systemNumber ]-> callback )(GE_FinaliseState , dd ,
73
73
R_NilValue );
74
74
}
75
75
free (dd -> gesd [systemNumber ]);
@@ -161,7 +161,7 @@ void GEregisterSystem(GEcallback cb, int *systemRegisterIndex) {
161
161
* information in those devices
162
162
* If a graphics system has been unregistered, there might
163
163
* be "holes" in the list of graphics systems, so start
164
- * from zero and look for the first NULL
164
+ * from zero and look for the first NULL
165
165
*/
166
166
* systemRegisterIndex = 0 ;
167
167
while (registeredSystems [* systemRegisterIndex ] != NULL ) {
@@ -596,7 +596,7 @@ static void getClipRectToDevice(double *x1, double *y1, double *x2, double *y2,
596
596
* y2 = dd -> dev -> bottom ;
597
597
* y1 = dd -> dev -> top ;
598
598
}
599
- /*
599
+ /*
600
600
* Do NOT clip to the actual device edge (that produces artifacts).
601
601
* Instead, clip to a much larger region.
602
602
*/
@@ -1087,7 +1087,7 @@ static Rboolean mustClip(double xmin, double xmax, double ymin, double ymax,
1087
1087
clip .ymin > ymin || clip .ymax < ymax );
1088
1088
}
1089
1089
1090
- /*
1090
+ /*
1091
1091
* Reorder the vertices of a polygon that is becoming a polyline
1092
1092
* so that the first vertex is OUTSIDE the clipping area.
1093
1093
* NOTE that x & y are length n+1, but x[0] == x[n]
@@ -1113,13 +1113,13 @@ static void reorderVertices(int n, double *x, double *y, pGEDevDesc dd)
1113
1113
y [start ] >= ymin && y [start ] <= ymax ) {
1114
1114
start ++ ;
1115
1115
}
1116
- if (start == n )
1116
+ if (start == n )
1117
1117
error (_ ("Clipping polygon that does not need clipping" ));
1118
1118
for (i = 0 ; i < n ; i ++ ) {
1119
1119
x [i ] = xtemp [start ];
1120
1120
y [i ] = ytemp [start ];
1121
1121
start ++ ;
1122
- if (start == n )
1122
+ if (start == n )
1123
1123
start = 0 ;
1124
1124
}
1125
1125
x [n ] = xtemp [start ];
@@ -1173,7 +1173,7 @@ static void clipPolygon(int n, double *x, double *y,
1173
1173
} else {
1174
1174
/* If must clip, draw separate fill and border */
1175
1175
int i ;
1176
- double xmin = DBL_MAX , xmax = DBL_MIN ,
1176
+ double xmin = DBL_MAX , xmax = DBL_MIN ,
1177
1177
ymin = DBL_MAX , ymax = DBL_MIN ;
1178
1178
xc = (double * ) R_alloc (n + 1 , sizeof (double ));
1179
1179
yc = (double * ) R_alloc (n + 1 , sizeof (double ));
@@ -1494,7 +1494,7 @@ void GERect(double x0, double y0, double x1, double y1,
1494
1494
****************************************************************
1495
1495
*/
1496
1496
1497
- void GEPath (double * x , double * y ,
1497
+ void GEPath (double * x , double * y ,
1498
1498
int npoly , int * nper ,
1499
1499
Rboolean winding ,
1500
1500
const pGEcontext gc , pGEDevDesc dd )
@@ -1504,7 +1504,7 @@ void GEPath(double *x, double *y,
1504
1504
warning (_ ("path rendering is not implemented for this device" ));
1505
1505
return ;
1506
1506
}
1507
- /* FIXME: what about clipping? (if the device can't)
1507
+ /* FIXME: what about clipping? (if the device can't)
1508
1508
*/
1509
1509
if (gc -> lwd == R_PosInf || gc -> lwd < 0.0 )
1510
1510
error (_ ("'lwd' must be non-negative and finite" ));
@@ -1532,9 +1532,9 @@ void GEPath(double *x, double *y,
1532
1532
*/
1533
1533
1534
1534
void GERaster (unsigned int * raster , int w , int h ,
1535
- double x , double y ,
1535
+ double x , double y ,
1536
1536
double width , double height ,
1537
- double angle ,
1537
+ double angle ,
1538
1538
Rboolean interpolate ,
1539
1539
const pGEcontext gc , pGEDevDesc dd )
1540
1540
{
@@ -1544,11 +1544,11 @@ void GERaster(unsigned int *raster, int w, int h,
1544
1544
return ;
1545
1545
}
1546
1546
1547
- /* FIXME: what about clipping? (if the device can't)
1547
+ /* FIXME: what about clipping? (if the device can't)
1548
1548
* Maybe not too bad because it is just a matter of shaving off
1549
1549
* some rows and columns from the image? (because R only does
1550
1550
* rectangular clipping regions) */
1551
-
1551
+
1552
1552
if (width != 0 && height != 0 ) {
1553
1553
dd -> dev -> raster (raster , w , h , x , y , width , height ,
1554
1554
angle , interpolate , gc , dd -> dev );
@@ -1625,7 +1625,7 @@ static int clipTextCode(double x, double y, const char *str, cetype_t enc,
1625
1625
return clipRectCode (toDeviceX (left , GE_INCHES , dd ),
1626
1626
toDeviceY (bottom , GE_INCHES , dd ),
1627
1627
toDeviceX (right , GE_INCHES , dd ),
1628
- toDeviceY (top , GE_INCHES , dd ),
1628
+ toDeviceY (top , GE_INCHES , dd ),
1629
1629
toDevice , dd );
1630
1630
}
1631
1631
@@ -2142,7 +2142,7 @@ void GESymbol(double x, double y, int pch, double size,
2142
2142
char str [16 ]; // probably 7 would do
2143
2143
if (gc -> fontface == 5 )
2144
2144
error ("use of negative pch with symbol font is invalid" );
2145
- res = ucstoutf8 (str , - pch ); // throws error if unsuccessful
2145
+ res = ucstoutf8 (str , - pch ); // throws error if unsuccessful
2146
2146
str [res ] = '\0' ;
2147
2147
GEText (x , y , str , CE_UTF8 , NA_REAL , NA_REAL , 0. , gc , dd );
2148
2148
} else if (' ' <= pch && pch <= maxchar ) {
@@ -2482,6 +2482,9 @@ void GEPretty(double *lo, double *up, int *ndiv)
2482
2482
if ( ns * unit < * lo - rounding_eps * unit ) { ns ++ ; mod ++ ; }
2483
2483
if (nu > ns + 1 && nu * unit > * up + rounding_eps * unit ) { nu -- ; mod ++ ; }
2484
2484
if (mod ) * ndiv = (int )(nu - ns );
2485
+ #ifdef DEBUG_axis
2486
+ if (mod ) REprintf (" GEPretty(): _mod_ify -> new (ns=%g, nu=%g, ndiv=%d)\n" , ns , nu , * ndiv );
2487
+ #endif
2485
2488
}
2486
2489
* lo = ns * unit ;
2487
2490
* up = nu * unit ;
@@ -2541,10 +2544,10 @@ void GEMetricInfo(int c, const pGEcontext gc,
2541
2544
PAUL 2008-11-27
2542
2545
The point of checking dd == last_dd is to check for
2543
2546
a different TYPE of device (e.g., PDF vs. PNG).
2544
- Checking just the pGEDevDesc pointer is not a good enough
2547
+ Checking just the pGEDevDesc pointer is not a good enough
2545
2548
test; it is possible for that to be the same when one
2546
- device is closed and a new one is opened (I have seen
2547
- it happen!).
2549
+ device is closed and a new one is opened (I have seen
2550
+ it happen!).
2548
2551
So, ALSO compare dd->dev->close function pointer
2549
2552
which really should be different for different devices.
2550
2553
*/
@@ -2686,7 +2689,7 @@ double GEStrHeight(const char *str, cetype_t enc, const pGEcontext gc, pGEDevDes
2686
2689
2687
2690
* Modelled on GEText handling of encodings
2688
2691
*/
2689
- void GEStrMetric (const char * str , cetype_t enc , const pGEcontext gc ,
2692
+ void GEStrMetric (const char * str , cetype_t enc , const pGEcontext gc ,
2690
2693
double * ascent , double * descent , double * width ,
2691
2694
pGEDevDesc dd )
2692
2695
{
@@ -2719,7 +2722,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2719
2722
char * sb , * sbuf ;
2720
2723
cetype_t enc2 ;
2721
2724
int noMetricInfo ;
2722
-
2725
+
2723
2726
const void * vmax = vmaxget ();
2724
2727
2725
2728
GEMetricInfo ('M' , gc , & asc , & dsc , & wid , dd );
@@ -2741,7 +2744,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2741
2744
* sb ++ = * s ++ ;
2742
2745
}
2743
2746
* sb = '\0' ;
2744
- /* Find the largest ascent for the first line */
2747
+ /* Find the largest ascent for the first line */
2745
2748
if (noMetricInfo ) {
2746
2749
* ascent = GEStrHeight (sbuf , enc2 , gc , dd );
2747
2750
} else {
@@ -2774,14 +2777,14 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2774
2777
}
2775
2778
} else {
2776
2779
while (* s != '\0' ) {
2777
- GEMetricInfo ((unsigned char ) * s ++ , gc ,
2780
+ GEMetricInfo ((unsigned char ) * s ++ , gc ,
2778
2781
& asc , & dsc , & wid , dd );
2779
2782
if (asc > * ascent )
2780
2783
* ascent = asc ;
2781
2784
}
2782
2785
}
2783
2786
}
2784
-
2787
+
2785
2788
/* Count the lines of text minus one */
2786
2789
n = 0 ;
2787
2790
for (s = str ; * s ; s ++ )
@@ -2791,7 +2794,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2791
2794
2792
2795
/* Where is the start of the last line? */
2793
2796
if (n > 0 ) {
2794
- while (* s != '\n' )
2797
+ while (* s != '\n' )
2795
2798
s -- ;
2796
2799
s ++ ;
2797
2800
} else {
@@ -2836,7 +2839,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2836
2839
}
2837
2840
} else {
2838
2841
while (* s != '\0' ) {
2839
- GEMetricInfo ((unsigned char ) * s ++ , gc ,
2842
+ GEMetricInfo ((unsigned char ) * s ++ , gc ,
2840
2843
& asc , & dsc , & wid , dd );
2841
2844
if (dsc > * descent )
2842
2845
* descent = dsc ;
@@ -3135,22 +3138,22 @@ void GEplaySnapshot(SEXP snapshot, pGEDevDesc dd)
3135
3138
*/
3136
3139
SEXP snapshotEngineVersion ;
3137
3140
int engineVersion = R_GE_getVersion ();
3138
- PROTECT (snapshotEngineVersion = getAttrib (snapshot ,
3141
+ PROTECT (snapshotEngineVersion = getAttrib (snapshot ,
3139
3142
install ("engineVersion" )));
3140
3143
if (isNull (snapshotEngineVersion )) {
3141
3144
warning (_ ("snapshot recorded with different graphics engine version (pre 11 - this is version %d)" ),
3142
3145
engineVersion );
3143
3146
} else if (INTEGER (snapshotEngineVersion )[0 ] != engineVersion ) {
3144
3147
int snapshotVersion = INTEGER (snapshotEngineVersion )[0 ];
3145
- warning (_ ("snapshot recorded with different graphics engine version (%d - this is version %d)" ),
3148
+ warning (_ ("snapshot recorded with different graphics engine version (%d - this is version %d)" ),
3146
3149
snapshotVersion , engineVersion );
3147
3150
}
3148
3151
/* "clean" the device
3149
3152
*/
3150
3153
GEcleanDevice (dd );
3151
3154
/* Reset the snapshot state information in each registered
3152
3155
* graphics system.
3153
- * This may try to restore state for a system that was NOT
3156
+ * This may try to restore state for a system that was NOT
3154
3157
* registered when the snapshot was taken, but the systems
3155
3158
* should protect themselves from that situation.
3156
3159
*/
@@ -3164,7 +3167,7 @@ void GEplaySnapshot(SEXP snapshot, pGEDevDesc dd)
3164
3167
#ifdef R_GE_DEBUG
3165
3168
if (getenv ("R_GE_DEBUG_record" )) {
3166
3169
printf ("GEplaySnapshot: record = TRUE\n" );
3167
- }
3170
+ }
3168
3171
#endif
3169
3172
dd -> recordGraphics = TRUE;
3170
3173
/* Replay the display list
@@ -3468,14 +3471,14 @@ SEXP GE_LTYget(unsigned int lty)
3468
3471
}
3469
3472
3470
3473
/****************************************************************
3471
- *
3474
+ *
3472
3475
* Some functions for operations on raster images
3473
3476
* (for those devices that cannot do these themselves)
3474
3477
****************************************************************
3475
3478
*/
3476
3479
3477
3480
/* Some of this code is based on code from the leptonica library
3478
- * hence the following notice
3481
+ * hence the following notice
3479
3482
*/
3480
3483
3481
3484
/*====================================================================*
@@ -3493,8 +3496,8 @@ SEXP GE_LTYget(unsigned int lty)
3493
3496
- or altered from any source or modified source distribution.
3494
3497
*====================================================================*/
3495
3498
3496
- /*
3497
- * Scale a raster image to a desired size using
3499
+ /*
3500
+ * Scale a raster image to a desired size using
3498
3501
* nearest-neighbour interpolation
3499
3502
3500
3503
* draster must be pre-allocated.
@@ -3520,13 +3523,13 @@ void R_GE_rasterScale(unsigned int *sraster, int sw, int sh,
3520
3523
}
3521
3524
}
3522
3525
3523
- /*
3524
- * Scale a raster image to a desired size using
3526
+ /*
3527
+ * Scale a raster image to a desired size using
3525
3528
* bilinear interpolation
3526
3529
* Code based on scaleColorLILow() from leptonica library
3527
3530
3528
3531
* Divide each destination pixel into 16 x 16 sub-pixels.
3529
- * Linear interpolation is equivalent to finding the
3532
+ * Linear interpolation is equivalent to finding the
3530
3533
* fractional area (i.e., number of sub-pixels divided
3531
3534
* by 256) associated with each of the four nearest src pixels,
3532
3535
* and weighting each pixel value by this fractional area.
@@ -3636,16 +3639,16 @@ void R_GE_rasterRotatedSize(int w, int h, double angle,
3636
3639
double try2 = diag * sin (angle - theta );
3637
3640
* wnew = (int ) (fmax2 (fabs (trx1 ), fabs (trx2 )) + 0.5 );
3638
3641
* hnew = (int ) (fmax2 (fabs (try1 ), fabs (try2 )) + 0.5 );
3639
- /*
3642
+ /*
3640
3643
* Rotated image may be shorter or thinner than original
3641
3644
*/
3642
3645
* wnew = imax2 (w , * wnew );
3643
3646
* hnew = imax2 (h , * hnew );
3644
3647
}
3645
3648
3646
3649
/*
3647
- * Calculate offset for (left, bottom) or
3648
- * (left, top) of image
3650
+ * Calculate offset for (left, bottom) or
3651
+ * (left, top) of image
3649
3652
* to account for image rotation
3650
3653
*/
3651
3654
void R_GE_rasterRotatedOffset (int w , int h , double angle ,
@@ -3668,14 +3671,14 @@ void R_GE_rasterRotatedOffset(int w, int h, double angle,
3668
3671
}
3669
3672
}
3670
3673
3671
- /*
3672
- * Copy a raster image into the middle of a larger
3674
+ /*
3675
+ * Copy a raster image into the middle of a larger
3673
3676
* raster image (ready for rotation)
3674
3677
3675
3678
* newRaster must be pre-allocated.
3676
3679
*/
3677
- void R_GE_rasterResizeForRotation (unsigned int * sraster ,
3678
- int w , int h ,
3680
+ void R_GE_rasterResizeForRotation (unsigned int * sraster ,
3681
+ int w , int h ,
3679
3682
unsigned int * newRaster ,
3680
3683
int wnew , int hnew ,
3681
3684
const pGEcontext gc )
@@ -3699,16 +3702,16 @@ void R_GE_rasterResizeForRotation(unsigned int *sraster,
3699
3702
}
3700
3703
}
3701
3704
3702
- /*
3703
- * Rotate a raster image
3705
+ /*
3706
+ * Rotate a raster image
3704
3707
* Code based on rotateAMColorLow() from leptonica library
3705
3708
3706
3709
* draster must be pre-allocated.
3707
-
3708
- * smoothAlpha allows alpha channel to vary smoothly based on
3709
- * interpolation. If this is FALSE, then alpha values are
3710
+
3711
+ * smoothAlpha allows alpha channel to vary smoothly based on
3712
+ * interpolation. If this is FALSE, then alpha values are
3710
3713
* taken from MAX(alpha) of relevant pixels. This means that
3711
- * areas of full transparency remain fully transparent,
3714
+ * areas of full transparency remain fully transparent,
3712
3715
* areas of opacity remain opaque, edges between anything less than opacity
3713
3716
* and opacity are opaque, and edges between full transparency
3714
3717
* and semitransparency become semitransparent.
@@ -3904,8 +3907,8 @@ int R_GE_glyphFontNumVar(SEXP glyphFont) {
3904
3907
return LENGTH (VECTOR_ELT (glyphFont , glyph_font_var ));
3905
3908
}
3906
3909
3907
- /* Existence of names(glyphFont$fontVar) and
3908
- * length(names) == length(glyphFont$fontVar)
3910
+ /* Existence of names(glyphFont$fontVar) and
3911
+ * length(names) == length(glyphFont$fontVar)
3909
3912
* should be guaranteed by R code
3910
3913
*/
3911
3914
const char * R_GE_glyphFontVarAxis (SEXP glyphFont , int index ) {
@@ -4000,7 +4003,7 @@ SEXP eval_with_gd(SEXP e, SEXP rho, pGEDevDesc dd)
4000
4003
bool lock = dd -> lock ;
4001
4004
RCNTXT cntxt ;
4002
4005
SEXP result ;
4003
- if (!lock )
4006
+ if (!lock )
4004
4007
lockDevice (& cntxt , dd );
4005
4008
PROTECT (result = eval (e , rho ));
4006
4009
if (!lock )
0 commit comments