mirror of https://github.com/GNOME/gimp.git
A few tile tweaks (stuff I messed up on the frist commit) --sg
This commit is contained in:
parent
9ccef4a648
commit
83963c3697
|
@ -1,5 +1,7 @@
|
|||
Thu Jul 9 21:23:46 1998 Scott Goehring <scott@poverty.bloomington.in.us>
|
||||
|
||||
* paint_core.c tile.c undo.c: tile tweaks.
|
||||
|
||||
* tile.c tile_manager.c tile_cache.c tile.h tile_manager.h
|
||||
tile_manager_pvt.h tile_pvt.h:
|
||||
completely redid tile management.
|
||||
|
|
|
@ -76,7 +76,7 @@ tile_lock (Tile *tile)
|
|||
TILE_MUTEX_LOCK (tile);
|
||||
tile->ref_count += 1;
|
||||
|
||||
if (tile->ref_count++ == 1)
|
||||
if (tile->ref_count == 1)
|
||||
{
|
||||
if (tile->listhead)
|
||||
{
|
||||
|
|
|
@ -613,15 +613,16 @@ undo_pop_image (GImage *gimage,
|
|||
{
|
||||
for (j = x; j < image_undo->x2; j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, FALSE, FALSE);
|
||||
if (src_tile->valid == TRUE)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
|
||||
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, TRUE);
|
||||
swap_pixels (src_tile->data, dest_tile->data,
|
||||
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
|
||||
tile_release (dest_tile, TRUE);
|
||||
tile_release (src_tile, TRUE);
|
||||
}
|
||||
tile_release (src_tile, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -615,6 +615,7 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
PixelRegion srcPR, destPR;
|
||||
Tile *undo_tile;
|
||||
int h;
|
||||
int refd;
|
||||
int pixelwidth;
|
||||
unsigned char * s, * d;
|
||||
void * pr;
|
||||
|
@ -638,9 +639,12 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
|
||||
{
|
||||
/* If the undo tile corresponding to this location is valid, use it */
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, TRUE, FALSE);
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, FALSE, FALSE);
|
||||
if (undo_tile->valid == TRUE)
|
||||
{
|
||||
refd = 1;
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, TRUE, FALSE);
|
||||
tile_lock (undo_tile->valid);
|
||||
s = undo_tile->data + srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
|
||||
srcPR.bytes * (srcPR.x % TILE_WIDTH);
|
||||
}
|
||||
|
@ -659,7 +663,8 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
d += destPR.rowstride;
|
||||
}
|
||||
|
||||
tile_release (undo_tile, FALSE);
|
||||
if (refd)
|
||||
tile_release (undo_tile, FALSE);
|
||||
}
|
||||
|
||||
return orig_buf;
|
||||
|
|
|
@ -76,7 +76,7 @@ tile_lock (Tile *tile)
|
|||
TILE_MUTEX_LOCK (tile);
|
||||
tile->ref_count += 1;
|
||||
|
||||
if (tile->ref_count++ == 1)
|
||||
if (tile->ref_count == 1)
|
||||
{
|
||||
if (tile->listhead)
|
||||
{
|
||||
|
|
|
@ -615,6 +615,7 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
PixelRegion srcPR, destPR;
|
||||
Tile *undo_tile;
|
||||
int h;
|
||||
int refd;
|
||||
int pixelwidth;
|
||||
unsigned char * s, * d;
|
||||
void * pr;
|
||||
|
@ -638,9 +639,12 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr != NULL; pr = pixel_regions_process (pr))
|
||||
{
|
||||
/* If the undo tile corresponding to this location is valid, use it */
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, TRUE, FALSE);
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, FALSE, FALSE);
|
||||
if (undo_tile->valid == TRUE)
|
||||
{
|
||||
refd = 1;
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y, 0, TRUE, FALSE);
|
||||
tile_lock (undo_tile->valid);
|
||||
s = undo_tile->data + srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
|
||||
srcPR.bytes * (srcPR.x % TILE_WIDTH);
|
||||
}
|
||||
|
@ -659,7 +663,8 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
|
|||
d += destPR.rowstride;
|
||||
}
|
||||
|
||||
tile_release (undo_tile, FALSE);
|
||||
if (refd)
|
||||
tile_release (undo_tile, FALSE);
|
||||
}
|
||||
|
||||
return orig_buf;
|
||||
|
|
|
@ -613,15 +613,16 @@ undo_pop_image (GImage *gimage,
|
|||
{
|
||||
for (j = x; j < image_undo->x2; j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, FALSE, FALSE);
|
||||
if (src_tile->valid == TRUE)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
|
||||
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, TRUE);
|
||||
swap_pixels (src_tile->data, dest_tile->data,
|
||||
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
|
||||
tile_release (dest_tile, TRUE);
|
||||
tile_release (src_tile, TRUE);
|
||||
}
|
||||
tile_release (src_tile, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue