]> err.no Git - mapper/commitdiff
MapWidget: Add setting to enable/disable cairo antialiasing
authorKaj-Michael Lang <milang@tal.org>
Thu, 5 Jun 2008 08:53:53 +0000 (11:53 +0300)
committerKaj-Michael Lang <milang@tal.org>
Thu, 5 Jun 2008 08:53:53 +0000 (11:53 +0300)
libs/libgtkmap/gtkmap.c

index 80756d954d9b81ee774bd788ce984544a2e329ef..7ae96cb1b2461708906bb3af430decff85fbc064 100644 (file)
@@ -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;