app/base/base-types.h app/base/tile-manager.[ch] removed accessors for
2007-06-21 Sven Neumann <sven@gimp.org> * app/base/base-types.h * app/base/tile-manager.[ch] * app/base/tile-manager-private.h: removed accessors for user_data. Instead pass the user_data when setting the validation proc. * app/base/tile-pyramid.c * app/core/gimpchannel.c * app/core/gimpprojection.c * app/core/gimpselection.c * app/tools/gimpiscissorstool.c: changed accordingly. svn path=/trunk/; revision=22820
This commit is contained in:

committed by
Sven Neumann

parent
f2e9d552b2
commit
610feafb3e
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2007-06-21 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/base/base-types.h
|
||||||
|
* app/base/tile-manager.[ch]
|
||||||
|
* app/base/tile-manager-private.h: removed accessors for user_data.
|
||||||
|
Instead pass the user_data when setting the validation proc.
|
||||||
|
|
||||||
|
* app/base/tile-pyramid.c
|
||||||
|
* app/core/gimpchannel.c
|
||||||
|
* app/core/gimpprojection.c
|
||||||
|
* app/core/gimpselection.c
|
||||||
|
* app/tools/gimpiscissorstool.c: changed accordingly.
|
||||||
|
|
||||||
2007-06-21 Sven Neumann <sven@gimp.org>
|
2007-06-21 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/base/tile-manager.[ch]
|
* app/base/tile-manager.[ch]
|
||||||
|
@ -77,7 +77,8 @@ typedef struct _TilePyramid TilePyramid;
|
|||||||
/* functions */
|
/* functions */
|
||||||
|
|
||||||
typedef void (* TileValidateProc) (TileManager *tm,
|
typedef void (* TileValidateProc) (TileManager *tm,
|
||||||
Tile *tile);
|
Tile *tile,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __BASE_TYPES_H__ */
|
#endif /* __BASE_TYPES_H__ */
|
||||||
|
@ -34,13 +34,12 @@ struct _TileManager
|
|||||||
gint ntile_cols; /* the number of tiles in each columns */
|
gint ntile_cols; /* the number of tiles in each columns */
|
||||||
|
|
||||||
Tile **tiles; /* the tiles for this level */
|
Tile **tiles; /* the tiles for this level */
|
||||||
TileValidateProc validate_proc; /* this proc is called when an attempt
|
TileValidateProc validate_proc; /* this proc is called when an attempt *
|
||||||
* to get an invalid tile is made.
|
* to get an invalid tile is made */
|
||||||
*/
|
gpointer user_data; /* data to pass to the validate_proc */
|
||||||
|
|
||||||
gint cached_num; /* number of cached tile */
|
gint cached_num; /* number of cached tile */
|
||||||
Tile *cached_tile; /* the actual cached tile */
|
Tile *cached_tile; /* the actual cached tile */
|
||||||
|
|
||||||
gpointer user_data; /* hook for hanging data off of */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,11 +107,13 @@ tile_manager_unref (TileManager *tm)
|
|||||||
|
|
||||||
void
|
void
|
||||||
tile_manager_set_validate_proc (TileManager *tm,
|
tile_manager_set_validate_proc (TileManager *tm,
|
||||||
TileValidateProc proc)
|
TileValidateProc proc,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (tm != NULL);
|
g_return_if_fail (tm != NULL);
|
||||||
|
|
||||||
tm->validate_proc = proc;
|
tm->validate_proc = proc;
|
||||||
|
tm->user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tile *
|
Tile *
|
||||||
@ -279,7 +281,7 @@ tile_manager_validate (TileManager *tm,
|
|||||||
tile->valid = TRUE;
|
tile->valid = TRUE;
|
||||||
|
|
||||||
if (tm->validate_proc)
|
if (tm->validate_proc)
|
||||||
(* tm->validate_proc) (tm, tile);
|
(* tm->validate_proc) (tm, tile, tm->user_data);
|
||||||
|
|
||||||
#ifdef DEBUG_TILE_MANAGER
|
#ifdef DEBUG_TILE_MANAGER
|
||||||
g_printerr ("%c", tm->user_data ? 'V' : 'v');
|
g_printerr ("%c", tm->user_data ? 'V' : 'v');
|
||||||
@ -488,23 +490,6 @@ tile_manager_invalidate_area (TileManager *tm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
tile_manager_set_user_data (TileManager *tm,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
g_return_if_fail (tm != NULL);
|
|
||||||
|
|
||||||
tm->user_data = user_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpointer
|
|
||||||
tile_manager_get_user_data (const TileManager *tm)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (tm != NULL, NULL);
|
|
||||||
|
|
||||||
return tm->user_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
gint
|
gint
|
||||||
tile_manager_width (const TileManager *tm)
|
tile_manager_width (const TileManager *tm)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,8 @@ void tile_manager_unref (TileManager *tm);
|
|||||||
* allocated, but not initialized.
|
* allocated, but not initialized.
|
||||||
*/
|
*/
|
||||||
void tile_manager_set_validate_proc (TileManager *tm,
|
void tile_manager_set_validate_proc (TileManager *tm,
|
||||||
TileValidateProc proc);
|
TileValidateProc proc,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
/* Get a specified tile from a tile manager.
|
/* Get a specified tile from a tile manager.
|
||||||
*/
|
*/
|
||||||
@ -87,10 +88,6 @@ void tile_manager_invalidate_area (TileManager *tm,
|
|||||||
gint w,
|
gint w,
|
||||||
gint h);
|
gint h);
|
||||||
|
|
||||||
void tile_manager_set_user_data (TileManager *tm,
|
|
||||||
gpointer user_data);
|
|
||||||
gpointer tile_manager_get_user_data (const TileManager *tm);
|
|
||||||
|
|
||||||
gint tile_manager_width (const TileManager *tm);
|
gint tile_manager_width (const TileManager *tm);
|
||||||
gint tile_manager_height (const TileManager *tm);
|
gint tile_manager_height (const TileManager *tm);
|
||||||
gint tile_manager_bpp (const TileManager *tm);
|
gint tile_manager_bpp (const TileManager *tm);
|
||||||
|
@ -44,7 +44,8 @@ struct _TilePyramid
|
|||||||
static gint tile_pyramid_alloc_levels (TilePyramid *pyramid,
|
static gint tile_pyramid_alloc_levels (TilePyramid *pyramid,
|
||||||
gint top_level);
|
gint top_level);
|
||||||
static void tile_pyramid_validate_tile (TileManager *tm,
|
static void tile_pyramid_validate_tile (TileManager *tm,
|
||||||
Tile *tile);
|
Tile *tile,
|
||||||
|
TileManager *tm_below);
|
||||||
static void tile_pyramid_write_quarter (Tile *dest,
|
static void tile_pyramid_write_quarter (Tile *dest,
|
||||||
Tile *src,
|
Tile *src,
|
||||||
gint i,
|
gint i,
|
||||||
@ -242,9 +243,9 @@ tile_pyramid_invalidate_area (TilePyramid *pyramid,
|
|||||||
* tile_pyramid_set_validate_proc:
|
* tile_pyramid_set_validate_proc:
|
||||||
* @pyramid: a #TilePyramid
|
* @pyramid: a #TilePyramid
|
||||||
* @proc: a function to validate the bottom level tiles
|
* @proc: a function to validate the bottom level tiles
|
||||||
* @user_data: data to attach to the bottom level tile manager
|
* @user_data: data to pass to the validation @proc
|
||||||
*
|
*
|
||||||
* Sets a validation proc and user data on the bottom-most tile manager.
|
* Sets a validation procedure on the bottom-most tile manager.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
tile_pyramid_set_validate_proc (TilePyramid *pyramid,
|
tile_pyramid_set_validate_proc (TilePyramid *pyramid,
|
||||||
@ -253,8 +254,7 @@ tile_pyramid_set_validate_proc (TilePyramid *pyramid,
|
|||||||
{
|
{
|
||||||
g_return_if_fail (pyramid != NULL);
|
g_return_if_fail (pyramid != NULL);
|
||||||
|
|
||||||
tile_manager_set_validate_proc (pyramid->tiles[0], proc);
|
tile_manager_set_validate_proc (pyramid->tiles[0], proc, user_data);
|
||||||
tile_manager_set_user_data (pyramid->tiles[0], user_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,13 +353,9 @@ tile_pyramid_alloc_levels (TilePyramid *pyramid,
|
|||||||
pyramid->top_level = level;
|
pyramid->top_level = level;
|
||||||
pyramid->tiles[level] = tile_manager_new (width, height, pyramid->bytes);
|
pyramid->tiles[level] = tile_manager_new (width, height, pyramid->bytes);
|
||||||
|
|
||||||
tile_manager_set_user_data (pyramid->tiles[level], pyramid);
|
|
||||||
|
|
||||||
/* Use the level below to validate tiles. */
|
/* Use the level below to validate tiles. */
|
||||||
tile_manager_set_validate_proc (pyramid->tiles[level],
|
tile_manager_set_validate_proc (pyramid->tiles[level],
|
||||||
tile_pyramid_validate_tile);
|
(TileValidateProc) tile_pyramid_validate_tile,
|
||||||
|
|
||||||
tile_manager_set_user_data (pyramid->tiles[level],
|
|
||||||
pyramid->tiles[level - 1]);
|
pyramid->tiles[level - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,9 +364,9 @@ tile_pyramid_alloc_levels (TilePyramid *pyramid,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
tile_pyramid_validate_tile (TileManager *tm,
|
tile_pyramid_validate_tile (TileManager *tm,
|
||||||
Tile *tile)
|
Tile *tile,
|
||||||
|
TileManager *tm_below)
|
||||||
{
|
{
|
||||||
TileManager *level_below = tile_manager_get_user_data (tm);
|
|
||||||
gint tile_col;
|
gint tile_col;
|
||||||
gint tile_row;
|
gint tile_row;
|
||||||
gint i, j;
|
gint i, j;
|
||||||
@ -380,7 +376,7 @@ tile_pyramid_validate_tile (TileManager *tm,
|
|||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
for (j = 0; j < 2; j++)
|
for (j = 0; j < 2; j++)
|
||||||
{
|
{
|
||||||
Tile *source = tile_manager_get_at (level_below,
|
Tile *source = tile_manager_get_at (tm_below,
|
||||||
tile_col * 2 + i,
|
tile_col * 2 + i,
|
||||||
tile_row * 2 + j,
|
tile_row * 2 + j,
|
||||||
TRUE, FALSE);
|
TRUE, FALSE);
|
||||||
|
@ -207,7 +207,7 @@ static void gimp_channel_real_shrink (GimpChannel *channel,
|
|||||||
gboolean edge_lock,
|
gboolean edge_lock,
|
||||||
gboolean push_undo);
|
gboolean push_undo);
|
||||||
|
|
||||||
static void gimp_channel_validate (TileManager *tm,
|
static void gimp_channel_validate_tile (TileManager *tm,
|
||||||
Tile *tile);
|
Tile *tile);
|
||||||
|
|
||||||
|
|
||||||
@ -1461,7 +1461,7 @@ gimp_channel_real_shrink (GimpChannel *channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_channel_validate (TileManager *tm,
|
gimp_channel_validate_tile (TileManager *tm,
|
||||||
Tile *tile)
|
Tile *tile)
|
||||||
{
|
{
|
||||||
/* Set the contents of the tile to empty */
|
/* Set the contents of the tile to empty */
|
||||||
@ -1707,7 +1707,8 @@ gimp_channel_new_mask (GimpImage *image,
|
|||||||
_("Selection Mask"), NULL);
|
_("Selection Mask"), NULL);
|
||||||
|
|
||||||
tile_manager_set_validate_proc (GIMP_DRAWABLE (new_channel)->tiles,
|
tile_manager_set_validate_proc (GIMP_DRAWABLE (new_channel)->tiles,
|
||||||
gimp_channel_validate);
|
(TileValidateProc) gimp_channel_validate_tile,
|
||||||
|
NULL);
|
||||||
|
|
||||||
return new_channel;
|
return new_channel;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,8 @@ static void gimp_projection_invalidate (GimpProjection *proj,
|
|||||||
guint w,
|
guint w,
|
||||||
guint h);
|
guint h);
|
||||||
static void gimp_projection_validate_tile (TileManager *tm,
|
static void gimp_projection_validate_tile (TileManager *tm,
|
||||||
Tile *tile);
|
Tile *tile,
|
||||||
|
GimpProjection *proj);
|
||||||
static void gimp_projection_image_update (GimpImage *image,
|
static void gimp_projection_image_update (GimpImage *image,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -311,7 +312,8 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
|
|||||||
proj->image->height);
|
proj->image->height);
|
||||||
|
|
||||||
tile_pyramid_set_validate_proc (proj->pyramid,
|
tile_pyramid_set_validate_proc (proj->pyramid,
|
||||||
gimp_projection_validate_tile, proj);
|
(TileValidateProc) gimp_projection_validate_tile,
|
||||||
|
proj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tile_pyramid_get_tiles (proj->pyramid, level);
|
return tile_pyramid_get_tiles (proj->pyramid, level);
|
||||||
@ -645,9 +647,9 @@ gimp_projection_invalidate (GimpProjection *proj,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_projection_validate_tile (TileManager *tm,
|
gimp_projection_validate_tile (TileManager *tm,
|
||||||
Tile *tile)
|
Tile *tile,
|
||||||
|
GimpProjection *proj)
|
||||||
{
|
{
|
||||||
GimpProjection *proj = tile_manager_get_user_data (tm);
|
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
/* Find the coordinates of this tile */
|
/* Find the coordinates of this tile */
|
||||||
|
@ -124,7 +124,7 @@ static void gimp_selection_shrink (GimpChannel *channel,
|
|||||||
gboolean edge_lock,
|
gboolean edge_lock,
|
||||||
gboolean push_undo);
|
gboolean push_undo);
|
||||||
|
|
||||||
static void gimp_selection_validate (TileManager *tm,
|
static void gimp_selection_validate_tile (TileManager *tm,
|
||||||
Tile *tile);
|
Tile *tile);
|
||||||
|
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ gimp_selection_shrink (GimpChannel *channel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_selection_validate (TileManager *tm,
|
gimp_selection_validate_tile (TileManager *tm,
|
||||||
Tile *tile)
|
Tile *tile)
|
||||||
{
|
{
|
||||||
/* Set the contents of the tile to empty */
|
/* Set the contents of the tile to empty */
|
||||||
@ -536,9 +536,9 @@ gimp_selection_new (GimpImage *image,
|
|||||||
channel->x2 = width;
|
channel->x2 = width;
|
||||||
channel->y2 = height;
|
channel->y2 = height;
|
||||||
|
|
||||||
/* Set the validate procedure */
|
|
||||||
tile_manager_set_validate_proc (GIMP_DRAWABLE (channel)->tiles,
|
tile_manager_set_validate_proc (GIMP_DRAWABLE (channel)->tiles,
|
||||||
gimp_selection_validate);
|
(TileValidateProc) gimp_selection_validate_tile,
|
||||||
|
NULL);
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
@ -1706,11 +1706,11 @@ find_optimal_path (TileManager *gradient_map,
|
|||||||
/* Called to fill in a newly referenced tile in the gradient map */
|
/* Called to fill in a newly referenced tile in the gradient map */
|
||||||
static void
|
static void
|
||||||
gradmap_tile_validate (TileManager *tm,
|
gradmap_tile_validate (TileManager *tm,
|
||||||
Tile *tile)
|
Tile *tile,
|
||||||
|
GimpImage *image)
|
||||||
{
|
{
|
||||||
static gboolean first_gradient = TRUE;
|
static gboolean first_gradient = TRUE;
|
||||||
|
|
||||||
GimpImage *image = tile_manager_get_user_data (tm);
|
|
||||||
GimpPickable *pickable;
|
GimpPickable *pickable;
|
||||||
Tile *srctile;
|
Tile *srctile;
|
||||||
PixelRegion srcPR, destPR;
|
PixelRegion srcPR, destPR;
|
||||||
@ -1846,8 +1846,10 @@ gradient_map_new (GimpImage *image)
|
|||||||
|
|
||||||
tm = tile_manager_new (image->width, image->height,
|
tm = tile_manager_new (image->width, image->height,
|
||||||
sizeof (guint8) * COST_WIDTH);
|
sizeof (guint8) * COST_WIDTH);
|
||||||
tile_manager_set_user_data (tm, image);
|
|
||||||
tile_manager_set_validate_proc (tm, gradmap_tile_validate);
|
tile_manager_set_validate_proc (tm,
|
||||||
|
(TileValidateProc) gradmap_tile_validate,
|
||||||
|
image);
|
||||||
|
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user