Commit 5a493d60 authored by GMT 1999 Adam D. Moss's avatar GMT 1999 Adam D. Moss Committed by Adam D. Moss

An image's projection is now copy-on-write duplicated upon duplication of

Sun Jan 17 22:42:26 GMT 1999 Adam D. Moss <adam@gimp.org>

	* app/gdisplay.c app/gdisplay.h app/gimage_cmds.c:

	An image's projection is now copy-on-write duplicated
	upon duplication of the image.  This should save some
	time and memory for 'duplicate'.

	This needed a new function which is prototyped in gdisplay.h:
	gdisplays_finish_draw() which completes all outstanding
	idlerendered-projections (we don't want to c-o-w an
	incomplete projection).

	* app/interface.c: #include "dialog_handler.h"
parent 7d362aad
Sun Jan 17 22:42:26 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/gdisplay.c app/gdisplay.h app/gimage_cmds.c:
An image's projection is now copy-on-write duplicated
upon duplication of the image. This should save some
time and memory for 'duplicate'.
This needed a new function which is prototyped in gdisplay.h:
gdisplays_finish_draw() which completes all outstanding
idlerendered-projections (we don't want to c-o-w an
incomplete projection).
* app/interface.c: #include "dialog_handler.h"
Sun Jan 17 20:36:45 GMT 1999 Adam D. Moss <adam@gimp.org>
* app/gimage_cmds.c app/gimpimage.c app/layers_dialog.c
......@@ -90,7 +105,7 @@ Mon Jan 11 22:02:10 GMT 1999 Adam D. Moss <adam@gimp.org>
The same optimization could be implemented in lots of other
places, but I'm going to bed. Good night!
* app/gimage_cmds.c: #include <cursorutil.h>
* app/gimage_cmds.c: #include "cursorutil.h"
Mon Jan 11 21:35:44 MET 1999 Sven Neumann <sven@gimp.org>
......
......@@ -382,7 +382,6 @@ idlerender_callback (gpointer data)
{
/* FINISHED */
gdisp->idle_render.active = FALSE;
/* gdisplay_remove_override_cursor (gdisp);*/
return 0;
}
......@@ -560,6 +559,25 @@ gdisplay_flush_now (GDisplay *gdisp)
gdisplay_flush_whenever (gdisp, TRUE);
}
/* Force all gdisplays to finish their idlerender projection */
void gdisplays_finish_draw (void)
{
GSList *list = display_list;
GDisplay* gdisp;
while (list)
{
gdisp = (GDisplay*) list->data;
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
while (idlerender_callback(gdisp));
}
list = g_slist_next (list);
}
}
void
gdisplay_draw_guides (GDisplay *gdisp)
{
......
......@@ -165,6 +165,7 @@ void gdisplay_expose_guide (GDisplay *, Guide *);
void gdisplay_expose_full (GDisplay *);
void gdisplay_flush (GDisplay *);
void gdisplay_flush_now (GDisplay *);
void gdisplays_finish_draw (void);
void gdisplay_draw_guides (GDisplay *);
void gdisplay_draw_guide (GDisplay *, Guide *, int);
Guide* gdisplay_find_guide (GDisplay *, int, int);
......
......@@ -382,7 +382,6 @@ idlerender_callback (gpointer data)
{
/* FINISHED */
gdisp->idle_render.active = FALSE;
/* gdisplay_remove_override_cursor (gdisp);*/
return 0;
}
......@@ -560,6 +559,25 @@ gdisplay_flush_now (GDisplay *gdisp)
gdisplay_flush_whenever (gdisp, TRUE);
}
/* Force all gdisplays to finish their idlerender projection */
void gdisplays_finish_draw (void)
{
GSList *list = display_list;
GDisplay* gdisp;
while (list)
{
gdisp = (GDisplay*) list->data;
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
while (idlerender_callback(gdisp));
}
list = g_slist_next (list);
}
}
void
gdisplay_draw_guides (GDisplay *gdisp)
{
......
......@@ -165,6 +165,7 @@ void gdisplay_expose_guide (GDisplay *, Guide *);
void gdisplay_expose_full (GDisplay *);
void gdisplay_flush (GDisplay *);
void gdisplay_flush_now (GDisplay *);
void gdisplays_finish_draw (void);
void gdisplay_draw_guides (GDisplay *);
void gdisplay_draw_guide (GDisplay *, Guide *, int);
Guide* gdisplay_find_guide (GDisplay *, int, int);
......
......@@ -33,6 +33,7 @@
#include "general.h"
#include "interface.h"
#include "menus.h"
#include "dialog_handler.h"
#include "session.h"
#include "tools.h"
......
......@@ -33,6 +33,7 @@
#include "general.h"
#include "interface.h"
#include "menus.h"
#include "dialog_handler.h"
#include "session.h"
#include "tools.h"
......
......@@ -382,7 +382,6 @@ idlerender_callback (gpointer data)
{
/* FINISHED */
gdisp->idle_render.active = FALSE;
/* gdisplay_remove_override_cursor (gdisp);*/
return 0;
}
......@@ -560,6 +559,25 @@ gdisplay_flush_now (GDisplay *gdisp)
gdisplay_flush_whenever (gdisp, TRUE);
}
/* Force all gdisplays to finish their idlerender projection */
void gdisplays_finish_draw (void)
{
GSList *list = display_list;
GDisplay* gdisp;
while (list)
{
gdisp = (GDisplay*) list->data;
if (gdisp->idle_render.active)
{
gtk_idle_remove (gdisp->idle_render.idleid);
while (idlerender_callback(gdisp));
}
list = g_slist_next (list);
}
}
void
gdisplay_draw_guides (GDisplay *gdisp)
{
......
......@@ -165,6 +165,7 @@ void gdisplay_expose_guide (GDisplay *, Guide *);
void gdisplay_expose_full (GDisplay *);
void gdisplay_flush (GDisplay *);
void gdisplay_flush_now (GDisplay *);
void gdisplays_finish_draw (void);
void gdisplay_draw_guides (GDisplay *);
void gdisplay_draw_guide (GDisplay *, Guide *, int);
Guide* gdisplay_find_guide (GDisplay *, int, int);
......
......@@ -246,7 +246,7 @@ gimage_resize_invoker (Argument *args)
int new_width, new_height;
int offx, offy;
gimp_add_busy_cursors();
gimp_add_busy_cursors_until_idle();
success = TRUE;
if (success)
......@@ -272,8 +272,6 @@ gimage_resize_invoker (Argument *args)
if (success)
gimage_resize (gimage, new_width, new_height, offx, offy);
gimp_remove_busy_cursors(NULL);
return procedural_db_return_args (&gimage_resize_proc, success);
}
......@@ -3716,12 +3714,30 @@ duplicate (GImage *gimage)
GimpDrawable *floating_sel_drawable = NULL;
int count;
gimp_add_busy_cursors();
gimp_add_busy_cursors_until_idle();
/* Create a new image */
new_gimage = gimage_new (gimage->width, gimage->height, gimage->base_type);
gimage_disable_undo (new_gimage);
/* Copy-on-write the projection tilemanager so we don't have
to reproject the new gimage - since if we do the duplicate
operation correctly, the projection for the new gimage is
identical to that of the source. */
new_gimage->proj_type = gimage->proj_type;
new_gimage->proj_bytes = gimage->proj_bytes;
new_gimage->proj_level = gimage->proj_level;
pixel_region_init (&srcPR, gimp_image_projection (gimage), 0, 0,
gimage->width, gimage->height, FALSE);
pixel_region_init (&destPR, gimp_image_projection (new_gimage), 0, 0,
new_gimage->width, new_gimage->height, TRUE);
/* We don't want to copy a half-redrawn projection, so force
a flush. */
gdisplays_finish_draw();
copy_region(&srcPR, &destPR);
/* Copy floating layer */
floating_layer = gimage_floating_sel (gimage);
if (floating_layer)
{
......@@ -3846,8 +3862,6 @@ duplicate (GImage *gimage)
gimage_enable_undo (new_gimage);
gimp_remove_busy_cursors(NULL);
return new_gimage;
}
......
......@@ -33,6 +33,7 @@
#include "general.h"
#include "interface.h"
#include "menus.h"
#include "dialog_handler.h"
#include "session.h"
#include "tools.h"
......
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