Quit on destroy.

* demos/testanimation.c (do_image):
	(do_nonprogressive): Quit on destroy.

	* demos/testpixbuf.c (main): test load-at-size.
	(expose_func): draw transparent pixbufs against a checkerboard
	pattern. (#91829)
This commit is contained in:
Matthias Clasen 2002-09-03 23:51:36 +00:00
parent 8abdfd3dcc
commit 752cd443da
8 changed files with 98 additions and 17 deletions

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -1,3 +1,12 @@
2002-09-04 Matthias Clasen <maclas@gmx.de>
* demos/testanimation.c (do_image):
(do_nonprogressive): Quit on destroy.
* demos/testpixbuf.c (main): test load-at-size.
(expose_func): draw transparent pixbufs against a checkerboard
pattern. (#91829)
2002-09-01 Soeren Sandmann <sandmann@daimi.au.dk>
* docs/reference/gtk/tmpl/gtkdialog.sgml

View File

@ -357,6 +357,12 @@ do_image (const char *filename)
start_progressive_loading (image);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (window);
return window;
@ -405,6 +411,12 @@ do_nonprogressive (const gchar *filename)
image = gtk_image_new_from_file (filename);
gtk_container_add (GTK_CONTAINER (frame), image);
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_show_all (window);
}
@ -430,4 +442,3 @@ main (int argc,
return 0;
}

View File

@ -321,16 +321,26 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
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,
gdk_pixbuf_get_pixels (pixbuf)
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
GdkPixbuf *dest;
gdk_window_set_back_pixmap (drawing_area->window, NULL, FALSE);
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
gdk_pixbuf_composite_color (pixbuf, dest,
0, 0, event->area.width, event->area.height,
-event->area.x, -event->area.y,
(double) drawing_area->allocation.width / gdk_pixbuf_get_width (pixbuf),
(double) drawing_area->allocation.height / gdk_pixbuf_get_height (pixbuf),
GDK_INTERP_BILINEAR, 255,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
gdk_pixbuf_render_to_drawable (dest, drawing_area->window, drawing_area->style->fg_gc[GTK_STATE_NORMAL],
0, 0, event->area.x, event->area.y,
event->area.width, event->area.height,
GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
g_object_unref (dest);
} else {
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc,
@ -352,8 +362,6 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
g_print ("X:%d Y:%d\n", event->width, event->height);
#if 0
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
@ -472,6 +480,7 @@ progressive_prepared_callback (GdkPixbufLoader* loader, gpointer data)
GdkPixbuf* pixbuf;
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
g_assert (pixbuf != NULL);
g_object_ref (pixbuf); /* for the RGB window */
@ -487,12 +496,9 @@ progressive_updated_callback (GdkPixbufLoader* loader, guint x, guint y, guint w
{
GtkWidget** window_loc = data;
/* g_print ("progressive_updated_callback:\n\t%d\t%d\t%d\t%d\n", x, y, width, height); */
if (*window_loc != NULL)
gtk_widget_queue_draw_area (*window_loc,
x, y, width, height);
return;
}
@ -500,6 +506,12 @@ static int readlen = 4096;
extern void pixbuf_init ();
void size_func (GdkPixbufLoader *loader, gint width, gint height, gpointer data)
{
gdk_pixbuf_loader_set_size (loader, width*2, height*2);
}
int
main (int argc, char **argv)
{
@ -587,7 +599,7 @@ main (int argc, char **argv)
found_valid = TRUE;
}
}
#if 1
#if 1
{
GtkWidget* rgb_window = NULL;
ProgressFileStatus status;
@ -598,6 +610,10 @@ main (int argc, char **argv)
status.rgbwin = &rgb_window;
status.buf = g_malloc (readlen);
g_signal_connect (pixbuf_loader, "size_prepared",
G_CALLBACK (size_func), NULL);
g_signal_connect (pixbuf_loader, "area_prepared",
G_CALLBACK (progressive_prepared_callback),
&rgb_window);