use the offsets module TILE_WIDTH and TILE_HEIGHT instead of doing the

2007-09-12  Sven Neumann  <sven@gimp.org>

	* app/base/tile.c (tile_data_pointer): use the offsets module
	TILE_WIDTH and TILE_HEIGHT instead of doing the module operation
	in each and every caller.

	* app/base/boundary.c
	* app/base/pixel-region.c
	* app/base/tile-manager.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable.c
	* app/core/gimpimage-contiguous-region.c
	* app/core/gimplayer.c
	* app/display/gimpdisplayshell-render.c
	* app/paint-funcs/paint-funcs.c
	* app/paint/gimppaintcore.c
	* app/tools/gimpiscissorstool.c: changed accordingly.


svn path=/trunk/; revision=23515
This commit is contained in:
Sven Neumann
2007-09-12 18:29:11 +00:00
committed by Sven Neumann
parent e2cd1d4170
commit 1954ee81fe
14 changed files with 126 additions and 185 deletions

View File

@ -522,11 +522,8 @@ find_empty_segs (PixelRegion *maskPR,
tile = tile_manager_get_tile (maskPR->tiles,
x, scanline, TRUE, FALSE);
data =
(const guchar *) tile_data_pointer (tile,
x % TILE_WIDTH,
scanline % TILE_HEIGHT) +
(tile_bpp(tile) - 1);
data = ((const guchar *) tile_data_pointer (tile, x, scanline) +
tile_bpp (tile) - 1);
tilex = x / TILE_WIDTH;
dstep = tile_bpp (tile);

View File

@ -169,7 +169,7 @@ pixel_region_get_row (PixelRegion *PR,
while (x < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
tile_data = tile_data_pointer (tile, x, y);
npixels = tile_ewidth (tile) - (x % TILE_WIDTH);
if ((x + npixels) > end) /* make sure we don't write past the end */
@ -230,7 +230,7 @@ pixel_region_get_col (PixelRegion *PR,
while (y < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
tile_data = tile_data_pointer (tile, x, y);
boundary = y + (tile_eheight(tile) - (y % TILE_HEIGHT));
if (boundary > end) /* make sure we don't write past the end */

View File

@ -684,8 +684,7 @@ read_pixel_data (TileManager *tm,
for (x = x1; x <= x2; x += TILE_WIDTH - (x % TILE_WIDTH))
{
Tile *t = tile_manager_get_tile (tm, x, y, TRUE, FALSE);
const guchar *s = tile_data_pointer (t,
x % TILE_WIDTH, y % TILE_HEIGHT);
const guchar *s = tile_data_pointer (t, x, y);
guchar *d = buffer + stride * (y - y1) + tm->bpp * (x - x1);
guint rows, cols;
guint srcstride;
@ -728,8 +727,7 @@ write_pixel_data (TileManager *tm,
{
Tile *t = tile_manager_get_tile (tm, x, y, TRUE, TRUE);
const guchar *s = buffer + stride * (y - y1) + tm->bpp * (x - x1);
guchar *d = tile_data_pointer (t,
x % TILE_WIDTH, y % TILE_HEIGHT);
guchar *d = tile_data_pointer (t, x, y);
guint rows, cols;
guint dststride;
@ -790,9 +788,7 @@ read_pixel_data_1 (TileManager *tm,
if (tm->cached_tile)
{
const guchar *src = tile_data_pointer (tm->cached_tile,
x % TILE_WIDTH,
y % TILE_HEIGHT);
const guchar *src = tile_data_pointer (tm->cached_tile, x, y);
switch (tm->bpp)
{
@ -816,7 +812,7 @@ write_pixel_data_1 (TileManager *tm,
const guchar *buffer)
{
Tile *tile = tile_manager_get_tile (tm, x, y, TRUE, TRUE);
guchar *dest = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
guchar *dest = tile_data_pointer (tile, x, y);
switch (tm->bpp)
{

View File

@ -389,7 +389,7 @@ tile_data_pointer (Tile *tile,
gint xoff,
gint yoff)
{
gsize offset = yoff * tile->ewidth + xoff;
gsize offset = (yoff % TILE_HEIGHT) * tile->ewidth + (xoff % TILE_HEIGHT);
return (gpointer) (tile->data + offset * tile->bpp);
}