From 434870dd73f4ac8a5c4c97a5b7808fa1d9143d9a Mon Sep 17 00:00:00 2001 From: "GMT 1999 Adam D. Moss" Date: Wed, 20 Jan 1999 22:41:38 +0000 Subject: [PATCH] Enabled the gimage->projection copy-on-write hack for RGBA/GRAYA Wed Jan 20 22:37:13 GMT 1999 Adam D. Moss * app/gimpimage.c: Enabled the gimage->projection copy-on-write hack for RGBA/GRAYA single-layer images. Masks/channels probably don't show yet when this is active. Report strangeness. Thanks. --- ChangeLog | 7 +++ app/base/tile-manager.c | 2 +- app/core/gimpimage-guides.c | 66 ++++++++++++++++++++--------- app/core/gimpimage-merge.c | 66 ++++++++++++++++++++--------- app/core/gimpimage-projection.c | 66 ++++++++++++++++++++--------- app/core/gimpimage-resize.c | 66 ++++++++++++++++++++--------- app/core/gimpimage-scale.c | 66 ++++++++++++++++++++--------- app/core/gimpimage.c | 66 ++++++++++++++++++++--------- app/core/gimpprojection-construct.c | 66 ++++++++++++++++++++--------- app/gimage_cmds.c | 1 + app/gimpimage.c | 66 ++++++++++++++++++++--------- app/tile_manager.c | 2 +- 12 files changed, 378 insertions(+), 162 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2000d736e6..270a9f9391 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Jan 20 22:37:13 GMT 1999 Adam D. Moss + + * app/gimpimage.c: Enabled the gimage->projection copy-on-write + hack for RGBA/GRAYA single-layer images. Masks/channels + probably don't show yet when this is active. Report strangeness. + Thanks. + 1999-01-20 Jay Cox * app/layers_dialog.c: connect the destroy signal of images to diff --git a/app/base/tile-manager.c b/app/base/tile-manager.c index c8ed436c01..89479dc23d 100644 --- a/app/base/tile-manager.c +++ b/app/base/tile-manager.c @@ -342,7 +342,7 @@ tile_manager_map (TileManager *tm, if (!tm->tiles) { - /* g_warning ("tile_manager_map: empty tile level - init'ing.");*/ + g_warning ("tile_manager_map: empty tile level - init'ing."); tm->tiles = g_new (Tile*, ntiles); tiles = tm->tiles; diff --git a/app/core/gimpimage-guides.c b/app/core/gimpimage-guides.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage-guides.c +++ b/app/core/gimpimage-guides.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage-merge.c +++ b/app/core/gimpimage-merge.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpimage-projection.c b/app/core/gimpimage-projection.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage-projection.c +++ b/app/core/gimpimage-projection.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpimage-resize.c b/app/core/gimpimage-resize.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage-resize.c +++ b/app/core/gimpimage-resize.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpimage-scale.c b/app/core/gimpimage-scale.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage-scale.c +++ b/app/core/gimpimage-scale.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/core/gimpprojection-construct.c b/app/core/gimpprojection-construct.c index f5e2ed37be..440bd4796c 100644 --- a/app/core/gimpprojection-construct.c +++ b/app/core/gimpprojection-construct.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/gimage_cmds.c b/app/gimage_cmds.c index 9f0fb4db17..c14550a131 100644 --- a/app/gimage_cmds.c +++ b/app/gimage_cmds.c @@ -3725,6 +3725,7 @@ duplicate (GImage *gimage) 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->construct_flag = gimage->construct_flag; new_gimage->proj_type = gimage->proj_type; new_gimage->proj_bytes = gimage->proj_bytes; new_gimage->proj_level = gimage->proj_level; diff --git a/app/gimpimage.c b/app/gimpimage.c index f5e2ed37be..440bd4796c 100644 --- a/app/gimpimage.c +++ b/app/gimpimage.c @@ -1100,6 +1100,11 @@ gimp_image_construct_layers (GimpImage *gimage, int x, int y, int w, int h) if ((layer = gimp_image_floating_sel (gimage))) floating_sel_composite (layer, x, y, w, h, FALSE); + if (!list) + { + // g_warning("g_i_c_l on layerless image."); + } + /* Note added by Raph Levien, 27 Jan 1998 This looks it was intended as an optimization, but it seems to @@ -1221,6 +1226,11 @@ gimp_image_construct_channels (GimpImage *gimage, int x, int y, int w, int h) GSList *list = gimage->channels; GSList *reverse_list = NULL; + if (!list) + { + // g_warning("g_i_c_c on channelless image."); + } + /* reverse the channel list */ while (list) { @@ -1323,19 +1333,27 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, gboolean can_use_cowproject) { -#if 0 +#if 1 int xoff, yoff; + + /* set the construct flag, used to determine if anything + * has been written to the gimage raw image yet. + */ + gimage->construct_flag = 0; - - printf("************ ty:%d by:%d op:%d\n", +/* + printf("************ [%d] ty:%d by:%d op:%d\n", + gimage->construct_flag, gimage_projection_type(gimage), gimage_projection_bytes(gimage), gimage_projection_opacity(gimage) - );fflush(stdout); + );fflush(stdout);*/ + if (gimage->layers) { gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)), &xoff, &yoff); +#if 0 printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n", (gimage->layers != NULL) , /* There's a layer. */ (!g_slist_next(gimage->layers)) , /* It's the only layer. */ @@ -1351,16 +1369,17 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, (((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */, ((xoff==0) && (yoff==0)) );fflush(stdout); +#endif } else { - printf("GIMAGE @%p HAS NO LAYERS?! %d\n", + /* printf("GIMAGE @%p HAS NO LAYERS?! %d\n", gimage, g_slist_length(gimage->layers)); - fflush(stdout); + fflush(stdout);*/ } - if (//can_use_cowproject && + if (/*can_use_cowproject &&*/ (gimage->layers) && /* There's a layer. */ (!g_slist_next(gimage->layers)) && /* It's the only layer. */ (layer_has_alpha((Layer*)(gimage->layers->data))) && /* It's !flat. */ @@ -1385,11 +1404,11 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, { PixelRegion srcPR, destPR; void * pr; - +/* g_warning("Can use cow-projection hack. Yay!"); // gimp_image_initialize_projection (gimage, x, y, w, h); - +*/ pixel_region_init (&srcPR, gimp_drawable_data (GIMP_DRAWABLE ((Layer*)(gimage->layers->data))), @@ -1397,32 +1416,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h, pixel_region_init (&destPR, gimp_image_projection (gimage), x, y, w,h, TRUE); - +/* // tile_manager_set_validate_proc(destPR.tiles, NULL); - +*/ for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr)) { - tile_manager_validate (srcPR.tiles, - srcPR.curtile); + /*if (!tile_is_valid(srcPR.curtile)) + tile_manager_validate (srcPR.tiles, + srcPR.curtile); + if (!tile_is_valid(destPR.curtile)) + tile_manager_validate (destPR.tiles, + destPR.curtile);*/ + tile_lock (destPR.curtile); + tile_lock (srcPR.curtile); tile_manager_map_over_tile (destPR.tiles, destPR.curtile, srcPR.curtile); + tile_release(srcPR.curtile, FALSE); + tile_release(destPR.curtile, TRUE); } gimage->construct_flag = 1; return; } } - - g_warning("Can NOT use cow-projection hack. Boo!"); + /* + if (gimage->layers) + g_warning("Can NOT use cow-projection hack. Boo!"); + else + g_warning("gimage has no layers! Boo!"); +*/ #endif - /* set the construct flag, used to determine if anything - * has been written to the gimage raw image yet. - */ - gimage->construct_flag = 0; - /* First, determine if the projection image needs to be * initialized--this is the case when there are no visible * layers that cover the entire canvas--either because layers diff --git a/app/tile_manager.c b/app/tile_manager.c index c8ed436c01..89479dc23d 100644 --- a/app/tile_manager.c +++ b/app/tile_manager.c @@ -342,7 +342,7 @@ tile_manager_map (TileManager *tm, if (!tm->tiles) { - /* g_warning ("tile_manager_map: empty tile level - init'ing.");*/ + g_warning ("tile_manager_map: empty tile level - init'ing."); tm->tiles = g_new (Tile*, ntiles); tiles = tm->tiles;