]> Pileus Git - ~andy/gtk/commitdiff
More fixes. See ChangeLog
authorMark Crichton <crichton@src.gnome.org>
Thu, 15 Jul 1999 04:58:39 +0000 (04:58 +0000)
committerMark Crichton <crichton@src.gnome.org>
Thu, 15 Jul 1999 04:58:39 +0000 (04:58 +0000)
More fixes.  See ChangeLog

demos/testpixbuf.c
gdk-pixbuf/ChangeLog
gdk-pixbuf/io-gif.c

index b13b8e8c9bc79f6cc09c97b1d22334702c06a7ac..488890bc87b44aeaf6c73b90c97f2eb1c3135721 100644 (file)
@@ -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;
-
-  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);
-}}
+  GdkPixBuf *pixbuf = (GdkPixBuf *)data;
+  gint x1, y1, x2, y2;
 
-}
+  if (pixbuf->art_pixbuf->has_alpha){
+    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 ();
index fea237aedd3b33c19226750287c6948d528b0b87..927a3df4e5b7f249a389861a0c04f13a0e90ff90 100644 (file)
@@ -1,3 +1,8 @@
+1999-07-14  Larry Ewing  <lewing@gimp.org>
+
+       * src/testpixbuf.c (expose_func): added an almost proper expose 
+       handler for testpixbuf
+
 1999-07-13    <crichton@gimp.org>
 
        * configure.in: Fixed GIF check.  Replaced " with '
@@ -5,6 +10,4 @@
 
 1999-07-13    <crichton@gimp.org>
 
-       * 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
index 57861872ac0c98ad5c4ce12c450ea5a96fde2420..f07a82381ecb031739ccfb242bb319b9ecc640f5 100644 (file)
@@ -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;