Commit c3d66ee2 authored by BST 1998 Adam D. Moss's avatar BST 1998 Adam D. Moss Committed by Adam D. Moss
Browse files

Resizing image canvases should be less horrible to look at. I've removed

Sat Oct  3 21:01:34 BST 1998 Adam D. Moss <adam@gimp.org>

	* app/channel.c app/channel_ops.c app/disp_callbacks.c
	app/floating_sel.c app/gdisplay.c app/gdisplay.h
	app/gdisplay_ops.c app/gimpimage.c app/image_map.c
	app/interface.c app/layers_dialog.c app/plug_in.c app/undo.c
	app/xcf.c:

	Resizing image canvases should be less horrible to look at.
	I've removed the implicit clear of the whole area when a
	window is resized by the user, and clear the exposed area around
	the image manually when appropriate.

	Dialogs which want synchronous updates for previews and
	such use displays_update_now().

	Removed some old debugging nonsense which I don't want any more.
parent e99f37ab
Sat Oct 3 21:01:34 BST 1998 Adam D. Moss <adam@gimp.org>
* app/channel.c app/channel_ops.c app/disp_callbacks.c
app/floating_sel.c app/gdisplay.c app/gdisplay.h
app/gdisplay_ops.c app/gimpimage.c app/image_map.c
app/interface.c app/layers_dialog.c app/plug_in.c app/undo.c
app/xcf.c:
Resizing image canvases should be less horrible to look at.
I've removed the implicit clear of the whole area when a
window is resized by the user, and clear the exposed area around
the image manually when appropriate.
Dialogs which want synchronous updates for previews and
such use displays_update_now().
Removed some old debugging nonsense which I don't want any more.
Thu Oct 1 22:39:14 BST 1998 Andy Thomas <alt@picnic.demon.co.uk>
* app/patterns.c app/pattern_select.c app/internal_procs.c
......
......@@ -3026,8 +3026,6 @@ plug_in_disconnect_cancel (PlugIn *plug_in)
{
GDisplay *gdisp = NULL;
/*printf("\nplug_in_disconnect_cancel\n");fflush(stdout);*/
gdisp = gdisplay_get_ID (plug_in->progress_gdisp_ID);
gtk_widget_set_sensitive (gdisp->cancelbutton, FALSE);
......@@ -3065,7 +3063,6 @@ plug_in_progress_init (PlugIn *plug_in,
context_id, message);
plug_in->progress_gdisp_ID = gdisp_ID;
/*printf("\nHERE\n");fflush(stdout);*/
gtk_signal_connect (GTK_OBJECT (gdisp->cancelbutton), "clicked",
(GtkSignalFunc) plug_in_progress_cancel,
plug_in);
......
......@@ -271,8 +271,6 @@ channel_scale (Channel *channel, int new_width, int new_height)
if (new_width == 0 || new_height == 0)
return;
printf(" channel_scale ");fflush(stdout);
/* Update the old channel position */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
......@@ -316,8 +314,6 @@ channel_resize (Channel *channel, int new_width, int new_height,
if (!new_width || !new_height)
return;
printf(" channel_resize ");fflush(stdout);
x1 = BOUNDS (offx, 0, new_width);
y1 = BOUNDS (offy, 0, new_height);
x2 = BOUNDS ((offx + GIMP_DRAWABLE(channel)->width), 0, new_width);
......
......@@ -431,17 +431,17 @@ offset (GImage *gimage,
}
/* push an undo */
drawable_apply_image (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable),
drawable_apply_image (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable),
drawable_data (drawable), FALSE);
/* swap the tiles */
drawable->tiles = new_tiles;
printf(" offset ");fflush(stdout);
/* update the drawable */
drawable_update (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable));
drawable_update (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable));
}
/*
......
......@@ -271,8 +271,6 @@ channel_scale (Channel *channel, int new_width, int new_height)
if (new_width == 0 || new_height == 0)
return;
printf(" channel_scale ");fflush(stdout);
/* Update the old channel position */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
......@@ -316,8 +314,6 @@ channel_resize (Channel *channel, int new_width, int new_height,
if (!new_width || !new_height)
return;
printf(" channel_resize ");fflush(stdout);
x1 = BOUNDS (offx, 0, new_width);
y1 = BOUNDS (offy, 0, new_height);
x2 = BOUNDS ((offx + GIMP_DRAWABLE(channel)->width), 0, new_width);
......
......@@ -271,8 +271,6 @@ channel_scale (Channel *channel, int new_width, int new_height)
if (new_width == 0 || new_height == 0)
return;
printf(" channel_scale ");fflush(stdout);
/* Update the old channel position */
drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height);
......@@ -316,8 +314,6 @@ channel_resize (Channel *channel, int new_width, int new_height,
if (!new_width || !new_height)
return;
printf(" channel_resize ");fflush(stdout);
x1 = BOUNDS (offx, 0, new_width);
y1 = BOUNDS (offy, 0, new_height);
x2 = BOUNDS ((offx + GIMP_DRAWABLE(channel)->width), 0, new_width);
......
......@@ -431,17 +431,17 @@ offset (GImage *gimage,
}
/* push an undo */
drawable_apply_image (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable),
drawable_apply_image (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable),
drawable_data (drawable), FALSE);
/* swap the tiles */
drawable->tiles = new_tiles;
printf(" offset ");fflush(stdout);
/* update the drawable */
drawable_update (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable));
drawable_update (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable));
}
/*
......
......@@ -431,17 +431,17 @@ offset (GImage *gimage,
}
/* push an undo */
drawable_apply_image (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable),
drawable_apply_image (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable),
drawable_data (drawable), FALSE);
/* swap the tiles */
drawable->tiles = new_tiles;
printf(" offset ");fflush(stdout);
/* update the drawable */
drawable_update (drawable, 0, 0, drawable_width (drawable), drawable_height (drawable));
drawable_update (drawable, 0, 0,
drawable_width (drawable), drawable_height (drawable));
}
/*
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -1133,9 +1133,9 @@ undo_pop_layer (GImage *gimage,
floating_sel_reset (lu->layer);
}
/*printf (" undo_pop1 ");fflush(stdout);*/
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height);
/*reinit_layer_idlerender (gimage, lu->layer);*/
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0,
GIMP_DRAWABLE(lu->layer)->width,
GIMP_DRAWABLE(lu->layer)->height);
}
/* restore layer */
else
......@@ -1152,13 +1152,14 @@ undo_pop_layer (GImage *gimage,
gimage->floating_sel = lu->layer;
/* add the new layer */
gimage->layers = g_slist_insert (gimage->layers, lu->layer, lu->prev_position);
gimage->layers = g_slist_insert (gimage->layers, lu->layer,
lu->prev_position);
gimage->layer_stack = g_slist_prepend (gimage->layer_stack, lu->layer);
gimage->active_layer = lu->layer;
/*printf (" undo_pop2 ");fflush(stdout);*/
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0, GIMP_DRAWABLE(lu->layer)->width, GIMP_DRAWABLE(lu->layer)->height);
/*reinit_layer_idlerender (gimage, lu->layer);*/
drawable_update (GIMP_DRAWABLE(lu->layer), 0, 0,
GIMP_DRAWABLE(lu->layer)->width,
GIMP_DRAWABLE(lu->layer)->height);
}
return TRUE;
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -85,7 +85,7 @@ image_map_do (gpointer data)
if (_image_map->gdisp)
{
drawable_update ( (_image_map->drawable), x, y, w, h);
gdisplay_flush (_image_map->gdisp);
gdisplay_flush_now (_image_map->gdisp);
}
_image_map->pr = pixel_regions_process (_image_map->pr);
......
......@@ -211,8 +211,6 @@ floating_sel_to_layer (Layer *layer)
msw@gimp.org
*/
printf(" floating_sel_to_layer ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(layer), 0, 0,
GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
......
......@@ -2034,8 +2034,6 @@ gimp_image_merge_layers (GimpImage *gimage, GSList *merge_list, MergeType merge_
gtk_signal_emit(GTK_OBJECT(gimage), gimp_image_signals[RESTRUCTURE]);
printf(" gimp_image_merge_layers ");fflush(stdout);
drawable_update (GIMP_DRAWABLE(merge_layer), 0, 0, drawable_width (GIMP_DRAWABLE(merge_layer)), drawable_height (GIMP_DRAWABLE(merge_layer)));
/*reinit_layer_idlerender (gimage, merge_layer);*/
......
......@@ -119,7 +119,7 @@ gdisplay_new (GimpImage *gimage,
gdisp->progressid = FALSE;
gdisp->idle_render.idleid = -1;
gdisp->idle_render.handlerid = -1;
/*gdisp->idle_render.handlerid = -1;*/
gdisp->idle_render.update_areas = NULL;
gdisp->idle_render.active = FALSE;
......@@ -337,6 +337,11 @@ idle_render_next_area (GDisplay *gdisp)
}
/* Unless specified otherwise, display re-rendering is organised
by IdleRender, which amalgamates areas to be re-rendered and
breaks them into bite-sized chunks which are chewed on in a low-
priority idle thread. This greatly improves responsiveness for
many GIMP operations. -- Adam */
static int
idlerender_callback (gpointer data)
{
......@@ -607,7 +612,8 @@ gdisplay_draw_guide (GDisplay *gdisp,
values.foreground.pixel = gdisplay_black_pixel (gdisp);
values.background.pixel = g_normal_guide_pixel;
values.fill = GDK_OPAQUE_STIPPLED;
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window, (char*) stipple, 8, 1);
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window,
(char*) stipple, 8, 1);
normal_hgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
......@@ -624,7 +630,8 @@ gdisplay_draw_guide (GDisplay *gdisp,
values.foreground.pixel = gdisplay_black_pixel (gdisp);
values.background.pixel = g_normal_guide_pixel;
values.fill = GDK_OPAQUE_STIPPLED;
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window, (char*) stipple, 1, 8);
values.stipple = gdk_bitmap_create_from_data (gdisp->canvas->window,
(char*) stipple, 1, 8);
normal_vgc = gdk_gc_new_with_values (gdisp->canvas->window, &values,
GDK_GC_FOREGROUND |
GDK_GC_BACKGROUND |
......@@ -640,7 +647,9 @@ gdisplay_draw_guide (GDisplay *gdisp,
}
gdisplay_transform_coords (gdisp, 0, 0, &x1, &y1, FALSE);
gdisplay_transform_coords (gdisp, gdisp->gimage->width, gdisp->gimage->height, &x2, &y2, FALSE);
gdisplay_transform_coords (gdisp,
gdisp->gimage->width, gdisp->gimage->height,
&x2, &y2, FALSE);
gdk_window_get_size (gdisp->canvas->window, &w, &h);
if (x1 < 0) x1 = 0;
......@@ -1002,36 +1011,53 @@ gdisplay_display_area (GDisplay *gdisp,
x2 = BOUNDS (x + w, 0, gdisp->disp_width);
y2 = BOUNDS (y + h, 0, gdisp->disp_height);
if (x1 < gdisp->disp_xoffset)
if (y1 < gdisp->disp_yoffset)
{
gdk_window_clear_area (gdisp->canvas->window,
x, y, gdisp->disp_xoffset - x, h);
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x, y, w, gdisp->disp_yoffset - y);
/* X X X
. # .
. . . */
x1 = gdisp->disp_xoffset;
y1 = gdisp->disp_yoffset;
}
if (y1 < gdisp->disp_yoffset)
if (x1 < gdisp->disp_xoffset)
{
gdk_window_clear_area (gdisp->canvas->window,
x, y, w, gdisp->disp_yoffset - y);
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x, y1, gdisp->disp_xoffset - x, h);
/* . . .
X # .
X . . */
y1 = gdisp->disp_yoffset;
x1 = gdisp->disp_xoffset;
}
if (x2 > (gdisp->disp_xoffset + sx))
{
gdk_window_clear_area (gdisp->canvas->window,
gdisp->disp_xoffset + sx, y,
x2 - (gdisp->disp_xoffset + sx), h);
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
gdisp->disp_xoffset + sx, y1,
x2 - (gdisp->disp_xoffset + sx), h - (y1-y));
/* . . .
. # X
. . X */
x2 = gdisp->disp_xoffset + sx;
}
if (y2 > (gdisp->disp_yoffset + sy))
{
gdk_window_clear_area (gdisp->canvas->window,
x, gdisp->disp_yoffset + sy,
w, y2 - (gdisp->disp_yoffset + sy));
gdk_draw_rectangle (gdisp->canvas->window,
gdisp->canvas->style->bg_gc[GTK_STATE_NORMAL], 1,
x1, gdisp->disp_yoffset + sy,
x2-x1,
y2 - (gdisp->disp_yoffset + sy));
/* . . .
. # .
. X . */
y2 = gdisp->disp_yoffset + sy;
}
......@@ -1040,9 +1066,10 @@ gdisplay_display_area (GDisplay *gdisp,
for (i = y1; i < y2; i += GXIMAGE_HEIGHT)
for (j = x1; j < x2; j += GXIMAGE_WIDTH)
{
dx = (x2 - j < GXIMAGE_WIDTH) ? x2 - j : GXIMAGE_WIDTH;
dy = (y2 - i < GXIMAGE_HEIGHT) ? y2 - i : GXIMAGE_HEIGHT;
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset, dx, dy);
dx = MIN (x2 - j, GXIMAGE_WIDTH);
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset,
dx, dy);
gximage_put (gdisp->canvas->window,
j, i, dx, dy,
gdisp->offset_x,
......
......@@ -49,7 +49,7 @@ typedef struct _IdleRenderStruct
int basex;
int basey;
guint idleid;
guint handlerid;
/*guint handlerid;*/
gboolean active;
GSList *update_areas; /* flushed update areas */
......@@ -135,6 +135,7 @@ void gdisplay_expose_area (GDisplay *, int, int, int, int);
void gdisplay_expose_guide (GDisplay *, Guide *);
void gdisplay_expose_full (GDisplay *);
void gdisplay_flush (GDisplay *);
void gdisplay_flush_now (GDisplay *);
void gdisplay_draw_guides (GDisplay *);
void gdisplay_draw_guide (GDisplay *, Guide *, int);
Guide* gdisplay_find_guide (GDisplay *, int, int);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment