X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xevalgraph.c;h=40d0721a52812bf35813d993b365eee25996f20f;hb=67b3a0d7c465522feb67841c7374bf863df19357;hp=625a3f216decd480013c11ec68b65a1ae1b186bc;hpb=8e37ccb580c1dc9fd8ebd094c3e701d722d10327;p=xboard.git diff --git a/xevalgraph.c b/xevalgraph.c index 625a3f2..40d0721 100644 --- a/xevalgraph.c +++ b/xevalgraph.c @@ -77,6 +77,7 @@ extern char *getenv(); #include "menus.h" #include "xboard.h" #include "evalgraph.h" +#include "xevalgraph.h" #include "gettext.h" #ifdef ENABLE_NLS @@ -113,24 +114,6 @@ static cairo_surface_t *cs; static Option *EvalCallback P((int button, int x, int y)); -static float -Color (char *col, int n) -{ - int c; - sscanf(col, "#%x", &c); - c = c >> 4*n & 255; - return c/255.; -} - -static void -SetPen(cairo_t *cr, float w, char *col, int dash) { - static const double dotted[] = {4.0, 4.0}; - static int len = sizeof(dotted) / sizeof(dotted[0]); - cairo_set_line_width (cr, w); - cairo_set_source_rgba (cr, Color(col, 4), Color(col, 2), Color(col, 0), 1.0); - if(dash) cairo_set_dash (cr, dotted, len, 0.0); -} - static void ChoosePen(cairo_t *cr, int i) { @@ -142,7 +125,7 @@ ChoosePen(cairo_t *cr, int i) SetPen(cr, 1.0, "#A0A0A0", 1); break; case PEN_BLUEDOTTED: - SetPen(cr, 0.5, "#0000FF", 1); + SetPen(cr, 1.0, "#0000FF", 1); break; case PEN_BOLDWHITE: SetPen(cr, 3.0, crWhite, 0); @@ -164,9 +147,9 @@ DrawSegment (int x, int y, int *lastX, int *lastY, enum PEN penType) if(penType != PEN_NONE) { cairo_t *cr = cairo_create(cs); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); cairo_move_to (cr, curX, curY); cairo_line_to (cr, x,y); - cairo_close_path (cr); ChoosePen(cr, penType); cairo_stroke (cr); cairo_destroy (cr); @@ -183,6 +166,7 @@ DrawRectangle (int left, int top, int right, int bottom, int side, int style) cairo_t *cr; cr = cairo_create (cs); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); cairo_rectangle (cr, left, top, right-left, bottom-top); switch(side) { @@ -206,7 +190,7 @@ DrawRectangle (int left, int top, int right, int bottom, int side, int style) void DrawEvalText (char *buf, int cbBuf, int y) { - // the magic constants 7 and 5 should really be derived from the font size somehow + // the magic constants 8 and 5 should really be derived from the font size somehow cairo_text_extents_t extents; cairo_t *cr = cairo_create(cs); @@ -219,7 +203,7 @@ DrawEvalText (char *buf, int cbBuf, int y) cairo_text_extents (cr, buf, &extents); - cairo_move_to (cr, MarginX - 2 - 7*cbBuf, y+5); + cairo_move_to (cr, MarginX - 2 - 8*cbBuf, y+5); cairo_text_path (cr, buf); cairo_set_source_rgb (cr, 0.0, 0.0, 0); cairo_fill_preserve (cr);