reverted the expose everything changes, I'm not sure why these went in.

1999-07-16  Larry Ewing  <lewing@gimp.org>

	* src/testpixbuf.c (expose_func): reverted the expose everything
	changes, I'm not sure why these went in.
	(config_func): bring this up to date with the new pixbuf_scale
	semantics.

	* src/gdk-pixbuf-io.c: added a couple of warnings to the module
	loading code so that poeple can diagnose problems better.

	* src/gdk-pixbuf.c (gdk_pixbux_scale): fix the borkedness, also it
	no longer allocates a new pixbuf, which make things nicer for the
	rest of the code.  Unfortunately there is still a problem with
	scaling rgba images.
This commit is contained in:
Larry Ewing
1999-07-17 20:03:34 +00:00
committed by Larry Ewing
parent f12fbc1b32
commit e9ed2c18a7
4 changed files with 87 additions and 65 deletions

View File

@ -45,29 +45,34 @@ quit_func (GtkWidget *widget, gpointer dummy)
expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
{
GdkPixBuf *pixbuf;
GdkPixBuf *pixbuf;
gint x1, y1, x2, y2;
pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
pixbuf = (GdkPixBuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
if (pixbuf->art_pixbuf->has_alpha){
gdk_draw_rgb_32_image (drawing_area->window,
drawing_area->style->black_gc,
0, 0,
pixbuf->art_pixbuf->width,
pixbuf->art_pixbuf->height,
GDK_RGB_DITHER_NORMAL,
pixbuf->art_pixbuf->pixels,
pixbuf->art_pixbuf->rowstride);
} else {
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc,
0, 0,
pixbuf->art_pixbuf->width,
pixbuf->art_pixbuf->height,
GDK_RGB_DITHER_NORMAL,
pixbuf->art_pixbuf->pixels,
pixbuf->art_pixbuf->rowstride);
}
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);
}
}
config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
@ -79,11 +84,9 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
g_print("X:%d Y:%d\n", event->width, event->height);
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
((event->height) != (pixbuf->art_pixbuf->height))) {
spb = gdk_pixbuf_scale(pixbuf, event->width, event->height);
gdk_pixbuf_free (pixbuf);
gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", spb);
}
((event->height) != (pixbuf->art_pixbuf->height)))
gdk_pixbuf_scale(pixbuf, event->width, event->height);
}
void
@ -155,14 +158,14 @@ main (int argc, char **argv)
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
i = 1;
for (i = 1; i < argc; i++) {
if (argv[i]) {
pixbuf = gdk_pixbuf_load_image (argv[i]);
if (pixbuf) {
new_testrgb_window (pixbuf);
found_valid = TRUE;
}
for (i = 1; i < argc; i++)
{
pixbuf = gdk_pixbuf_load_image (argv[i]);
if (pixbuf)
{
new_testrgb_window (pixbuf);
found_valid = TRUE;
}
}