[gimp/gtk3-port: 193/234] plug-ins: port map-object to GTK+ 3.x



commit 3951fdb2b2036351af76d7e8b04c7ed480f4fca7
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 16 22:03:09 2011 +0100

    plug-ins: port map-object to GTK+ 3.x

 plug-ins/map-object/map-object-preview.c |   12 ++----------
 plug-ins/map-object/map-object-preview.h |    4 ++--
 plug-ins/map-object/map-object-ui.c      |    4 ++--
 3 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-preview.c b/plug-ins/map-object/map-object-preview.c
index c81490b..47804af 100644
--- a/plug-ins/map-object/map-object-preview.c
+++ b/plug-ins/map-object/map-object-preview.c
@@ -302,22 +302,16 @@ compute_preview_image (void)
 }
 
 gboolean
-preview_expose (GtkWidget      *widget,
-                GdkEventExpose *eevent)
+preview_draw (GtkWidget *widget,
+              cairo_t   *cr)
 {
   gint startx, starty, pw, ph;
-  cairo_t *cr;
-
-  cr = gdk_cairo_create (eevent->window);
 
   pw = PREVIEW_WIDTH * mapvals.zoom;
   ph = PREVIEW_HEIGHT * mapvals.zoom;
   startx = (PREVIEW_WIDTH - pw) / 2;
   starty = (PREVIEW_HEIGHT - ph) / 2;
 
-  if (pw != PREVIEW_WIDTH || ph != PREVIEW_HEIGHT)
-    gdk_window_clear (gtk_widget_get_window (previewarea));
-
   cairo_set_source_surface (cr, preview_surface, startx, starty);
   cairo_rectangle (cr, startx, starty, pw, ph);
   cairo_clip (cr);
@@ -332,8 +326,6 @@ preview_expose (GtkWidget      *widget,
   cairo_reset_clip (cr);
   draw_lights (cr, startx, starty, pw, ph);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
diff --git a/plug-ins/map-object/map-object-preview.h b/plug-ins/map-object/map-object-preview.h
index 400b767..c1653ea 100644
--- a/plug-ins/map-object/map-object-preview.h
+++ b/plug-ins/map-object/map-object-preview.h
@@ -16,8 +16,8 @@ extern gint       lightx,lighty;
 /* ============================ */
 
 void     compute_preview_image  (void);
-gboolean preview_expose         (GtkWidget      *widget,
-                                 GdkEventExpose *eevent);
+gboolean preview_draw           (GtkWidget *widget,
+                                 cairo_t   *cr);
 gint     check_light_hit        (gint            xpos,
                                  gint            ypos);
 void     update_light           (gint            xpos,
diff --git a/plug-ins/map-object/map-object-ui.c b/plug-ins/map-object/map-object-ui.c
index e46b876..4f4db0c 100644
--- a/plug-ins/map-object/map-object-ui.c
+++ b/plug-ins/map-object/map-object-ui.c
@@ -1375,8 +1375,8 @@ main_dialog (GimpDrawable *drawable)
                     G_CALLBACK (preview_events),
                     previewarea);
 
-  g_signal_connect (previewarea, "expose-event",
-                    G_CALLBACK (preview_expose),
+  g_signal_connect (previewarea, "draw",
+                    G_CALLBACK (preview_draw),
                     previewarea);
 
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]