use gboolean for boolean parameters.

2007-06-21  Sven Neumann  <sven@gimp.org>

	* app/base/tile-manager.[ch]: use gboolean for boolean parameters.

	* app/base/tile-pyramid.c (tile_pyramid_get_memsize): pass TRUE
	for sparse to tile_manager_get_memsize().

	* app/base/tile.c
	* app/base/tile-swap.c: minor cleanups.

	* app/core/gimpprojection.c (gimp_projection_get_tiles_at_level):
	inline the creation of the TilePyramid.

svn path=/trunk/; revision=22818
This commit is contained in:
Sven Neumann
2007-06-21 14:02:14 +00:00
committed by Sven Neumann
parent 52f7746e76
commit 173c9d40aa
7 changed files with 42 additions and 41 deletions

View File

@ -1,3 +1,16 @@
2007-06-21 Sven Neumann <sven@gimp.org>
* app/base/tile-manager.[ch]: use gboolean for boolean parameters.
* app/base/tile-pyramid.c (tile_pyramid_get_memsize): pass TRUE
for sparse to tile_manager_get_memsize().
* app/base/tile.c
* app/base/tile-swap.c: minor cleanups.
* app/core/gimpprojection.c (gimp_projection_get_tiles_at_level):
inline the creation of the TilePyramid.
2007-06-21 Michael Natterer <mitch@gimp.org> 2007-06-21 Michael Natterer <mitch@gimp.org>
Make sure the image preview is only invalidated for visible Make sure the image preview is only invalidated for visible
@ -26,7 +39,7 @@
call gimp_drawable_update() or anything else to make sure the call gimp_drawable_update() or anything else to make sure the
projection is up-to-date. projection is up-to-date.
* app/core/gimpimage.c (gimp_image_real_flush): inavlidate the * app/core/gimpimage.c (gimp_image_real_flush): invalidate the
image preview here because we now create it from the projection. image preview here because we now create it from the projection.
(this is still not the entirely correct place though). (this is still not the entirely correct place though).

View File

