The R Project SVN R

Rev

Rev 18809 | Rev 32429 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18809 Rev 21612
Line 79... Line 79...
79
#define DEBUG_PRINT5(a, b, c, d, e) if (debug) printf (a, b, c, d, e)
79
#define DEBUG_PRINT5(a, b, c, d, e) if (debug) printf (a, b, c, d, e)
80
 
80
 
81
 
81
 
82
/* ---------------------------------------------------------------------- */
82
/* ---------------------------------------------------------------------- */
83
 
83
 
84
static double round(double x)
84
static double myround(double x)
85
{
85
{
86
	return floor(x+0.5);
86
    return floor(x+0.5);
87
}
87
}
88
 
88
 
89
 
89
 
90
/* A structure holding everything needed for a rotated string */
90
/* A structure holding everything needed for a rotated string */
91
 
91
 
Line 364... Line 364...
364
	hot_x=0;
364
	hot_x=0;
365
    else
365
    else
366
	hot_x=(double)item->max_width/2*style.magnify;
366
	hot_x=(double)item->max_width/2*style.magnify;
367
 
367
 
368
    /* pre-calculate sin and cos */
368
    /* pre-calculate sin and cos */
369
    sin_angle=round(sin(angle)*1000.0) / 1000.0;
369
    sin_angle = myround(sin(angle)*1000.0) / 1000.0;
370
    cos_angle=round(cos(angle)*1000.0) / 1000.0;
370
    cos_angle = myround(cos(angle)*1000.0) / 1000.0;
371
 
371
 
372
    /* rotate hot_x and hot_y around bitmap centre */
372
    /* rotate hot_x and hot_y around bitmap centre */
373
    hot_xp= hot_x*cos_angle - hot_y*sin_angle;
373
    hot_xp = hot_x*cos_angle - hot_y*sin_angle;
374
    hot_yp= hot_x*sin_angle + hot_y*cos_angle;
374
    hot_yp = hot_x*sin_angle + hot_y*cos_angle;
375
 
375
 
376
    /* text background will be drawn using XFillPolygon */
376
    /* text background will be drawn using XFillPolygon */
377
    if(bg) {
377
    if(bg) {
378
	GC depth_one_gc;
378
	GC depth_one_gc;
379
	XPoint *xpoints;
379
	XPoint *xpoints;
Line 872... Line 872...
872
    XFillRectangle(dpy, canvas, font_gc, 0, 0,
872
    XFillRectangle(dpy, canvas, font_gc, 0, 0,
873
		   item->cols_in+1, item->rows_in+1);
873
		   item->cols_in+1, item->rows_in+1);
874
    XSetForeground(dpy, font_gc, 1);
874
    XSetForeground(dpy, font_gc, 1);
875
 
875
 
876
    /* pre-calculate sin and cos */
876
    /* pre-calculate sin and cos */
877
    sin_angle=round(sin(angle)*1000.0) / 1000.0;
877
    sin_angle = myround(sin(angle)*1000.0) / 1000.0;
878
    cos_angle=round(cos(angle)*1000.0) / 1000.0;
878
    cos_angle = myround(cos(angle)*1000.0) / 1000.0;
879
 
879
 
880
    /* text background will be drawn using XFillPolygon */
880
    /* text background will be drawn using XFillPolygon */
881
    item->corners_x=
881
    item->corners_x=
882
	(double *)malloc((unsigned)(4*item->nl*sizeof(double)));
882
	(double *)malloc((unsigned)(4*item->nl*sizeof(double)));
883
    if(!item->corners_x)
883
    if(!item->corners_x)
Line 1396... Line 1396...
1396
    /* dimensions horizontal text will have */
1396
    /* dimensions horizontal text will have */
1397
    cols_in=max_width;
1397
    cols_in=max_width;
1398
    rows_in=nl*height;
1398
    rows_in=nl*height;
1399
 
1399
 
1400
    /* pre-calculate sin and cos */
1400
    /* pre-calculate sin and cos */
1401
    sin_angle=round(sin(angle)*1000.0) / 1000.0;
1401
    sin_angle = myround(sin(angle)*1000.0) / 1000.0;
1402
    cos_angle=round(cos(angle)*1000.0) / 1000.0;
1402
    cos_angle = myround(cos(angle)*1000.0) / 1000.0;
1403
 
1403
 
1404
    /* y position */
1404
    /* y position */
1405
    if(align==TLEFT || align==TCENTRE || align==TRIGHT)
1405
    if(align==TLEFT || align==TCENTRE || align==TRIGHT)
1406
	hot_y=(double)rows_in/2*style.magnify;
1406
	hot_y=(double)rows_in/2*style.magnify;
1407
    else if(align==MLEFT || align==MCENTRE || align==MRIGHT)
1407
    else if(align==MLEFT || align==MCENTRE || align==MRIGHT)