diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2013-01-06 02:35:37 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2013-01-06 02:35:37 (GMT) |
commit | dcd03173f71b09f38238f50dfcf4c1db0c014c4c (patch) | |
tree | 0069e4d74bdacfd130fcf46282a32914c645a7cb /src/gtkext | |
parent | 405698182c46a82d92ccd50baa43fea5e40b1f6a (diff) |
Transferred the scale computing to the rendered view.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@319 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbufferview.c | 21 | ||||
-rw-r--r-- | src/gtkext/gtkgraphview.c | 23 | ||||
-rw-r--r-- | src/gtkext/gtklinkrenderer.c | 6 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel-int.h | 4 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.c | 8 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.h | 4 |
6 files changed, 32 insertions, 34 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 027ae5c..62a861a 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * gtkbufferview.c - affichage de tampons de lignes * - * Copyright (C) 2010-2012 Cyrille Bagard + * Copyright (C) 2010-2013 Cyrille Bagard * * This file is part of OpenIDA. * @@ -50,7 +50,7 @@ static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, vmpa_ static void gtk_buffer_view_scroll(GtkBufferView *); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ -static void gtk_buffer_view_cache_glance(GtkBufferView *, cairo_t *); +static void gtk_buffer_view_cache_glance(GtkBufferView *, cairo_t *, const GtkAllocation *, double); @@ -384,6 +384,8 @@ static void gtk_buffer_view_scroll(GtkBufferView *view) * * * Paramètres : view = composant GTK à manipuler. * * cairo = assistant pour la création de rendus. * +* area = taille de la surface réduite à disposition. * +* scale = échelle vis à vis de la taille réelle. * * * * Description : Place en cache un rendu destiné à l'aperçu graphique rapide. * * * @@ -393,19 +395,12 @@ static void gtk_buffer_view_scroll(GtkBufferView *view) * * ******************************************************************************/ -static void gtk_buffer_view_cache_glance(GtkBufferView *view, cairo_t *cairo) +static void gtk_buffer_view_cache_glance(GtkBufferView *view, cairo_t *cairo, const GtkAllocation *area, double scale) { - GtkRequisition req; /* Pleine taille de la source */ + cairo_set_line_width(cairo, 1); + cairo_set_source_rgb(cairo, 0.4, 0.4, 0.4); - gtk_widget_size_request(GTK_WIDGET(view), &req); - gtk_buffer_view_compute_real_coord(view, &req.width, &req.height); - - /* FIXME : hardcoded 20 */ - - cairo_set_line_width(cairo, 20); - cairo_set_source_rgb(cairo, 0, 0, 0); - - cairo_rectangle(cairo, 0, 0, req.width - 20, req.height - 20); + cairo_rectangle(cairo, area->x + 0.5, area->y + 0.5, area->width - 1, area->height - 1); cairo_stroke(cairo); diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index 6aedf26..aeb66ae 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -89,7 +89,7 @@ static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *, vmpa_t, static void gtk_graph_view_scroll(GtkGraphView *); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ -static void gtk_graph_view_cache_glance(GtkGraphView *, cairo_t *); +static void gtk_graph_view_cache_glance(GtkGraphView *, cairo_t *, const GtkAllocation *, double); /* Supprime tout contenu de l'afficheur de code en graphique. */ static void gtk_graph_view_reset(GtkGraphView *); @@ -490,6 +490,8 @@ static void gtk_graph_view_scroll(GtkGraphView *view) * * * Paramètres : view = composant GTK à manipuler. * * cairo = assistant pour la création de rendus. * +* area = taille de la surface réduite à disposition. * +* scale = échelle vis à vis de la taille réelle. * * * * Description : Place en cache un rendu destiné à l'aperçu graphique rapide. * * * @@ -499,25 +501,24 @@ static void gtk_graph_view_scroll(GtkGraphView *view) * * ******************************************************************************/ -static void gtk_graph_view_cache_glance(GtkGraphView *view, cairo_t *cairo) +static void gtk_graph_view_cache_glance(GtkGraphView *view, cairo_t *cairo, const GtkAllocation *area, double scale) { size_t i; /* Boucle de parcours */ - GtkAllocation *alloc; /* Emplacement d'un bloc */ - - cairo_set_line_width(cairo, 2); - cairo_set_source_rgb(cairo, 0, 0, 0); + GtkAllocation sub_area; /* Emplacement réservé */ for (i = 0; i < view->children_count; i++) { - alloc = &view->allocs[i]; - - cairo_rectangle(cairo, alloc->x, alloc->y, - alloc->width, alloc->height); + sub_area.x = view->allocs[i].x * scale; + sub_area.y = view->allocs[i].y * scale; + sub_area.width = view->allocs[i].width * scale + 1; + sub_area.height = view->allocs[i].height * scale + 1; - cairo_stroke(cairo); + gtk_view_panel_cache_glance(view->children[i], cairo, &sub_area, scale); } + cairo_scale(cairo, scale, scale); + for (i = 0; i < view->links_count; i++) _gtk_link_renderer_draw(view->links[i], cairo, false); diff --git a/src/gtkext/gtklinkrenderer.c b/src/gtkext/gtklinkrenderer.c index e37a5f1..0dbdb25 100644 --- a/src/gtkext/gtklinkrenderer.c +++ b/src/gtkext/gtklinkrenderer.c @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * gtklinkrenderer.c - liens graphiques entre différents morceaux de code * - * Copyright (C) 2009 Cyrille Bagard + * Copyright (C) 2009-2013 Cyrille Bagard * * This file is part of OpenIDA. * @@ -239,10 +239,10 @@ void _gtk_link_renderer_draw(const GtkLinkRenderer *renderer, cairo_t *cairo, bo */ cairo_set_line_width(cairo, arrow ? 1 : 2); - cairo_move_to(cairo, renderer->points[0].x, renderer->points[0].y); + cairo_move_to(cairo, renderer->points[0].x + 0.5, renderer->points[0].y); for (i = 1; i < renderer->count; i++) - cairo_line_to(cairo, renderer->points[i].x, renderer->points[i].y); + cairo_line_to(cairo, renderer->points[i].x + 0.5, renderer->points[i].y); cairo_stroke(cairo); diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h index b859f99..ee69673 100644 --- a/src/gtkext/gtkviewpanel-int.h +++ b/src/gtkext/gtkviewpanel-int.h @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * gtkviewpanel-int.h - définitions internes propre à l'affichage de contenu de binaire * - * Copyright (C) 2010-2012 Cyrille Bagard + * Copyright (C) 2010-2013 Cyrille Bagard * * This file is part of OpenIDA. * @@ -49,7 +49,7 @@ typedef bool (* get_addr_coordinates_fc) (const GtkViewPanel *, vmpa_t, gint *, typedef void (* scroll_fc) (GtkViewPanel *); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ -typedef void (* cache_glance_fc) (GtkViewPanel *, cairo_t *); +typedef void (* cache_glance_fc) (GtkViewPanel *, cairo_t *, const GtkAllocation *, double); diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index 97897a8..6d10009 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * gtkviewpanel.c - affichage de contenu de binaire * - * Copyright (C) 2010-2012 Cyrille Bagard + * Copyright (C) 2010-2013 Cyrille Bagard * * This file is part of OpenIDA. * @@ -567,6 +567,8 @@ void gtk_view_panel_scroll_to_address(GtkViewPanel *panel, vmpa_t addr) * * * Paramètres : panel = composant GTK à manipuler. * * cairo = assistant pour la création de rendus. * +* area = taille de la surface réduite à disposition. * +* scale = échelle vis à vis de la taille réelle. * * * * Description : Place en cache un rendu destiné à l'aperçu graphique rapide. * * * @@ -576,9 +578,9 @@ void gtk_view_panel_scroll_to_address(GtkViewPanel *panel, vmpa_t addr) * * ******************************************************************************/ -void gtk_view_panel_cache_glance(GtkViewPanel *panel, cairo_t *cairo) +void gtk_view_panel_cache_glance(GtkViewPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale) { if (panel->cache_glance != NULL) - panel->cache_glance(panel, cairo); + panel->cache_glance(panel, cairo, area, scale); } diff --git a/src/gtkext/gtkviewpanel.h b/src/gtkext/gtkviewpanel.h index 61df60f..59220e6 100644 --- a/src/gtkext/gtkviewpanel.h +++ b/src/gtkext/gtkviewpanel.h @@ -2,7 +2,7 @@ /* OpenIDA - Outil d'analyse de fichiers binaires * gtkviewpanel.h - prototypes pour l'affichage de contenu de binaire * - * Copyright (C) 2010-2012 Cyrille Bagard + * Copyright (C) 2010-2013 Cyrille Bagard * * This file is part of OpenIDA. * @@ -78,7 +78,7 @@ bool gtk_view_panel_contain_address(const GtkViewPanel *, vmpa_t); void gtk_view_panel_scroll_to_address(GtkViewPanel *, vmpa_t); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ -void gtk_view_panel_cache_glance(GtkViewPanel *, cairo_t *); +void gtk_view_panel_cache_glance(GtkViewPanel *, cairo_t *, const GtkAllocation *, double); |