From: Kaj-Michael Lang Date: Thu, 5 Jun 2008 08:53:53 +0000 (+0300) Subject: MapWidget: Add setting to enable/disable cairo antialiasing X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25782285eb480b23e2bba45af44f47b7df428e52;p=mapper MapWidget: Add setting to enable/disable cairo antialiasing --- diff --git a/libs/libgtkmap/gtkmap.c b/libs/libgtkmap/gtkmap.c index 80756d9..7ae96cb 100644 --- a/libs/libgtkmap/gtkmap.c +++ b/libs/libgtkmap/gtkmap.c @@ -83,6 +83,7 @@ struct _GtkMapPriv #ifdef WITH_CAIRO /* Cairo context for widget->window */ cairo_t *ct; + cairo_font_options_t *cf; cairo_matrix_t matrix_rotate; #endif @@ -205,6 +206,8 @@ struct _GtkMapPriv /* How wide paths are drawn */ guint draw_width; + gboolean alias; + /* Mouse related stuff */ gboolean button_down; gint mouse_x; @@ -552,6 +555,8 @@ priv->zoom_in_on_2button=FALSE; priv->rotate_angle=M_PI; priv->rotate_view=FALSE; +priv->alias=TRUE; + priv->gl=FALSE; priv->buffer=NULL; } @@ -965,6 +970,14 @@ g_debug("Expose: %d,%d %d,%d", event->area.x, event->area.y, event->area.width, #ifdef WITH_CAIRO priv->ct=gdk_cairo_create(widget->window); +priv->cf=cairo_font_options_create(); +if (priv->alias) { + cairo_set_antialias(priv->ct, CAIRO_ANTIALIAS_NONE); + cairo_font_options_set_antialias(priv->cf, CAIRO_ANTIALIAS_NONE); +} else { + cairo_set_antialias(priv->ct, CAIRO_ANTIALIAS_DEFAULT); + cairo_font_options_set_antialias(priv->cf, CAIRO_ANTIALIAS_NONE); +} #endif gtk_map_render_buffer(widget, event); @@ -989,7 +1002,9 @@ if (priv->show_center) #ifdef WITH_CAIRO cairo_destroy(priv->ct); +cairo_font_options_destroy(priv->cf); priv->ct=NULL; +priv->cf=NULL; #endif return TRUE;