Skip to content

Commit ad93728

Browse files
author
maechler
committed
one more DEBUG print; eliminate trailing whitespace-diffB
git-svn-id: https://svn.r-project.org/R/trunk@88874 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 79bd01a commit ad93728

File tree

1 file changed

+55
-52
lines changed

1 file changed

+55
-52
lines changed

src/main/engine.c

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void unregisterOne(pGEDevDesc dd, int systemNumber) {
6969
if (dd->gesd[systemNumber] != NULL) {
7070
/* Defensive */
7171
if (dd->gesd[systemNumber]->callback != NULL) {
72-
(dd->gesd[systemNumber]->callback)(GE_FinaliseState, dd,
72+
(dd->gesd[systemNumber]->callback)(GE_FinaliseState, dd,
7373
R_NilValue);
7474
}
7575
free(dd->gesd[systemNumber]);
@@ -161,7 +161,7 @@ void GEregisterSystem(GEcallback cb, int *systemRegisterIndex) {
161161
* information in those devices
162162
* If a graphics system has been unregistered, there might
163163
* 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
165165
*/
166166
*systemRegisterIndex = 0;
167167
while (registeredSystems[*systemRegisterIndex] != NULL) {
@@ -596,7 +596,7 @@ static void getClipRectToDevice(double *x1, double *y1, double *x2, double *y2,
596596
*y2 = dd->dev->bottom;
597597
*y1 = dd->dev->top;
598598
}
599-
/*
599+
/*
600600
* Do NOT clip to the actual device edge (that produces artifacts).
601601
* Instead, clip to a much larger region.
602602
*/
@@ -1087,7 +1087,7 @@ static Rboolean mustClip(double xmin, double xmax, double ymin, double ymax,
10871087
clip.ymin > ymin || clip.ymax < ymax);
10881088
}
10891089

1090-
/*
1090+
/*
10911091
* Reorder the vertices of a polygon that is becoming a polyline
10921092
* so that the first vertex is OUTSIDE the clipping area.
10931093
* 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)
11131113
y[start] >= ymin && y[start] <= ymax) {
11141114
start++;
11151115
}
1116-
if (start == n)
1116+
if (start == n)
11171117
error(_("Clipping polygon that does not need clipping"));
11181118
for (i=0; i<n; i++) {
11191119
x[i] = xtemp[start];
11201120
y[i] = ytemp[start];
11211121
start++;
1122-
if (start == n)
1122+
if (start == n)
11231123
start = 0;
11241124
}
11251125
x[n] = xtemp[start];
@@ -1173,7 +1173,7 @@ static void clipPolygon(int n, double *x, double *y,
11731173
} else {
11741174
/* If must clip, draw separate fill and border */
11751175
int i;
1176-
double xmin = DBL_MAX, xmax = DBL_MIN,
1176+
double xmin = DBL_MAX, xmax = DBL_MIN,
11771177
ymin = DBL_MAX, ymax = DBL_MIN;
11781178
xc = (double*) R_alloc(n + 1, sizeof(double));
11791179
yc = (double*) R_alloc(n + 1, sizeof(double));
@@ -1494,7 +1494,7 @@ void GERect(double x0, double y0, double x1, double y1,
14941494
****************************************************************
14951495
*/
14961496

1497-
void GEPath(double *x, double *y,
1497+
void GEPath(double *x, double *y,
14981498
int npoly, int *nper,
14991499
Rboolean winding,
15001500
const pGEcontext gc, pGEDevDesc dd)
@@ -1504,7 +1504,7 @@ void GEPath(double *x, double *y,
15041504
warning(_("path rendering is not implemented for this device"));
15051505
return;
15061506
}
1507-
/* FIXME: what about clipping? (if the device can't)
1507+
/* FIXME: what about clipping? (if the device can't)
15081508
*/
15091509
if (gc->lwd == R_PosInf || gc->lwd < 0.0)
15101510
error(_("'lwd' must be non-negative and finite"));
@@ -1532,9 +1532,9 @@ void GEPath(double *x, double *y,
15321532
*/
15331533

15341534
void GERaster(unsigned int *raster, int w, int h,
1535-
double x, double y,
1535+
double x, double y,
15361536
double width, double height,
1537-
double angle,
1537+
double angle,
15381538
Rboolean interpolate,
15391539
const pGEcontext gc, pGEDevDesc dd)
15401540
{
@@ -1544,11 +1544,11 @@ void GERaster(unsigned int *raster, int w, int h,
15441544
return;
15451545
}
15461546

1547-
/* FIXME: what about clipping? (if the device can't)
1547+
/* FIXME: what about clipping? (if the device can't)
15481548
* Maybe not too bad because it is just a matter of shaving off
15491549
* some rows and columns from the image? (because R only does
15501550
* rectangular clipping regions) */
1551-
1551+
15521552
if (width != 0 && height != 0) {
15531553
dd->dev->raster(raster, w, h, x, y, width, height,
15541554
angle, interpolate, gc, dd->dev);
@@ -1625,7 +1625,7 @@ static int clipTextCode(double x, double y, const char *str, cetype_t enc,
16251625
return clipRectCode(toDeviceX(left, GE_INCHES, dd),
16261626
toDeviceY(bottom, GE_INCHES, dd),
16271627
toDeviceX(right, GE_INCHES, dd),
1628-
toDeviceY(top, GE_INCHES, dd),
1628+
toDeviceY(top, GE_INCHES, dd),
16291629
toDevice, dd);
16301630
}
16311631

@@ -2142,7 +2142,7 @@ void GESymbol(double x, double y, int pch, double size,
21422142
char str[16]; // probably 7 would do
21432143
if(gc->fontface == 5)
21442144
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
21462146
str[res] = '\0';
21472147
GEText(x, y, str, CE_UTF8, NA_REAL, NA_REAL, 0., gc, dd);
21482148
} else if(' ' <= pch && pch <= maxchar) {
@@ -2482,6 +2482,9 @@ void GEPretty(double *lo, double *up, int *ndiv)
24822482
if( ns * unit < *lo - rounding_eps*unit) { ns++; mod++; }
24832483
if(nu > ns + 1 && nu * unit > *up + rounding_eps*unit) { nu--; mod++; }
24842484
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
24852488
}
24862489
*lo = ns * unit;
24872490
*up = nu * unit;
@@ -2541,10 +2544,10 @@ void GEMetricInfo(int c, const pGEcontext gc,
25412544
PAUL 2008-11-27
25422545
The point of checking dd == last_dd is to check for
25432546
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
25452548
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!).
25482551
So, ALSO compare dd->dev->close function pointer
25492552
which really should be different for different devices.
25502553
*/
@@ -2686,7 +2689,7 @@ double GEStrHeight(const char *str, cetype_t enc, const pGEcontext gc, pGEDevDes
26862689
26872690
* Modelled on GEText handling of encodings
26882691
*/
2689-
void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
2692+
void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
26902693
double *ascent, double *descent, double *width,
26912694
pGEDevDesc dd)
26922695
{
@@ -2719,7 +2722,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
27192722
char *sb, *sbuf;
27202723
cetype_t enc2;
27212724
int noMetricInfo;
2722-
2725+
27232726
const void *vmax = vmaxget();
27242727

27252728
GEMetricInfo('M', gc, &asc, &dsc, &wid, dd);
@@ -2741,7 +2744,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
27412744
*sb++ = *s++;
27422745
}
27432746
*sb = '\0';
2744-
/* Find the largest ascent for the first line */
2747+
/* Find the largest ascent for the first line */
27452748
if (noMetricInfo) {
27462749
*ascent = GEStrHeight(sbuf, enc2, gc, dd);
27472750
} else {
@@ -2774,14 +2777,14 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
27742777
}
27752778
} else {
27762779
while (*s != '\0') {
2777-
GEMetricInfo((unsigned char) *s++, gc,
2780+
GEMetricInfo((unsigned char) *s++, gc,
27782781
&asc, &dsc, &wid, dd);
27792782
if (asc > *ascent)
27802783
*ascent = asc;
27812784
}
27822785
}
27832786
}
2784-
2787+
27852788
/* Count the lines of text minus one */
27862789
n = 0;
27872790
for(s = str; *s ; s++)
@@ -2791,7 +2794,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
27912794

27922795
/* Where is the start of the last line? */
27932796
if (n > 0) {
2794-
while (*s != '\n')
2797+
while (*s != '\n')
27952798
s--;
27962799
s++;
27972800
} else {
@@ -2836,7 +2839,7 @@ void GEStrMetric(const char *str, cetype_t enc, const pGEcontext gc,
28362839
}
28372840
} else {
28382841
while (*s != '\0') {
2839-
GEMetricInfo((unsigned char) *s++, gc,
2842+
GEMetricInfo((unsigned char) *s++, gc,
28402843
&asc, &dsc, &wid, dd);
28412844
if (dsc > *descent)
28422845
*descent = dsc;
@@ -3135,22 +3138,22 @@ void GEplaySnapshot(SEXP snapshot, pGEDevDesc dd)
31353138
*/
31363139
SEXP snapshotEngineVersion;
31373140
int engineVersion = R_GE_getVersion();
3138-
PROTECT(snapshotEngineVersion = getAttrib(snapshot,
3141+
PROTECT(snapshotEngineVersion = getAttrib(snapshot,
31393142
install("engineVersion")));
31403143
if (isNull(snapshotEngineVersion)) {
31413144
warning(_("snapshot recorded with different graphics engine version (pre 11 - this is version %d)"),
31423145
engineVersion);
31433146
} else if (INTEGER(snapshotEngineVersion)[0] != engineVersion) {
31443147
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)"),
31463149
snapshotVersion, engineVersion);
31473150
}
31483151
/* "clean" the device
31493152
*/
31503153
GEcleanDevice(dd);
31513154
/* Reset the snapshot state information in each registered
31523155
* 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
31543157
* registered when the snapshot was taken, but the systems
31553158
* should protect themselves from that situation.
31563159
*/
@@ -3164,7 +3167,7 @@ void GEplaySnapshot(SEXP snapshot, pGEDevDesc dd)
31643167
#ifdef R_GE_DEBUG
31653168
if (getenv("R_GE_DEBUG_record")) {
31663169
printf("GEplaySnapshot: record = TRUE\n");
3167-
}
3170+
}
31683171
#endif
31693172
dd->recordGraphics = TRUE;
31703173
/* Replay the display list
@@ -3468,14 +3471,14 @@ SEXP GE_LTYget(unsigned int lty)
34683471
}
34693472

34703473
/****************************************************************
3471-
*
3474+
*
34723475
* Some functions for operations on raster images
34733476
* (for those devices that cannot do these themselves)
34743477
****************************************************************
34753478
*/
34763479

34773480
/* Some of this code is based on code from the leptonica library
3478-
* hence the following notice
3481+
* hence the following notice
34793482
*/
34803483

34813484
/*====================================================================*
@@ -3493,8 +3496,8 @@ SEXP GE_LTYget(unsigned int lty)
34933496
- or altered from any source or modified source distribution.
34943497
*====================================================================*/
34953498

3496-
/*
3497-
* Scale a raster image to a desired size using
3499+
/*
3500+
* Scale a raster image to a desired size using
34983501
* nearest-neighbour interpolation
34993502
35003503
* draster must be pre-allocated.
@@ -3520,13 +3523,13 @@ void R_GE_rasterScale(unsigned int *sraster, int sw, int sh,
35203523
}
35213524
}
35223525

3523-
/*
3524-
* Scale a raster image to a desired size using
3526+
/*
3527+
* Scale a raster image to a desired size using
35253528
* bilinear interpolation
35263529
* Code based on scaleColorLILow() from leptonica library
35273530
35283531
* 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
35303533
* fractional area (i.e., number of sub-pixels divided
35313534
* by 256) associated with each of the four nearest src pixels,
35323535
* and weighting each pixel value by this fractional area.
@@ -3636,16 +3639,16 @@ void R_GE_rasterRotatedSize(int w, int h, double angle,
36363639
double try2 = diag*sin(angle - theta);
36373640
*wnew = (int) (fmax2(fabs(trx1), fabs(trx2)) + 0.5);
36383641
*hnew = (int) (fmax2(fabs(try1), fabs(try2)) + 0.5);
3639-
/*
3642+
/*
36403643
* Rotated image may be shorter or thinner than original
36413644
*/
36423645
*wnew = imax2(w, *wnew);
36433646
*hnew = imax2(h, *hnew);
36443647
}
36453648

36463649
/*
3647-
* Calculate offset for (left, bottom) or
3648-
* (left, top) of image
3650+
* Calculate offset for (left, bottom) or
3651+
* (left, top) of image
36493652
* to account for image rotation
36503653
*/
36513654
void R_GE_rasterRotatedOffset(int w, int h, double angle,
@@ -3668,14 +3671,14 @@ void R_GE_rasterRotatedOffset(int w, int h, double angle,
36683671
}
36693672
}
36703673

3671-
/*
3672-
* Copy a raster image into the middle of a larger
3674+
/*
3675+
* Copy a raster image into the middle of a larger
36733676
* raster image (ready for rotation)
36743677
36753678
* newRaster must be pre-allocated.
36763679
*/
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,
36793682
unsigned int *newRaster,
36803683
int wnew, int hnew,
36813684
const pGEcontext gc)
@@ -3699,16 +3702,16 @@ void R_GE_rasterResizeForRotation(unsigned int *sraster,
36993702
}
37003703
}
37013704

3702-
/*
3703-
* Rotate a raster image
3705+
/*
3706+
* Rotate a raster image
37043707
* Code based on rotateAMColorLow() from leptonica library
37053708
37063709
* 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
37103713
* 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,
37123715
* areas of opacity remain opaque, edges between anything less than opacity
37133716
* and opacity are opaque, and edges between full transparency
37143717
* and semitransparency become semitransparent.
@@ -3904,8 +3907,8 @@ int R_GE_glyphFontNumVar(SEXP glyphFont) {
39043907
return LENGTH(VECTOR_ELT(glyphFont, glyph_font_var));
39053908
}
39063909

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)
39093912
* should be guaranteed by R code
39103913
*/
39113914
const char* R_GE_glyphFontVarAxis(SEXP glyphFont, int index) {
@@ -4000,7 +4003,7 @@ SEXP eval_with_gd(SEXP e, SEXP rho, pGEDevDesc dd)
40004003
bool lock = dd->lock;
40014004
RCNTXT cntxt;
40024005
SEXP result;
4003-
if (!lock)
4006+
if (!lock)
40044007
lockDevice(&cntxt, dd);
40054008
PROTECT(result = eval(e, rho));
40064009
if (!lock)

0 commit comments

Comments
 (0)