From dfee2a915a49e479345add234e453a423881d12e Mon Sep 17 00:00:00 2001 From: Vasily_Makarov Date: Mon, 30 Jan 2012 20:53:21 +0400 Subject: Correcting drawing at main DrawingArea --- saedit/interface.ui | 2 +- saedit/main.c | 9 +++------ saedit/main.h | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/saedit/interface.ui b/saedit/interface.ui index 82ed481..69c52fd 100644 --- a/saedit/interface.ui +++ b/saedit/interface.ui @@ -606,7 +606,7 @@ Reid Yaro <reidyaro@gmail.com> 120 True False - + True diff --git a/saedit/main.c b/saedit/main.c index 62e07c3..a87850f 100644 --- a/saedit/main.c +++ b/saedit/main.c @@ -45,19 +45,17 @@ cairo_surface_t *get_grid_surface(int w, int h) { return surface; } -gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info) { - if (!(event->type == GDK_EXPOSE || event->type == GDK_DAMAGE)) return FALSE; +gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info) { + if (sae_info == NULL) sae_info = gen_sae_info; int width = gtk_widget_get_allocated_width(widget), height = gtk_widget_get_allocated_height(widget); - printf("W and H: %d %d\n", width, height); - int w = 3, h = 3; - cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); + //cairo_t *cr = gdk_cairo_create(gtk_widget_get_parent_window(widget)); cairo_surface_t *surface = get_grid_surface(w, h); cairo_set_source_surface(cr, surface, width/2 - GRID_SIZE * (w + 2) * 0.5, height/2 - GRID_SIZE * (h + 2) * 0.5); @@ -79,7 +77,6 @@ gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_inf height/2 +GRID_SIZE/2 - sae_info->imageset->height + sae_info->offsetY + sae_info->sprite->offsetY + sae_info->imageset->offsetY); cairo_paint(cr); - cairo_destroy(cr); cairo_surface_destroy(surface); return FALSE; } diff --git a/saedit/main.h b/saedit/main.h index ff3eb4a..059e091 100644 --- a/saedit/main.h +++ b/saedit/main.h @@ -59,7 +59,7 @@ Keys *config; //Cairo functions cairo_surface_t *get_grid_surface(int w, int h); -gboolean darea_expose_event(GtkWidget *widget, GdkEvent *event, SAEInfo *sae_info); +gboolean darea_draw_event(GtkWidget *widget, cairo_t *cr, SAEInfo *sae_info); //String functions (common) gchar *markup_bold(gchar *str); -- cgit v1.2.3-70-g09d2