rem: if ((dmax_width < 0.0001) && (dmax_height < 0.0001)) {
add: if ((abs(dmax_width - dmin_width) < 0.0001) || (abs(dmax_height - dmin_height) < 0.0001)) {
context: redraw_pixmap(GtkWidget *widget){    int i;    int background_polarity = POSITIVE;    int last_negative = 0;    double dmax_width = 0.0, dmax_height = 0.0;    int max_width = 0, max_height = 0;    GdkGC *gc = gdk_gc_new(widget->window);    GdkRectangle update_rect;    int file_loaded = 0;    GdkWindow *window;    int retval = TRUE;    window = gtk_widget_get_parent_window(widget);    /* This might be lengthy, show that we're busy by changing the pointer */    if (window) {	GdkCursor *cursor;	cursor = gdk_cursor_new(GDK_WATCH);	gdk_window_set_cursor(window, cursor);	gdk_cursor_destroy(cursor);    }    /* Called first when opening window and then when resizing window */    for(i = 0; i < MAX_FILES; i++) {	if (g_main_pending()) {	    /* Set idle function to ensure we wont miss to redraw */	    start_idle_redraw_pixmap(screen.drawing_area);	    goto redraw_pixmap_end;	}	if (screen.file[i]) {	    file_loaded = 1;	    /* 	     * Find the biggest image and use as a size reference	     */	    dmax_width  = MAX(screen.file[i]->image->info->max_x, dmax_width);	    dmax_height = MAX(screen.file[i]->image->info->max_y, dmax_height);	    /* 	     * Find out if any active layer is negative and 	     * what the last negative layer is 	     */	    if (screen.file[i]->image->info->polarity == NEGATIVE &&		GTK_TOGGLE_BUTTON(screen.layer_button[i])->active) {		last_negative = i;		background_polarity = NEGATIVE;	    }	}    }    /*     * Paranoia check     */    if ((dmax_width < 0.0001) && (dmax_height < 0.0001)) {	retval = FALSE;	goto redraw_pixmap_end;    }    /*     * Setup scale etc first time we load a file     */    if (file_loaded && screen.scale == 0) autoscale();    /*     * Make picture a little bit bigger so things on the edges comes     * inside.     */    dmax_width += 0.1 , dmax_height += 0.1;    /*     * Scale width to actual windows size.     * Screen.scale inside to reduce rounding error.     */    max_width = (int)floor(dmax_width * (double)screen.scale);    max_height = (int)floor(dmax_height * (double)screen.scale);    if (background_polarity == NEGATIVE) {	/* Set background to normal color for the last negative layer */	gdk_gc_set_foreground(gc, screen.file[last_negative]->color);    } else {	/* Background to black */	gdk_gc_set_foreground(gc, screen.background);    }    /*      * Remove old pixmap, allocate a new one and draw the background     */    if (screen.pixmap) 	gdk_pixmap_unref(screen.pixmap);    screen.pixmap = gdk_pixmap_new(widget->window, max_width, max_height,  -1);    gdk_draw_rectangle(screen.pixmap, gc, TRUE, 0, 0, max_width, max_height);        /* This now allows drawing several layers on top of each other.       Higher layer numbers have higher priority in the Z-order. */    for(i = 0; i < MAX_FILES; i++) {	/* Do some events so we don't lag to much behind */	gtk_main_iteration_do(FALSE);	if (g_main_pending()) {	    /* Set idle function to ensure we wont miss to redraw */	    start_idle_redraw_pixmap(screen.drawing_area);	    goto redraw_pixmap_end;	}	if (GTK_TOGGLE_BUTTON(screen.layer_button[i])->active &&	    screen.file[i]) {	    image2pixmap(&screen.pixmap, screen.file[i]->image, 			 screen.scale, 			 0, max_height,			 screen.file[i]->image->info->polarity,			 screen.file[i]->color,			 screen.background, screen.err_color);	}    }    update_rect.x = 0, update_rect.y = 0;    update_rect.width =	widget->allocation.width;    update_rect.height = widget->allocation.height;    /*     * Calls expose_event     */    gtk_widget_draw(widget, &update_rect);redraw_pixmap_end:    /* Return default pointer shape */    if (window) {	gdk_window_set_cursor(window, GERBV_DEF_CURSOR);    }    gdk_gc_unref(gc);    return retval;} /* redraw_pixmap */