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

@ -1,3 +1,22 @@
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.
2007-09-12 Sven Neumann <sven@gimp.org>
* app/core/gimp-transform-region.c (supersample_dtest): use

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);
}

View File

@ -845,7 +845,7 @@ gimp_channel_get_opacity_at (GimpPickable *pickable,
tile = tile_manager_get_tile (GIMP_DRAWABLE (channel)->tiles, x, y,
TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
val = *(guchar *) (tile_data_pointer (tile, x, y));
tile_release (tile, FALSE);
return val;

View File

@ -513,9 +513,7 @@ gradient_calc_shapeburst_angular_factor (gdouble x,
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = 1.0 - *((gfloat *) tile_data_pointer (tile,
ix % TILE_WIDTH,
iy % TILE_HEIGHT));
value = 1.0 - *((gfloat *) tile_data_pointer (tile, ix, iy));
tile_release (tile, FALSE);
@ -534,9 +532,7 @@ gradient_calc_shapeburst_spherical_factor (gdouble x,
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((gfloat *) tile_data_pointer (tile,
ix % TILE_WIDTH,
iy % TILE_HEIGHT));
value = *((gfloat *) tile_data_pointer (tile, ix, iy));
value = 1.0 - sin (0.5 * G_PI * value);
tile_release (tile, FALSE);
@ -556,9 +552,7 @@ gradient_calc_shapeburst_dimpled_factor (gdouble x,
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
value = *((gfloat *) tile_data_pointer (tile,
ix % TILE_WIDTH,
iy % TILE_HEIGHT));
value = *((gfloat *) tile_data_pointer (tile, ix, iy));
value = cos (0.5 * G_PI * value);
tile_release (tile, FALSE);

View File

@ -735,14 +735,9 @@ gimp_drawable_real_swap_pixels (GimpDrawable *drawable,
j, i, dest_tile);
tile_manager_map_tile (gimp_drawable_get_tiles (drawable),
j, i, src_tile);
#if 0
swap_pixels (tile_data_pointer (src_tile, 0, 0),
tile_data_pointer (dest_tile, 0, 0),
tile_size (src_tile));
#endif
tile_release (dest_tile, FALSE /* TRUE */);
tile_release (src_tile, FALSE /* TRUE */);
tile_release (dest_tile, FALSE);
tile_release (src_tile, FALSE);
}
}
}

View File

@ -155,10 +155,10 @@ gimp_image_contiguous_region_by_seed (GimpImage *image,
tile = tile_manager_get_tile (srcPR.tiles, x, y, TRUE, FALSE);
if (tile)
{
guchar *start;
guchar start_col[MAX_CHANNELS];
const guchar *start;
guchar start_col[MAX_CHANNELS];
start = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
start = tile_data_pointer (tile, x, y);
if (has_alpha)
{
@ -454,8 +454,8 @@ ref_tiles (TileManager *src,
*s_tile = tile_manager_get_tile (src, x, y, TRUE, FALSE);
*m_tile = tile_manager_get_tile (mask, x, y, TRUE, TRUE);
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*s = tile_data_pointer (*s_tile, x, y);
*m = tile_data_pointer (*m_tile, x, y);
}
static int
@ -598,9 +598,9 @@ find_contiguous_region_helper (GimpImage *image,
gint y,
const guchar *col)
{
gint start, end;
gint new_start, new_end;
gint val;
gint start, end;
gint new_start, new_end;
gint val;
Tile *tile;
GQueue *coord_stack;
@ -624,9 +624,7 @@ find_contiguous_region_helper (GimpImage *image,
for (x = start + 1; x < end; x++)
{
tile = tile_manager_get_tile (mask->tiles, x, y, TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT));
val = *(const guchar *) (tile_data_pointer (tile, x, y));
tile_release (tile, FALSE);
if (val != 0)
continue;

View File

@ -856,9 +856,7 @@ gimp_layer_get_opacity_at (GimpPickable *pickable,
tile = tile_manager_get_tile (GIMP_DRAWABLE (layer)->tiles,
x, y, TRUE, FALSE);
val = * ((guchar *) tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
val = * ((const guchar *) tile_data_pointer (tile, x, y) +
tile_bpp (tile) - 1);
if (layer->mask)

View File

@ -1102,23 +1102,24 @@ render_image_tile_fault (RenderInfo *info)
footprint_y = (1.0 / info->scaley) * 256;
footprint_x = (1.0 / info->scalex) * 256;
foosum = footprint_x * footprint_y;
{
gint dy = info->yfraction;
{
gint dy = info->yfraction;
if (dy > footprint_y / 2)
top_weight = 0;
else
top_weight = footprint_y / 2 - dy;
if (dy > footprint_y / 2)
top_weight = 0;
else
top_weight = footprint_y / 2 - dy;
if (0xff - dy > footprint_y / 2)
bottom_weight = 0;
else
bottom_weight = footprint_y / 2 - (0xff - dy);
if (0xff - dy > footprint_y / 2)
bottom_weight = 0;
else
bottom_weight = footprint_y / 2 - (0xff - dy);
middle_weight = footprint_y - top_weight - bottom_weight;
}
middle_weight = footprint_y - top_weight - bottom_weight;
}
tile[4] = tile_manager_get_tile (info->src_tiles,
info->src_x, info->src_y,
@ -1152,14 +1153,11 @@ render_image_tile_fault (RenderInfo *info)
g_return_val_if_fail (tile[4] != NULL, tile_buf);
src[4] = tile_data_pointer (tile[4],
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src[4] = tile_data_pointer (tile[4], info->src_x, info->src_y);
if (tile[5])
{
src[5] = tile_data_pointer (tile[5],
(info->src_x + 1) % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src[5] = tile_data_pointer (tile[5], info->src_x + 1, info->src_y);
}
else
{
@ -1168,9 +1166,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[7])
{
src[7] = tile_data_pointer (tile[7],
info->src_x % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[7] = tile_data_pointer (tile[7], info->src_x, info->src_y + 1);
}
else
{
@ -1179,9 +1175,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[1])
{
src[1] = tile_data_pointer (tile[1],
(info->src_x) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[1] = tile_data_pointer (tile[1], info->src_x, info->src_y - 1);
}
else
{
@ -1190,9 +1184,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[8])
{
src[8] = tile_data_pointer (tile[8],
(info->src_x + 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[8] = tile_data_pointer (tile[8], info->src_x + 1, info->src_y + 1);
}
else
{
@ -1203,9 +1195,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[0])
{
src[0] = tile_data_pointer (tile[0],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[0] = tile_data_pointer (tile[0], info->src_x - 1, info->src_y - 1);
}
else
{
@ -1214,9 +1204,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[2])
{
src[2] = tile_data_pointer (tile[2],
(info->src_x + 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[2] = tile_data_pointer (tile[2], info->src_x + 1, info->src_y - 1);
}
else
{
@ -1225,9 +1213,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[3])
{
src[3] = tile_data_pointer (tile[3],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y) % TILE_HEIGHT);
src[3] = tile_data_pointer (tile[3], info->src_x - 1, info->src_y);
}
else
{
@ -1236,9 +1222,7 @@ render_image_tile_fault (RenderInfo *info)
if (tile[6])
{
src[6] = tile_data_pointer (tile[6],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[6] = tile_data_pointer (tile[6], info->src_x - 1, info->src_y + 1);
}
else
{
@ -1357,31 +1341,29 @@ render_image_tile_fault (RenderInfo *info)
tile[1] = tile_manager_get_tile (info->src_tiles,
src_x, info->src_y - 1,
TRUE, FALSE);
if (!tile[4])
if (! tile[4])
goto done;
src[4] = tile_data_pointer (tile[4],
src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
if (!tile[7])
src[4] = tile_data_pointer (tile[4], src_x, info->src_y);
if (! tile[7])
{
src[7] = src[4];
}
else
{
src[7] = tile_data_pointer (tile[7],
(src_x) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src_x, info->src_y + 1);
}
if (!tile[1])
if (! tile[1])
{
src[1] = src[4];
}
else
{
src[1] = tile_data_pointer (tile[1],
src_x % TILE_WIDTH,
(info->src_y - 1)% TILE_HEIGHT);
src_x, info->src_y - 1);
}
}
@ -1406,37 +1388,34 @@ render_image_tile_fault (RenderInfo *info)
src_x + 1, info->src_y - 1,
TRUE, FALSE);
if (!tile[5])
if (! tile[5])
{
src[5] = src[4];
}
else
{
src[5] = tile_data_pointer (tile[5],
(src_x + 1) % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src_x + 1, info->src_y);
}
if (!tile[8])
if (! tile[8])
{
src[8] = src[7];
}
else
{
src[8] = tile_data_pointer (tile[8],
(src_x + 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src_x + 1, info->src_y + 1);
}
if (!tile[2])
if (! tile[2])
{
src[2] = src[1];
}
else
{
src[2] = tile_data_pointer (tile[2],
(src_x + 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src_x + 1, info->src_y - 1);
}
}
@ -1461,37 +1440,34 @@ render_image_tile_fault (RenderInfo *info)
src_x - 1, info->src_y + 1,
TRUE, FALSE);
if (!tile[3])
if (! tile[3])
{
src[3] = src[4];
}
else
{
src[3] = tile_data_pointer (tile[3],
(src_x - 1) % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src_x - 1, info->src_y);
}
if (!tile[6])
if (! tile[6])
{
src[6] = src[7];
}
else
{
src[6] = tile_data_pointer (tile[6],
(src_x - 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src_x - 1, info->src_y + 1);
}
if (!tile[0])
if (! tile[0])
{
src[0] = src[1];
}
else
{
src[0] = tile_data_pointer (tile[0],
(src_x - 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src_x - 1, info->src_y - 1);
}
}
}
@ -1524,9 +1500,7 @@ render_image_tile_fault_nearest (RenderInfo *info)
g_return_val_if_fail (tile != NULL, tile_buf);
src = tile_data_pointer (tile,
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src = tile_data_pointer (tile, info->src_x, info->src_y);
bpp = tile_manager_bpp (info->src_tiles);
dest = tile_buf;
@ -1573,12 +1547,10 @@ render_image_tile_fault_nearest (RenderInfo *info)
tile = tile_manager_get_tile (info->src_tiles,
src_x, info->src_y, TRUE, FALSE);
if (!tile)
if (! tile)
return tile_buf;
src = tile_data_pointer (tile,
src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src = tile_data_pointer (tile, src_x, info->src_y);
}
}
}
@ -1657,20 +1629,13 @@ render_image_tile_fault_one_row (RenderInfo *info)
g_return_val_if_fail (tile[0] != NULL, tile_buf);
src[4] = tile_data_pointer (tile[0],
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src[7] = tile_data_pointer (tile[0],
info->src_x % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[4] = tile_data_pointer (tile[0], info->src_x, info->src_y);
src[7] = tile_data_pointer (tile[0], info->src_x, info->src_y + 1);
if (tile[1])
{
src[5] = tile_data_pointer (tile[1],
(info->src_x + 1)% TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src[8] = tile_data_pointer (tile[1],
(info->src_x + 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[5] = tile_data_pointer (tile[1], info->src_x + 1, info->src_y);
src[8] = tile_data_pointer (tile[1], info->src_x + 1, info->src_y + 1);
}
else
{
@ -1680,9 +1645,7 @@ render_image_tile_fault_one_row (RenderInfo *info)
if (tile[0])
{
src[1] = tile_data_pointer (tile[0],
(info->src_x) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[1] = tile_data_pointer (tile[0], info->src_x, info->src_y - 1);
}
else
{
@ -1691,9 +1654,7 @@ render_image_tile_fault_one_row (RenderInfo *info)
if (tile[2])
{
src[0] = tile_data_pointer (tile[2],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[0] = tile_data_pointer (tile[2], info->src_x - 1, info->src_y - 1);
}
else
{
@ -1702,9 +1663,7 @@ render_image_tile_fault_one_row (RenderInfo *info)
if (tile[1])
{
src[2] = tile_data_pointer (tile[1],
(info->src_x + 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src[2] = tile_data_pointer (tile[1], info->src_x + 1, info->src_y - 1);
}
else
{
@ -1713,12 +1672,8 @@ render_image_tile_fault_one_row (RenderInfo *info)
if (tile[2])
{
src[3] = tile_data_pointer (tile[2],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y) % TILE_HEIGHT);
src[6] = tile_data_pointer (tile[2],
(info->src_x - 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[3] = tile_data_pointer (tile[2], info->src_x - 1, info->src_y);
src[6] = tile_data_pointer (tile[2], info->src_x - 1, info->src_y + 1);
}
else
{
@ -1826,18 +1781,12 @@ render_image_tile_fault_one_row (RenderInfo *info)
tile[0] = tile_manager_get_tile (info->src_tiles,
src_x, info->src_y, TRUE, FALSE);
if (!tile[0])
if (! tile[0])
goto done;
src[4] = tile_data_pointer (tile[0],
src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src[7] = tile_data_pointer (tile[0],
(src_x) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src[1] = tile_data_pointer (tile[0],
src_x % TILE_WIDTH,
(info->src_y - 1)% TILE_HEIGHT);
src[4] = tile_data_pointer (tile[0], src_x, info->src_y);
src[7] = tile_data_pointer (tile[0], src_x, info->src_y + 1);
src[1] = tile_data_pointer (tile[0], src_x, info->src_y - 1);
}
if (((src_x + 1) / TILE_WIDTH) != tilex1)
@ -1851,7 +1800,7 @@ render_image_tile_fault_one_row (RenderInfo *info)
src_x + 1, info->src_y,
TRUE, FALSE);
if (!tile[1])
if (! tile[1])
{
src[5] = src[4];
src[8] = src[7];
@ -1860,14 +1809,11 @@ render_image_tile_fault_one_row (RenderInfo *info)
else
{
src[5] = tile_data_pointer (tile[1],
(src_x + 1) % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src_x + 1, info->src_y);
src[8] = tile_data_pointer (tile[1],
(src_x + 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src_x + 1, info->src_y + 1);
src[2] = tile_data_pointer (tile[1],
(src_x + 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src_x + 1, info->src_y - 1);
}
}
@ -1882,7 +1828,7 @@ render_image_tile_fault_one_row (RenderInfo *info)
src_x - 1, info->src_y,
TRUE, FALSE);
if (!tile[2])
if (! tile[2])
{
src[3] = src[4];
src[6] = src[7];
@ -1891,14 +1837,11 @@ render_image_tile_fault_one_row (RenderInfo *info)
else
{
src[3] = tile_data_pointer (tile[2],
(src_x - 1) % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
src_x - 1, info->src_y);
src[6] = tile_data_pointer (tile[2],
(src_x - 1) % TILE_WIDTH,
(info->src_y + 1) % TILE_HEIGHT);
src_x - 1, info->src_y + 1);
src[0] = tile_data_pointer (tile[2],
(src_x - 1) % TILE_WIDTH,
(info->src_y - 1) % TILE_HEIGHT);
src_x - 1, info->src_y - 1);
}
}
}

View File

@ -2843,9 +2843,7 @@ shapeburst_region (PixelRegion *srcPR,
tile = tile_manager_get_tile (srcPR->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);
width = tile_ewidth (tile);
boundary = MIN (y % TILE_HEIGHT,

View File

@ -648,8 +648,7 @@ gimp_paint_core_get_orig_image (GimpPaintCore *core,
undo_tile = tile_manager_get_tile (core->undo_tiles,
srcPR.x, srcPR.y,
TRUE, FALSE);
s = tile_data_pointer (undo_tile,
srcPR.x % TILE_WIDTH, srcPR.y % TILE_HEIGHT);
s = tile_data_pointer (undo_tile, srcPR.x, srcPR.y);
}
else
{
@ -746,8 +745,7 @@ gimp_paint_core_get_orig_proj (GimpPaintCore *core,
saved_tile = tile_manager_get_tile (core->saved_proj_tiles,
srcPR.x, srcPR.y,
TRUE, FALSE);
s = tile_data_pointer (saved_tile,
srcPR.x % TILE_WIDTH, srcPR.y % TILE_HEIGHT);
s = tile_data_pointer (saved_tile, srcPR.x, srcPR.y);
}
else
{

View File

@ -1452,24 +1452,28 @@ gradient_map_value (TileManager *map,
guint8 *grad,
guint8 *dir)
{
static gint cur_tilex;
static gint cur_tiley;
guint8 *p;
static gint cur_tilex;
static gint cur_tiley;
const guint8 *p;
if (!cur_tile ||
if (! cur_tile ||
x / TILE_WIDTH != cur_tilex ||
y / TILE_HEIGHT != cur_tiley)
{
if (cur_tile)
tile_release (cur_tile, FALSE);
cur_tile = tile_manager_get_tile (map, x, y, TRUE, FALSE);
if (!cur_tile)
return FALSE;
cur_tilex = x / TILE_WIDTH;
cur_tiley = y / TILE_HEIGHT;
}
p = tile_data_pointer (cur_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
p = tile_data_pointer (cur_tile, x, y);
*grad = p[0];
*dir = p[1];
@ -1755,7 +1759,8 @@ gradmap_tile_validate (TileManager *tm,
sw = tile_ewidth (srctile);
sh = tile_eheight (srctile);
pixel_region_init_data (&srcPR, tile_data_pointer (srctile, 0, 0),
pixel_region_init_data (&srcPR,
tile_data_pointer (srctile, 0, 0),
gimp_pickable_get_bytes (pickable),
gimp_pickable_get_bytes (pickable) *
MIN (dw, sw),