From de2313faf354a12f2779252df2c941b20f09fb26 Mon Sep 17 00:00:00 2001 From: Mark Crichton Date: Thu, 15 Jul 1999 04:58:39 +0000 Subject: [PATCH] More fixes. See ChangeLog More fixes. See ChangeLog --- demos/testpixbuf.c | 68 ++++++++++++++++++++------------------------ gdk-pixbuf/ChangeLog | 9 ++++-- gdk-pixbuf/io-gif.c | 5 +++- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c index b13b8e8c9b..488890bc87 100644 --- a/demos/testpixbuf.c +++ b/demos/testpixbuf.c @@ -42,43 +42,35 @@ quit_func (GtkWidget *widget, gpointer dummy) gtk_main_quit (); } -static void -testrgb_rgb_test (GtkWidget *drawing_area, GdkPixBuf *pixbuf) +expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data) { - guchar *buf; - gint i, j; - gint offset; - guchar val; - gdouble start_time, total_time; - gint x, y; - gboolean dither; - int dith_max; + GdkPixBuf *pixbuf = (GdkPixBuf *)data; + gint x1, y1, x2, y2; - buf = pixbuf->art_pixbuf->pixels; - x = pixbuf->art_pixbuf->width; - y = pixbuf->art_pixbuf->height; - - g_print("X: %d Y: %d\n", x, y); -while (TRUE) { if (pixbuf->art_pixbuf->has_alpha){ -g_print("32\n"); - gdk_draw_rgb_32_image (drawing_area->window, - drawing_area->style->black_gc, - 0, 0, x, y, - GDK_RGB_DITHER_MAX, - pixbuf->art_pixbuf->pixels, - pixbuf->art_pixbuf->rowstride); -}else{ -g_print("24\n"); - gdk_draw_rgb_image (drawing_area->window, - drawing_area->style->white_gc, - 0, 0, x, y, - GDK_RGB_DITHER_NORMAL, - buf, - pixbuf->art_pixbuf->rowstride); -}} - -} + gdk_draw_rgb_32_image (drawing_area->window, + drawing_area->style->black_gc, + event->area.x, event->area.y, + event->area.width, + event->area.height, + GDK_RGB_DITHER_MAX, + pixbuf->art_pixbuf->pixels + + (event->area.y * pixbuf->art_pixbuf->rowstride) + + (event->area.x * pixbuf->art_pixbuf->n_channels), + pixbuf->art_pixbuf->rowstride); + }else{ + gdk_draw_rgb_image (drawing_area->window, + drawing_area->style->white_gc, + event->area.x, event->area.y, + event->area.width, + event->area.height, + GDK_RGB_DITHER_NORMAL, + pixbuf->art_pixbuf->pixels + + (event->area.y * pixbuf->art_pixbuf->rowstride) + + (event->area.x * pixbuf->art_pixbuf->n_channels), + pixbuf->art_pixbuf->rowstride); + } +} void new_testrgb_window (GdkPixBuf *pixbuf) @@ -107,6 +99,10 @@ new_testrgb_window (GdkPixBuf *pixbuf) gtk_widget_set_usize (drawing_area, w, h); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, FALSE, FALSE, 0); + + gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event", + GTK_SIGNAL_FUNC (expose_func), pixbuf); + gtk_widget_show (drawing_area); button = gtk_button_new_with_label ("Quit"); @@ -121,9 +117,6 @@ new_testrgb_window (GdkPixBuf *pixbuf) gtk_widget_show (vbox); gtk_widget_show (window); - - - testrgb_rgb_test (drawing_area, pixbuf); } int @@ -140,6 +133,7 @@ main (int argc, char **argv) gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); gtk_widget_set_default_visual (gdk_rgb_get_visual ()); pixbuf = gdk_pixbuf_load_image ("test.gif"); + new_testrgb_window (pixbuf); gtk_main (); diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index fea237aedd..927a3df4e5 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +1999-07-14 Larry Ewing + + * src/testpixbuf.c (expose_func): added an almost proper expose + handler for testpixbuf + 1999-07-13 * configure.in: Fixed GIF check. Replaced " with ' @@ -5,6 +10,4 @@ 1999-07-13 - * configure.in: I am a bonehead. Added gif-lib check. - - + * configure.in: I am a bonehead. Added gif-lib check. \ No newline at end of file diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 57861872ac..f07a82381e 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -166,8 +166,11 @@ GdkPixBuf *image_load(FILE * f) pixbuf->art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3)); /* Ok, I'm anal...shoot me */ - if (!(pixbuf->art_pixbuf)) + if (!(pixbuf->art_pixbuf)) { + g_free(pixbuf); return NULL; + } + pixbuf->ref_count = 0; pixbuf->unref_func = NULL;