diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-12-09 23:22:46 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-12-09 23:22:46 (GMT) |
commit | 42420cfa1f406a5f0a9f062b258ece72098635b5 (patch) | |
tree | 0e497bc16a971a91b842340e9942d3f28eedddd5 /src/glibext/gcodebuffer.c | |
parent | 4dd8356e19b9e58990b2f3e0c4110aa2fe9642d1 (diff) |
Used Cairo for rendering text and tried to deal properly with Pango context / fonts.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@298 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gcodebuffer.c')
-rw-r--r-- | src/glibext/gcodebuffer.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c index 4ffc15a..4302f14 100644 --- a/src/glibext/gcodebuffer.c +++ b/src/glibext/gcodebuffer.c @@ -140,6 +140,8 @@ struct _GBufferView vmpa_t start; /* Première ligne intégrée */ vmpa_t end; /* Dernière ligne intégrée */ + GFontCache *fcache; /* Cache pour les polices */ + gint line_height; /* Hauteur maximale des lignes */ gint max_widths[BLC_COUNT]; /* Taille cachée des colonnes */ gint left_margin; /* Marge gauche + espace */ @@ -709,6 +711,7 @@ static void g_buffer_view_class_init(GBufferViewClass *class) static void g_buffer_view_init(GBufferView *buffer) { + buffer->fcache = g_font_cache_new(); } @@ -716,6 +719,7 @@ static void g_buffer_view_init(GBufferView *buffer) /****************************************************************************** * * * Paramètres : buffer = tampon à représenter à l'écran. * +* widget = composant GTK de destination pour le rendu. * * * * Description : Crée une nouvelle vue d'un tampon pour code désassemblé. * * * @@ -1088,7 +1092,7 @@ void g_buffer_view_define_extra_drawing(GBufferView *view, buffer_line_draw_fc m void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, GdkGC *gc, gint fake_x, gint fake_y, bool addr, bool code) { - GdkDrawable *drawable; /* Surface de dessin */ + cairo_t *cairo; /* Gestionnaire de rendu */ gint real_x; /* Abscisse réelle pour tampon */ gint real_y; /* Ordonnée réelle pour tampon */ @@ -1102,8 +1106,9 @@ void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, Gd size_t i; /* Boucle de parcours */ - drawable = GDK_DRAWABLE(event->window); + cairo = gdk_cairo_create(event->window); + gdk_cairo_region(cairo, event->region); real_x = fake_x + view->left_text; real_y = fake_y + event->area.y; @@ -1127,16 +1132,20 @@ void g_buffer_view_draw(const GBufferView *view, const GdkEventExpose *event, Gd for (i = first; i <= last; i++) { /* TODO : skip if... */ - + /* if (view->drawing_extra != NULL) view->drawing_extra(lines[i], drawable, gc, fake_x, y, view->drawing_data); + */ - g_buffer_line_draw(lines[i], drawable, gc, view->max_widths, real_x, y, addr, code); + g_buffer_line_draw(lines[i], cairo, view->fcache, + view->max_widths, real_x, y, addr, code); y += view->line_height; } + cairo_destroy(cairo); + } |