Make grid dots pixel-sharp.

This commit is contained in:
Přemysl Eric Janouch 2011-02-05 18:52:51 +01:00
parent 3cec64ebe8
commit 611b11508a
1 changed files with 5 additions and 2 deletions

View File

@ -1662,6 +1662,7 @@ draw_grid (GtkWidget *widget, DrawData *data)
gint grid_factor; gint grid_factor;
gdouble x_init, y_init; gdouble x_init, y_init;
gdouble x, y; gdouble x, y;
gdouble x_round, y_round;
grid_step = data->scale; grid_step = data->scale;
grid_factor = 1; grid_factor = 1;
@ -1694,8 +1695,10 @@ draw_grid (GtkWidget *widget, DrawData *data)
for (y = y_init; y <= data->exposed_rect.y + data->exposed_rect.height; for (y = y_init; y <= data->exposed_rect.y + data->exposed_rect.height;
y += grid_step) y += grid_step)
{ {
cairo_move_to (data->cr, x, y); x_round = floor (x) + 0.5;
cairo_line_to (data->cr, x, y); y_round = floor (y) + 0.5;
cairo_move_to (data->cr, x_round, y_round);
cairo_line_to (data->cr, x_round, y_round);
} }
} }
cairo_stroke (data->cr); cairo_stroke (data->cr);