diff options
author | infirit <[email protected]> | 2015-07-12 19:44:26 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-07-12 19:44:26 +0200 |
commit | 2208d0af94aeb5b68d1209ad2b11cd46c14c8d23 (patch) | |
tree | 50db1b72797858309fec008fc5fdb7f579fb9e05 /font-viewer/font-view.c | |
parent | fb522992685b334c9b5e56d3eb15f9ba2d0b3acd (diff) | |
download | mate-control-center-2208d0af94aeb5b68d1209ad2b11cd46c14c8d23.tar.bz2 mate-control-center-2208d0af94aeb5b68d1209ad2b11cd46c14c8d23.tar.xz |
Replace Gdk drawing with Cairo
Diffstat (limited to 'font-viewer/font-view.c')
-rw-r--r-- | font-viewer/font-view.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c index 3c150441..54a402dd 100644 --- a/font-viewer/font-view.c +++ b/font-viewer/font-view.c @@ -115,6 +115,7 @@ create_text_pixmap(GtkWidget *drawing_area, FT_Face face) XftFont *font; gint *sizes = NULL, n_sizes, alpha_size; FcCharSet *charset = NULL; + cairo_t *cr; GdkWindow *window = gtk_widget_get_window (drawing_area); text = pango_language_get_sample_string(NULL); @@ -201,8 +202,10 @@ create_text_pixmap(GtkWidget *drawing_area, FT_Face face) pixmap_width, pixmap_height, -1); if (!pixmap) goto end; - gdk_draw_rectangle(pixmap, gtk_widget_get_style(drawing_area)->white_gc, - TRUE, 0, 0, pixmap_width, pixmap_height); + cr = gdk_cairo_create (pixmap); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_paint (cr); + cairo_destroy (cr); xdrawable = GDK_DRAWABLE_XID(pixmap); draw = XftDrawCreate(xdisplay, xdrawable, xvisual, xcolormap); @@ -387,12 +390,14 @@ add_face_info(GtkWidget *table, gint *row_p, const gchar *uri, FT_Face face) static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, GdkPixmap *pixmap) { - gdk_draw_drawable(gtk_widget_get_window (widget), - gtk_widget_get_style (widget)->fg_gc[gtk_widget_get_state (widget)], - pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); + cairo_t *cr; + cr = gdk_cairo_create (gtk_widget_get_window (widget)); + gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0); + gdk_cairo_region (cr, event->region); + cairo_fill (cr); + + cairo_destroy (cr); + return FALSE; } #endif @@ -517,9 +522,6 @@ main(int argc, char **argv) gchar *font_file, *title; gint row; GtkWidget *window, *hbox, *table, *swin, *drawing_area; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkPixmap *pixmap; -#endif GdkColor white = { 0, 0xffff, 0xffff, 0xffff }; GtkWidget *button, *align; |