From 3bb2f79984b3749ee44bcad31b845e054084d989 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sun, 8 May 2005 23:30:54 +0000 Subject: [PATCH] inline tile_manager_get_tile_num(). 2005-05-09 Sven Neumann * app/base/tile-manager.c: inline tile_manager_get_tile_num(). * app/display/gimpdisplayshell-render.c (render_image_tile_fault): reverted one of the changes I did here earlier. --- ChangeLog | 7 ++++++ app/base/tile-manager.c | 31 ++++++++++----------------- app/display/gimpdisplayshell-render.c | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index eeed9f1019..f324a80993 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-05-09 Sven Neumann + + * app/base/tile-manager.c: inline tile_manager_get_tile_num(). + + * app/display/gimpdisplayshell-render.c (render_image_tile_fault): + reverted one of the changes I did here earlier. + 2005-05-08 Sven Neumann * app/dialogs/layer-options-dialog.c (layer_options_dialog_new): diff --git a/app/base/tile-manager.c b/app/base/tile-manager.c index f9e5f661c9..480cad0756 100644 --- a/app/base/tile-manager.c +++ b/app/base/tile-manager.c @@ -32,9 +32,17 @@ #include "tile-swap.h" -static gint tile_manager_get_tile_num (TileManager *tm, - gint xpixel, - gint ypixel); +static inline gint +tile_manager_get_tile_num (TileManager *tm, + gint xpixel, + gint ypixel) +{ + if ((xpixel < 0) || (xpixel >= tm->width) || + (ypixel < 0) || (ypixel >= tm->height)) + return -1; + + return (ypixel / TILE_HEIGHT) * tm->ntile_cols + (xpixel / TILE_WIDTH); +} TileManager * @@ -116,7 +124,6 @@ tile_manager_unref (TileManager *tm) } } - void tile_manager_set_validate_proc (TileManager *tm, TileValidateProc proc) @@ -331,7 +338,6 @@ tile_manager_invalidate_tiles (TileManager *tm, } } - void tile_invalidate_tile (Tile **tile_ptr, TileManager *tm, @@ -350,7 +356,6 @@ tile_invalidate_tile (Tile **tile_ptr, tile_invalidate (tile_ptr, tm, tile_num); } - void tile_invalidate (Tile **tile_ptr, TileManager *tm, @@ -404,7 +409,6 @@ leave: TILE_MUTEX_UNLOCK (tile); } - void tile_manager_map_tile (TileManager *tm, gint xpixel, @@ -522,18 +526,6 @@ tile_manager_map (TileManager *tm, #endif } -static gint -tile_manager_get_tile_num (TileManager *tm, - gint xpixel, - gint ypixel) -{ - if ((xpixel < 0) || (xpixel >= tm->width) || - (ypixel < 0) || (ypixel >= tm->height)) - return -1; - - return (ypixel / TILE_HEIGHT) * tm->ntile_cols + (xpixel / TILE_WIDTH); -} - void tile_manager_set_user_data (TileManager *tm, gpointer user_data) @@ -665,7 +657,6 @@ tile_manager_get_tile_coordinates (TileManager *tm, *y = TILE_HEIGHT * (tl->tile_num / tm->ntile_cols); } - void tile_manager_map_over_tile (TileManager *tm, Tile *tile, diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index f0149aee20..dec06f03e4 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -973,8 +973,8 @@ render_image_tile_fault (RenderInfo *info) tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE); - - g_return_val_if_fail (tile != NULL, tile_buf); + if (!tile) + return tile_buf; src = tile_data_pointer (tile, x % TILE_WIDTH,