@ -119,8 +119,8 @@ Tile *
tile_manager_get_tile (TileManager *tm, tile_manager_get_tile (TileManager *tm,
gint xpixel, gint xpixel,
gint ypixel, gint ypixel,
gint wantread, gboolean wantread,
gint wantwrite) gboolean wantwrite)
{ {
g_return_val_if_fail (tm != NULL, NULL); g_return_val_if_fail (tm != NULL, NULL);
@ -132,8 +132,8 @@ tile_manager_get_tile (TileManager *tm,
Tile * Tile *
tile_manager_get (TileManager *tm, tile_manager_get (TileManager *tm,
gint tile_num, gint tile_num,
gint wantread, gboolean wantread,
gint wantwrite) gboolean wantwrite)
{ {
Tile **tiles; Tile **tiles;
Tile **tile_ptr; Tile **tile_ptr;
@ -184,7 +184,7 @@ tile_manager_get (TileManager *tm,
tile_ptr = &tm->tiles[tile_num]; tile_ptr = &tm->tiles[tile_num];
if (G_UNLIKELY (wantwrite && !wantread)) if (G_UNLIKELY (wantwrite && ! wantread))
g_warning ("WRITE-ONLY TILE... UNTESTED!"); g_warning ("WRITE-ONLY TILE... UNTESTED!");
#ifdef DEBUG_TILE_MANAGER #ifdef DEBUG_TILE_MANAGER
@ -256,8 +256,8 @@ Tile *
tile_manager_get_at (TileManager *tm, tile_manager_get_at (TileManager *tm,
gint tile_col, gint tile_col,
gint tile_row, gint tile_row,
gint wantread, gboolean wantread,
gint wantwrite) gboolean wantwrite)
{ {
g_return_val_if_fail (tm != NULL, NULL); g_return_val_if_fail (tm != NULL, NULL);
@ -590,18 +590,16 @@ gint64
tile_manager_get_memsize (const TileManager *tm, tile_manager_get_memsize (const TileManager *tm,
gboolean sparse) gboolean sparse)
{ {
gint64 memsize; /* the tile manager itself */
gint64 memsize = sizeof (TileManager);
g_return_val_if_fail (tm != NULL, 0); g_return_val_if_fail (tm != NULL, 0);
/* the tile manager itself */
memsize = sizeof (TileManager);
/* the array of tiles */ /* the array of tiles */
memsize += (gint64) tm->ntile_rows * tm->ntile_cols * (sizeof (Tile) + memsize += (gint64) tm->ntile_rows * tm->ntile_cols * (sizeof (Tile) +
sizeof (gpointer)); sizeof (gpointer));
/* the memory allocated for the tiles */ /* the memory allocated for the tiles */
if (sparse) if (sparse)
{ {
if (tm->tiles) if (tm->tiles)

View File

@ -51,21 +51,21 @@ void tile_manager_set_validate_proc (TileManager *tm,
Tile * tile_manager_get_tile (TileManager *tm, Tile * tile_manager_get_tile (TileManager *tm,
gint xpixel, gint xpixel,
gint ypixel, gint ypixel,
gint wantread, gboolean wantread,
gint wantwrite); gboolean wantwrite);
/* Get a specified tile from a tile manager. /* Get a specified tile from a tile manager.
*/ */
Tile * tile_manager_get (TileManager *tm, Tile * tile_manager_get (TileManager *tm,
gint tile_num, gint tile_num,
gint wantread, gboolean wantread,
gint wantwrite); gboolean wantwrite);
Tile * tile_manager_get_at (TileManager *tm, Tile * tile_manager_get_at (TileManager *tm,
gint tile_col, gint tile_col,
gint tile_row, gint tile_row,
gint wantread, gboolean wantread,
gint wantwrite); gboolean wantwrite);
void tile_manager_map_tile (TileManager *tm, void tile_manager_map_tile (TileManager *tm,
gint xpixel, gint xpixel,

View File

@ -314,7 +314,7 @@ tile_pyramid_get_memsize (const TilePyramid *pyramid)
g_return_val_if_fail (pyramid != NULL, 0); g_return_val_if_fail (pyramid != NULL, 0);
for (level = 0; level <= pyramid->top_level; level++) for (level = 0; level <= pyramid->top_level; level++)
memsize += tile_manager_get_memsize (pyramid->tiles[level], FALSE); memsize += tile_manager_get_memsize (pyramid->tiles[level], TRUE);
return memsize; return memsize;
} }

View File

@ -120,7 +120,7 @@ static gboolean write_err_msg = TRUE;
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
static gint static gint
gimp_win32_large_truncate (int fd, gimp_win32_large_truncate (gint fd,
gint64 size) gint64 size)
{ {
if (LARGE_SEEK (fd, size, SEEK_SET) == size && if (LARGE_SEEK (fd, size, SEEK_SET) == size &&

View File

@ -159,7 +159,7 @@ tile_lock (Tile *tile)
if (! tile->valid) if (! tile->valid)
{ {
/* an invalid tile should never be shared, so this should work */ /* an invalid tile should never be shared, so this should work */
tile_manager_validate ((TileManager *) tile->tlink->tm, tile); tile_manager_validate (tile->tlink->tm, tile);
} }
} }
@ -318,7 +318,7 @@ tile_attach (Tile *tile,
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 */ /* trying to share invalid tiles is problematic, not to mention silly */
tile_manager_validate ((TileManager *) tile->tlink->tm, tile); tile_manager_validate (tile->tlink->tm, tile);
} }
tile->share_count++; tile->share_count++;

View File

@ -60,8 +60,6 @@ static gint gimp_projection_get_opacity_at (GimpPickable *pickabl
gint x, gint x,
gint y); gint y);
static TilePyramid * gimp_projection_create_pyramid (GimpProjection *proj);
static void gimp_projection_add_update_area (GimpProjection *proj, static void gimp_projection_add_update_area (GimpProjection *proj,
gint x, gint x,
gint y, gint y,
@ -307,7 +305,14 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL); g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL);
if (! proj->pyramid) if (! proj->pyramid)
proj->pyramid = gimp_projection_create_pyramid (proj); {
proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
proj->image->width,
proj->image->height);
tile_pyramid_set_validate_proc (proj->pyramid,
gimp_projection_validate_tile, proj);
}
return tile_pyramid_get_tiles (proj->pyramid, level); return tile_pyramid_get_tiles (proj->pyramid, level);
} }
@ -413,21 +418,6 @@ gimp_projection_finish_draw (GimpProjection *proj)
/* private functions */ /* private functions */
static TilePyramid *
gimp_projection_create_pyramid (GimpProjection *proj)
{
TilePyramid *pyramid;
pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
proj->image->width,
proj->image->height);
tile_pyramid_set_validate_proc (pyramid, gimp_projection_validate_tile, proj);
return pyramid;
}
static void static void
gimp_projection_add_update_area (GimpProjection *proj, gimp_projection_add_update_area (GimpProjection *proj,
gint x, gint x,