diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-12-29 10:30:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-12-29 10:30:28 (GMT) |
commit | 9f9041e11efa71cb043425cd5e89daea0247e76c (patch) | |
tree | 84d8704c291a5efef46af1e14a2aa3544dc29455 /src/gtkext | |
parent | 403a0519ec85a156a7f306b045d9cab619302473 (diff) |
Cut binary data into several areas using all the available CPUs and less memory.
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbinarystrip.c | 42 | ||||
-rw-r--r-- | src/gtkext/gtkstatusstack.c | 10 |
2 files changed, 27 insertions, 25 deletions
diff --git a/src/gtkext/gtkbinarystrip.c b/src/gtkext/gtkbinarystrip.c index fff6a78..d1638ed 100644 --- a/src/gtkext/gtkbinarystrip.c +++ b/src/gtkext/gtkbinarystrip.c @@ -211,7 +211,7 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all { GtkBinaryStrip *strip; /* Autre version du composant */ GExeFormat *format; /* Format du binaire */ - GPortionLayer *layer; /* Couche première de portions */ + GBinPortion *portions; /* Couche première de portions */ GdkRectangle area; /* Surface du composant */ GTK_WIDGET_CLASS(gtk_binary_strip_parent_class)->size_allocate(widget, allocation); @@ -222,17 +222,17 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all return; format = g_loaded_binary_get_format(strip->binary); - layer = g_exe_format_get_main_layer(format); + portions = g_exe_format_get_portions(format); area.x = 0; area.y = 0; area.width = allocation->width; area.height = allocation->height; - if (!g_portion_layer_get_pos_from_addr(layer, &strip->cursor_addr, &area, &strip->cursor_pos)) + if (!get_binary_portion_pos_from_addr(portions, &strip->cursor_addr, &area, &strip->cursor_pos)) strip->cursor_pos = 0; - g_object_unref(G_OBJECT(layer)); + g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); } @@ -257,7 +257,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto gint height; /* Hauteur du composant */ GtkBinaryStrip *strip; /* Autre version du composant */ GExeFormat *format; /* Format du binaire */ - GPortionLayer *layer; /* Couche première de portions */ + GBinPortion *portions; /* Couche première de portions */ GdkRectangle area; /* Surface du composant */ vmpa2t addr; /* Adresse à sélectionner */ @@ -272,14 +272,14 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto strip = GTK_BINARY_STRIP(widget); format = g_loaded_binary_get_format(strip->binary); - layer = g_exe_format_get_main_layer(format); + portions = g_exe_format_get_portions(format); area.x = 0; area.y = 0; area.width = width; area.height = height; - if (g_portion_layer_get_addr_from_pos(layer, event->x, &area, &addr)) + if (get_binary_portion_addr_from_pos(portions, event->x, &area, &addr)) { copy_vmpa(&strip->cursor_addr, &addr); strip->cursor_pos = event->x; @@ -290,7 +290,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto } - g_object_unref(G_OBJECT(layer)); + g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); return FALSE; @@ -314,10 +314,10 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr) { GtkBinaryStrip *strip; /* Autre vision du composant */ + GtkStyleContext *context; /* Contexte du thème actuel */ GExeFormat *format; /* Format du binaire */ - GPortionLayer *layer; /* Couche première de portions */ + GBinPortion *portions; /* Portions de binaire */ GdkRectangle full; /* Taille totale de la surface */ - GtkStyleContext *context; /* Contexte du thème actuel */ GdkRGBA *color; /* Couleur du curseur */ strip = GTK_BINARY_STRIP(widget); @@ -325,21 +325,21 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr) if (strip->binary == NULL) return FALSE; + context = gtk_widget_get_style_context(widget); + /* Dessin des portions de binaire */ format = g_loaded_binary_get_format(strip->binary); - layer = g_exe_format_get_main_layer(format); + portions = g_exe_format_get_portions(format); full.x = 0; full.y = 1; full.width = gtk_widget_get_allocated_width(widget); full.height = gtk_widget_get_allocated_height(widget) - 1; - context = gtk_widget_get_style_context(widget); - - g_portion_layer_draw(layer, context, cr, &full); + g_binary_portion_draw(portions, context, cr, &full); - g_object_unref(G_OBJECT(layer)); + g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); /* Dessin de la position */ @@ -348,8 +348,8 @@ static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr) { cairo_set_line_width(cr, 1); - gtk_style_context_get(gtk_widget_get_style_context(widget), GTK_STATE_FLAG_NORMAL, - GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL); + gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL, + GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL); cairo_set_source_rgb(cr, color->red, color->green, color->blue); @@ -395,7 +395,7 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y gboolean result; /* Bilan à retourner */ GtkBinaryStrip *strip; /* Autre version du composant */ GExeFormat *format; /* Format du binaire */ - GPortionLayer *layer; /* Couches binaires à consulter*/ + GBinPortion *portions; /* Couches binaires à consulter*/ GdkRectangle area; /* Surface du composant */ if (keyboard) return FALSE; @@ -405,16 +405,16 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y if (strip->binary != NULL) { format = g_loaded_binary_get_format(strip->binary); - layer = g_exe_format_get_main_layer(format); + portions = g_exe_format_get_portions(format); area.x = 0; area.y = 0; area.width = gtk_widget_get_allocated_width(widget); area.height = gtk_widget_get_allocated_height(widget); - result = g_portion_layer_query_tooltip(layer, x, y, &area, tooltip); + result = query_tooltip_for_binary_portion(portions, x, y, &area, tooltip); - g_object_unref(G_OBJECT(layer)); + g_object_unref(G_OBJECT(portions)); g_object_unref(G_OBJECT(format)); } diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c index b5dc0e1..dba5145 100644 --- a/src/gtkext/gtkstatusstack.c +++ b/src/gtkext/gtkstatusstack.c @@ -527,7 +527,7 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL GExeFormat *format; /* Format de binaire à traiter */ const mrange_t *range; /* Emplacement d'instruction */ const vmpa2t *addr; /* Localisation de départ */ - GPortionLayer *layer; /* Couche première de portions */ + GBinPortion *portions; /* Couche première de portions */ GBinPortion *portion; /* Zone mémoire d'appartenance */ const char *text; /* Texte au contenu à copier */ GBinSymbol *symbol; /* Symbole présent à l'adresse */ @@ -556,9 +556,9 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL /* Zone d'appartenance */ - layer = g_exe_format_get_main_layer(format); + portions = g_exe_format_get_portions(format); - portion = g_portion_layer_find_portion_at_addr(layer, addr, (GdkRectangle []) { }); + portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { }); text = g_binary_portion_get_desc(portion); @@ -567,7 +567,9 @@ void gtk_status_stack_update_current_instruction(GtkStatusStack *stack, const GL else info->segment = strdup(_("Binary")); - g_object_unref(G_OBJECT(layer)); + g_object_unref(G_OBJECT(portion)); + + g_object_unref(G_OBJECT(portions)); /* Adresses de base */ |