mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 11:37:14 +00:00
tile-cache.c tile-private.h removed trailing whitespace, added some
2004-02-18 Sven Neumann <sven@gimp.org> * tile-cache.c * tile-private.h * tile.[ch]: removed trailing whitespace, added some newlines, let tile_is_valid() return a gboolean instead of a gint. * app/core/gimpimage-projection.c * app/core/gimpimage-undo-push.c * app/paint/gimppaintcore.c * app/tools/gimpinktool.c: use the return value from tile_is_valid() as a boolean.
This commit is contained in:
parent
c94f85b345
commit
fb1213290f
|
@ -40,19 +40,19 @@
|
|||
#define IDLE_SWAPPER_TIMEOUT 250
|
||||
|
||||
|
||||
static gint tile_cache_zorch_next (void);
|
||||
static void tile_cache_flush_internal (Tile *tile);
|
||||
static gboolean tile_cache_zorch_next (void);
|
||||
static void tile_cache_flush_internal (Tile *tile);
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
static gpointer tile_idle_thread (gpointer data);
|
||||
static gpointer tile_idle_thread (gpointer data);
|
||||
#else
|
||||
static gboolean tile_idle_preswap (gpointer data);
|
||||
static gboolean tile_idle_preswap (gpointer data);
|
||||
#endif
|
||||
|
||||
|
||||
static gboolean initialize = TRUE;
|
||||
|
||||
typedef struct _TileList
|
||||
typedef struct _TileList
|
||||
{
|
||||
Tile *first;
|
||||
Tile *last;
|
||||
|
@ -70,10 +70,10 @@ static pthread_t preswap_thread;
|
|||
static pthread_mutex_t dirty_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_cond_t dirty_signal = PTHREAD_COND_INITIALIZER;
|
||||
static pthread_mutex_t tile_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#define CACHE_LOCK pthread_mutex_lock(&tile_mutex)
|
||||
#define CACHE_UNLOCK pthread_mutex_unlock(&tile_mutex)
|
||||
#define CACHE_LOCK pthread_mutex_lock (&tile_mutex)
|
||||
#define CACHE_UNLOCK pthread_mutex_unlock (&tile_mutex)
|
||||
#else
|
||||
static guint idle_swapper = 0;
|
||||
static guint idle_swapper = 0;
|
||||
#define CACHE_LOCK /* nothing */
|
||||
#define CACHE_UNLOCK /* nothing */
|
||||
#endif
|
||||
|
@ -95,7 +95,7 @@ tile_cache_init (gulong tile_cache_size)
|
|||
pthread_create (&preswap_thread, NULL, &tile_idle_thread, NULL);
|
||||
#else
|
||||
idle_swapper = g_timeout_add (IDLE_SWAPPER_TIMEOUT,
|
||||
tile_idle_preswap,
|
||||
tile_idle_preswap,
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
@ -114,7 +114,9 @@ tile_cache_insert (Tile *tile)
|
|||
TileList *newlist;
|
||||
|
||||
CACHE_LOCK;
|
||||
if (tile->data == NULL) goto out;
|
||||
|
||||
if (! tile->data)
|
||||
goto out;
|
||||
|
||||
/* First check and see if the tile is already
|
||||
* in the cache. In that case we will simply place
|
||||
|
@ -124,21 +126,21 @@ tile_cache_insert (Tile *tile)
|
|||
|
||||
list = (TileList *) tile->listhead;
|
||||
|
||||
newlist = ((tile->dirty || tile->swap_offset == -1) ?
|
||||
newlist = ((tile->dirty || tile->swap_offset == -1) ?
|
||||
&dirty_list : &clean_list);
|
||||
|
||||
/* if list is NULL, the tile is not in the cache */
|
||||
|
||||
if (list)
|
||||
if (list)
|
||||
{
|
||||
/* Tile is in the cache. Remove it from its current list and
|
||||
put it at the tail of the proper list (clean or dirty) */
|
||||
|
||||
if (tile->next)
|
||||
if (tile->next)
|
||||
tile->next->prev = tile->prev;
|
||||
else
|
||||
list->last = tile->prev;
|
||||
|
||||
|
||||
if (tile->prev)
|
||||
tile->prev->next = tile->next;
|
||||
else
|
||||
|
@ -159,19 +161,13 @@ tile_cache_insert (Tile *tile)
|
|||
*/
|
||||
while ((cur_cache_size + max_tile_size) > max_cache_size)
|
||||
{
|
||||
if (!tile_cache_zorch_next())
|
||||
if (! tile_cache_zorch_next ())
|
||||
{
|
||||
g_warning ("cache: unable to find room for a tile");
|
||||
goto out;
|
||||
/* goto grump;*/
|
||||
}
|
||||
}
|
||||
|
||||
/*grump:*/
|
||||
|
||||
/* Note the increase in the number of bytes the cache
|
||||
* is referencing.
|
||||
*/
|
||||
cur_cache_size += tile_size (tile);
|
||||
}
|
||||
|
||||
|
@ -197,25 +193,24 @@ tile_cache_insert (Tile *tile)
|
|||
{
|
||||
cur_cache_dirty += tile_size (tile);
|
||||
|
||||
if (1)
|
||||
{
|
||||
#ifdef USE_PTHREADS
|
||||
pthread_mutex_lock(&dirty_mutex);
|
||||
pthread_cond_signal(&dirty_signal);
|
||||
pthread_mutex_unlock(&dirty_mutex);
|
||||
pthread_mutex_lock (&dirty_mutex);
|
||||
pthread_cond_signal (&dirty_signal);
|
||||
pthread_mutex_unlock (&dirty_mutex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
CACHE_UNLOCK;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
tile_cache_flush (Tile *tile)
|
||||
{
|
||||
CACHE_LOCK;
|
||||
|
||||
tile_cache_flush_internal (tile);
|
||||
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
|
@ -226,24 +221,21 @@ tile_cache_flush_internal (Tile *tile)
|
|||
|
||||
/* Find where the tile is in the cache.
|
||||
*/
|
||||
|
||||
|
||||
list = (TileList *) tile->listhead;
|
||||
|
||||
if (list)
|
||||
if (list)
|
||||
{
|
||||
/* Note the decrease in the number of bytes the cache
|
||||
* is referencing.
|
||||
*/
|
||||
cur_cache_size -= tile_size (tile);
|
||||
|
||||
if (list == &dirty_list)
|
||||
cur_cache_dirty -= tile_size (tile);
|
||||
|
||||
if (tile->next)
|
||||
if (tile->next)
|
||||
tile->next->prev = tile->prev;
|
||||
else
|
||||
list->last = tile->prev;
|
||||
|
||||
|
||||
if (tile->prev)
|
||||
tile->prev->next = tile->next;
|
||||
else
|
||||
|
@ -254,43 +246,47 @@ tile_cache_flush_internal (Tile *tile)
|
|||
}
|
||||
|
||||
|
||||
/* untested -- ADM */
|
||||
void
|
||||
tile_cache_set_size (gulong cache_size)
|
||||
{
|
||||
max_cache_size = cache_size;
|
||||
CACHE_LOCK;
|
||||
|
||||
max_cache_size = cache_size;
|
||||
|
||||
while (cur_cache_size > max_cache_size)
|
||||
{
|
||||
if (!tile_cache_zorch_next ())
|
||||
break;
|
||||
}
|
||||
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
static gboolean
|
||||
tile_cache_zorch_next (void)
|
||||
{
|
||||
Tile *tile;
|
||||
|
||||
if (clean_list.first)
|
||||
if (clean_list.first)
|
||||
tile = clean_list.first;
|
||||
else if (dirty_list.first)
|
||||
else if (dirty_list.first)
|
||||
tile = dirty_list.first;
|
||||
else
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
CACHE_UNLOCK;
|
||||
TILE_MUTEX_LOCK (tile);
|
||||
CACHE_LOCK;
|
||||
|
||||
tile_cache_flush_internal (tile);
|
||||
|
||||
if (tile->dirty || tile->swap_offset == -1)
|
||||
{
|
||||
tile_swap_out (tile);
|
||||
}
|
||||
|
||||
if (! tile->dirty)
|
||||
if (! tile->dirty)
|
||||
{
|
||||
g_free (tile->data);
|
||||
tile->data = NULL;
|
||||
|
@ -305,7 +301,9 @@ tile_cache_zorch_next (void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#if USE_PTHREADS
|
||||
|
||||
static gpointer
|
||||
tile_idle_thread (gpointer data)
|
||||
{
|
||||
|
@ -313,36 +311,40 @@ tile_idle_thread (gpointer data)
|
|||
TileList *list;
|
||||
gint count;
|
||||
|
||||
g_printerr ("starting tile preswapper\n");
|
||||
g_printerr ("starting tile preswapper thread\n");
|
||||
|
||||
count = 0;
|
||||
while (TRUE)
|
||||
{
|
||||
CACHE_LOCK;
|
||||
|
||||
if (count > 5 || dirty_list.first == NULL)
|
||||
{
|
||||
CACHE_UNLOCK;
|
||||
|
||||
count = 0;
|
||||
|
||||
pthread_mutex_lock (&dirty_mutex);
|
||||
pthread_cond_wait (&dirty_signal, &dirty_mutex);
|
||||
pthread_mutex_unlock (&dirty_mutex);
|
||||
|
||||
CACHE_LOCK;
|
||||
}
|
||||
|
||||
if ((tile = dirty_list.first))
|
||||
if ((tile = dirty_list.first))
|
||||
{
|
||||
CACHE_UNLOCK;
|
||||
TILE_MUTEX_LOCK (tile);
|
||||
CACHE_LOCK;
|
||||
|
||||
if (tile->dirty || tile->swap_offset == -1)
|
||||
if (tile->dirty || tile->swap_offset == -1)
|
||||
{
|
||||
list = tile->listhead;
|
||||
|
||||
if (list == &dirty_list)
|
||||
cur_cache_dirty -= tile_size (tile);
|
||||
|
||||
if (tile->next)
|
||||
if (tile->next)
|
||||
tile->next->prev = tile->prev;
|
||||
else
|
||||
list->last = tile->prev;
|
||||
|
@ -360,36 +362,37 @@ tile_idle_thread (gpointer data)
|
|||
clean_list.last->next = tile;
|
||||
else
|
||||
clean_list.first = tile;
|
||||
|
||||
|
||||
clean_list.last = tile;
|
||||
|
||||
CACHE_UNLOCK;
|
||||
|
||||
tile_swap_out (tile);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
TILE_MUTEX_UNLOCK (tile);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
CACHE_UNLOCK;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !USE_PTHREADS */
|
||||
#else /* !USE_PTHREADS */
|
||||
|
||||
static gboolean
|
||||
tile_idle_preswap (gpointer data)
|
||||
{
|
||||
Tile *tile;
|
||||
|
||||
if (cur_cache_dirty*2 < max_cache_size)
|
||||
if (cur_cache_dirty * 2 < max_cache_size)
|
||||
return TRUE;
|
||||
|
||||
if ((tile = dirty_list.first))
|
||||
|
@ -397,7 +400,8 @@ tile_idle_preswap (gpointer data)
|
|||
tile_swap_out (tile);
|
||||
|
||||
dirty_list.first = tile->next;
|
||||
if (tile->next)
|
||||
|
||||
if (tile->next)
|
||||
tile->next->prev = NULL;
|
||||
else
|
||||
dirty_list.last = NULL;
|
||||
|
@ -414,8 +418,8 @@ tile_idle_preswap (gpointer data)
|
|||
clean_list.last = tile;
|
||||
cur_cache_dirty -= tile_size (tile);
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !USE_PTHREADS */
|
||||
|
|
|
@ -37,64 +37,67 @@ struct _TileLink
|
|||
TileLink *next;
|
||||
gint tile_num; /* the number of this tile within the drawable */
|
||||
TileManager *tm; /* A pointer to the tile manager for this tile.
|
||||
* We need this in order to call the tile managers
|
||||
* validate proc whenever the tile is referenced
|
||||
* We need this in order to call the tile managers
|
||||
* validate proc whenever the tile is referenced
|
||||
* yet invalid.
|
||||
*/
|
||||
};
|
||||
|
||||
struct _Tile
|
||||
{
|
||||
gshort ref_count; /* reference count. when the reference count is
|
||||
* non-zero then the "data" for this tile must
|
||||
* be valid. when the reference count for a tile
|
||||
* is 0 then the "data" for this tile must be
|
||||
* NULL.
|
||||
*/
|
||||
gshort write_count; /* write count: number of references that are
|
||||
for write access */
|
||||
gshort share_count; /* share count: number of tile managers that
|
||||
hold this tile */
|
||||
guint dirty : 1; /* is the tile dirty? has it been modified? */
|
||||
guint valid : 1; /* is the tile valid? */
|
||||
gshort ref_count; /* reference count. when the reference count is
|
||||
* non-zero then the "data" for this tile must
|
||||
* be valid. when the reference count for a tile
|
||||
* is 0 then the "data" for this tile must be
|
||||
* NULL.
|
||||
*/
|
||||
gshort write_count; /* write count: number of references that are
|
||||
for write access */
|
||||
gshort share_count; /* share count: number of tile managers that
|
||||
hold this tile */
|
||||
guint dirty : 1; /* is the tile dirty? has it been modified? */
|
||||
guint valid : 1; /* is the tile valid? */
|
||||
|
||||
guchar bpp; /* the bytes per pixel (1, 2, 3 or 4) */
|
||||
gushort ewidth; /* the effective width of the tile */
|
||||
gushort eheight; /* the effective height of the tile
|
||||
* a tile's effective width and height may be smaller
|
||||
* (but not larger) than TILE_WIDTH and TILE_HEIGHT.
|
||||
* this is to handle edge tiles of a drawable.
|
||||
*/
|
||||
guchar bpp; /* the bytes per pixel (1, 2, 3 or 4) */
|
||||
gushort ewidth; /* the effective width of the tile */
|
||||
gushort eheight; /* the effective height of the tile
|
||||
* a tile's effective width and height may be smaller
|
||||
* (but not larger) than TILE_WIDTH and TILE_HEIGHT.
|
||||
* this is to handle edge tiles of a drawable.
|
||||
*/
|
||||
|
||||
TileRowHint *rowhint; /* An array of hints for rendering purposes */
|
||||
TileRowHint *rowhint; /* An array of hints for rendering purposes */
|
||||
|
||||
guchar *data; /* the data for the tile. this may be NULL in which
|
||||
* case the tile data is on disk.
|
||||
*/
|
||||
guchar *data; /* the data for the tile. this may be NULL in which
|
||||
* case the tile data is on disk.
|
||||
*/
|
||||
|
||||
gint swap_num; /* the index into the file table of the file to be used
|
||||
* for swapping. swap_num 1 is always the global
|
||||
* swap file.
|
||||
*/
|
||||
off_t swap_offset; /* the offset within the swap file of the tile data.
|
||||
* if the tile data is in memory this will be set
|
||||
* to -1.
|
||||
*/
|
||||
|
||||
gint swap_num; /* the index into the file table of the file to be used
|
||||
* for swapping. swap_num 1 is always the global
|
||||
* swap file.
|
||||
*/
|
||||
off_t swap_offset; /* the offset within the swap file of the tile data.
|
||||
* if the tile data is in memory this will be set to -1.
|
||||
*/
|
||||
TileLink *tlink;
|
||||
|
||||
Tile *next;
|
||||
Tile *prev; /* List pointers for the tile cache lists */
|
||||
gpointer listhead; /* Pointer to the head of the list this tile is on */
|
||||
Tile *prev; /* List pointers for the tile cache lists */
|
||||
gpointer listhead; /* Pointer to the head of the list this tile is on */
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
pthread_mutex_t mutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
#define TILE_MUTEX_LOCK(tile) pthread_mutex_lock(&((tile)->mutex))
|
||||
#define TILE_MUTEX_UNLOCK(tile) pthread_mutex_unlock(&((tile)->mutex))
|
||||
#else
|
||||
#define TILE_MUTEX_LOCK(tile) /* nothing */
|
||||
#define TILE_MUTEX_LOCK(tile) /* nothing */
|
||||
#define TILE_MUTEX_UNLOCK(tile) /* nothing */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ tile_lock (Tile *tile)
|
|||
|
||||
/* Call 'tile_manager_validate' if the tile was invalid.
|
||||
*/
|
||||
if (!tile->valid)
|
||||
if (! tile->valid)
|
||||
{
|
||||
/* an invalid tile should never be shared, so this should work */
|
||||
tile_manager_validate ((TileManager*) tile->tlink->tm, tile);
|
||||
|
@ -299,7 +299,7 @@ tile_bpp (Tile *tile)
|
|||
return tile->bpp;
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
tile_is_valid (Tile *tile)
|
||||
{
|
||||
return tile->valid;
|
||||
|
@ -309,7 +309,9 @@ void
|
|||
tile_mark_valid (Tile *tile)
|
||||
{
|
||||
TILE_MUTEX_LOCK (tile);
|
||||
|
||||
tile->valid = TRUE;
|
||||
|
||||
TILE_MUTEX_UNLOCK (tile);
|
||||
}
|
||||
|
||||
|
@ -320,7 +322,7 @@ tile_attach (Tile *tile,
|
|||
{
|
||||
TileLink *tmp;
|
||||
|
||||
if ((tile->share_count > 0) && (!tile->valid))
|
||||
if ((tile->share_count > 0) && (! tile->valid))
|
||||
{
|
||||
/* trying to share invalid tiles is problematic, not to mention silly */
|
||||
tile_manager_validate ((TileManager*) tile->tlink->tm, tile);
|
||||
|
@ -330,7 +332,8 @@ tile_attach (Tile *tile,
|
|||
tile_share_count++;
|
||||
|
||||
#ifdef TILE_DEBUG
|
||||
g_print("tile_attach: %p -> (%p,%d) *%d\n", tile, tm, tile_num, tile->share_count);
|
||||
g_printerr ("tile_attach: %p -> (%p,%d) *%d\n",
|
||||
tile, tm, tile_num, tile->share_count);
|
||||
#endif
|
||||
|
||||
/* link this tile into the tile's tilelink chain */
|
||||
|
@ -351,8 +354,8 @@ tile_detach (Tile *tile,
|
|||
TileLink *tmp;
|
||||
|
||||
#ifdef TILE_DEBUG
|
||||
g_print("tile_detach: %p ~> (%p,%d) r%d *%d\n", tile, tm, tile_num,
|
||||
tile->ref_count, tile->share_count);
|
||||
g_printerr ("tile_detach: %p ~> (%p,%d) r%d *%d\n",
|
||||
tile, tm, tile_num, tile->ref_count, tile->share_count);
|
||||
#endif
|
||||
|
||||
for (link = &tile->tlink;
|
||||
|
@ -389,9 +392,7 @@ tile_data_pointer (Tile *tile,
|
|||
gint xoff,
|
||||
gint yoff)
|
||||
{
|
||||
gint offset;
|
||||
|
||||
offset = yoff * tile->ewidth + xoff;
|
||||
gint offset = yoff * tile->ewidth + xoff;
|
||||
|
||||
return (gpointer) (tile->data + offset * tile->bpp);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ gint tile_ewidth (Tile *tile);
|
|||
gint tile_eheight (Tile *tile);
|
||||
gint tile_bpp (Tile *tile);
|
||||
|
||||
gint tile_is_valid (Tile *tile);
|
||||
gboolean tile_is_valid (Tile *tile);
|
||||
|
||||
void tile_mark_valid (Tile *tile);
|
||||
|
||||
|
|
|
@ -1095,7 +1095,8 @@ ink_set_undo_tiles (GimpDrawable *drawable,
|
|||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
dest_tile = tile_manager_get_tile (undo_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
|
||||
if (! tile_is_valid (dest_tile))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (gimp_drawable_data (drawable),
|
||||
j, i, TRUE, FALSE);
|
||||
|
@ -1113,15 +1114,16 @@ ink_set_canvas_tiles (gint x,
|
|||
gint w,
|
||||
gint h)
|
||||
{
|
||||
gint i, j;
|
||||
Tile *tile;
|
||||
gint i, j;
|
||||
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
{
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
|
||||
if (! tile_is_valid (tile))
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, TRUE, TRUE);
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
|
|
@ -512,7 +512,7 @@ gimp_paint_core_copy_valid_tiles (TileManager *src_tiles,
|
|||
src_tile = tile_manager_get_tile (src_tiles,
|
||||
j, i, FALSE, FALSE);
|
||||
|
||||
if (tile_is_valid (src_tile) == TRUE)
|
||||
if (tile_is_valid (src_tile))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (src_tiles,
|
||||
j, i, TRUE, FALSE);
|
||||
|
@ -1022,13 +1022,14 @@ gimp_paint_core_get_orig_image (GimpPaintCore *core,
|
|||
undo_tile = tile_manager_get_tile (core->undo_tiles,
|
||||
srcPR.x, srcPR.y,
|
||||
FALSE, FALSE);
|
||||
if (tile_is_valid (undo_tile) == TRUE)
|
||||
|
||||
if (tile_is_valid (undo_tile))
|
||||
{
|
||||
refd = 1;
|
||||
undo_tile = tile_manager_get_tile (core->undo_tiles,
|
||||
srcPR.x, srcPR.y,
|
||||
TRUE, FALSE);
|
||||
s = (unsigned char*)tile_data_pointer (undo_tile, 0, 0) +
|
||||
s = (guchar *) tile_data_pointer (undo_tile, 0, 0) +
|
||||
srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
|
||||
srcPR.bytes * (srcPR.x % TILE_WIDTH); /* dubious... */
|
||||
}
|
||||
|
@ -1943,7 +1944,7 @@ set_undo_tiles (GimpPaintCore *core,
|
|||
dest_tile = tile_manager_get_tile (core->undo_tiles, j, i,
|
||||
FALSE, FALSE);
|
||||
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
if (! tile_is_valid (dest_tile))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (gimp_drawable_data (drawable),
|
||||
j, i, TRUE, FALSE);
|
||||
|
@ -1972,7 +1973,7 @@ set_canvas_tiles (GimpPaintCore *core,
|
|||
tile = tile_manager_get_tile (core->canvas_tiles, j, i,
|
||||
FALSE, FALSE);
|
||||
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
if (! tile_is_valid (tile))
|
||||
{
|
||||
tile = tile_manager_get_tile (core->canvas_tiles, j, i,
|
||||
TRUE, TRUE);
|
||||
|
|
|
@ -1095,7 +1095,8 @@ ink_set_undo_tiles (GimpDrawable *drawable,
|
|||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
dest_tile = tile_manager_get_tile (undo_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
|
||||
if (! tile_is_valid (dest_tile))
|
||||
{
|
||||
src_tile = tile_manager_get_tile (gimp_drawable_data (drawable),
|
||||
j, i, TRUE, FALSE);
|
||||
|
@ -1113,15 +1114,16 @@ ink_set_canvas_tiles (gint x,
|
|||
gint w,
|
||||
gint h)
|
||||
{
|
||||
gint i, j;
|
||||
Tile *tile;
|
||||
gint i, j;
|
||||
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
{
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
|
||||
if (! tile_is_valid (tile))
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, TRUE, TRUE);
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
|
Loading…
Reference in a new issue