Bunch of tile-related stuff.

This commit is contained in:
scott 1998-08-11 17:35:34 +00:00
parent 5343ba5816
commit 0ffabfe95b
79 changed files with 732 additions and 547 deletions

View File

@ -1,3 +1,18 @@
Tue Aug 11 12:24:14 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* tile.c tile.h: exported some accessor functions, made Tile
opaque.
* tile_manager.c tile_manager.h: added a public call to invalidate
a tile
* blend.c boundary.c by_color_select.c channel.c color_picker.c
drawable_cmds.c fuzzy_select.c gimpimage.c image_render.c ink.c
layer.c paint_core.c paint_funcs.c pixel_region.c plug_in.c undo.c
xcf.c: eliminated references to tile private data
* ink.c (ink_set_undo_tiles), paint_core.c (set_undo_tiles): used
tile sharing to replace tile copies for undo tiles
* undo.c (undo_pop_image): swap tiles instead of pixels when
possible
Mon Aug 10 14:48:20 PDT 1998 Manish Singh <yosh@gimp.org>
* app/gdisplay.c: corrected 2 annoyances: that stupid hash table

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -21,7 +21,7 @@
#include "errors.h"
#include "boundary.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* half intensity for mask */
#define HALF_WAY 127
@ -126,8 +126,8 @@ find_empty_segs (PixelRegion *maskPR,
if (tile)
tile_release (tile, FALSE);
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, 0, TRUE, FALSE);
data = tile->data + tile->bpp *
((scanline % TILE_HEIGHT) * tile->ewidth + (x % TILE_WIDTH)) + (tile->bpp - 1);
data = tile_data_pointer (tile, x % TILE_WIDTH, scanline % TILE_HEIGHT) + (tile_bpp(tile) - 1);
tilex = x / TILE_WIDTH;
}
@ -143,7 +143,7 @@ find_empty_segs (PixelRegion *maskPR,
(*num_empty)++;
last = val;
data += tile->bpp;
data += tile_bpp(tile);
}
if (last > 0)

View File

@ -23,7 +23,7 @@
#include "pixel_region.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
typedef struct _PixelRegionHolder PixelRegionHolder;
@ -144,25 +144,25 @@ pixel_region_get_row (PR, x, y, w, data, subsample)
while (x < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
npixels = tile->ewidth - (x % TILE_WIDTH);
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
npixels = tile_ewidth (tile) - (x % TILE_WIDTH);
if ((x + npixels) > end) /* make sure we don't write past the end */
npixels = end - x;
if (subsample == 1) /* optimize for the common case */
{
memcpy(data, tile_data, tile->bpp*npixels);
data += tile->bpp*npixels;
memcpy(data, tile_data, tile_bpp(tile)*npixels);
data += tile_bpp(tile)*npixels;
x += npixels;
}
else
{
boundary = x + npixels;
inc = subsample * tile->bpp;
inc = subsample * tile_bpp(tile);
for ( ; x < boundary; x += subsample)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
*data++ = tile_data[b];
tile_data += inc;
}
@ -191,16 +191,16 @@ pixel_region_set_row (PR, x, y, w, data)
while (x < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, TRUE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
npixels = tile->ewidth - (x % TILE_WIDTH);
npixels = tile_ewidth(tile) - (x % TILE_WIDTH);
if ((x + npixels) > end) /* make sure we don't write past the end */
npixels = end - x;
memcpy(tile_data, data, tile->bpp*npixels);
memcpy(tile_data, data, tile_bpp(tile)*npixels);
data += tile->bpp*npixels;
data += tile_bpp(tile)*npixels;
x += npixels;
tile_release (tile, TRUE);
@ -230,16 +230,16 @@ pixel_region_get_col (PR, x, y, h, data, subsample)
while (y < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = y + (tile->eheight - (y % TILE_HEIGHT));
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
boundary = y + (tile_eheight(tile) - (y % TILE_HEIGHT));
if (boundary > end) /* make sure we don't write past the end */
boundary = end;
inc = subsample * tile->bpp * tile->ewidth;
inc = subsample * tile_bpp(tile) * tile_ewidth(tile);
for ( ; y < boundary; y += subsample)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
*data++ = tile_data[b];
tile_data += inc;
}
@ -270,16 +270,16 @@ pixel_region_set_col (PR, x, y, h, data)
while (y < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, TRUE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = y + (tile->eheight - (y % TILE_HEIGHT));
inc = tile->bpp * tile->ewidth;
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
boundary = y + (tile_eheight(tile) - (y % TILE_HEIGHT));
inc = tile_bpp(tile) * tile_ewidth(tile);
if (boundary > end) /* make sure we don't write past the end */
boundary = end;
for ( ; y < boundary; y++)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
tile_data[b] = *data++;
tile_data += inc;
}
@ -596,8 +596,8 @@ pixel_region_configure (PRH, PRI)
offx = PRH->PR->x % TILE_WIDTH;
offy = PRH->PR->y % TILE_HEIGHT;
PRH->PR->rowstride = tile->ewidth * PRH->PR->bytes;
PRH->PR->data = tile->data + offy * PRH->PR->rowstride + offx * PRH->PR->bytes;
PRH->PR->rowstride = tile_ewidth(tile) * PRH->PR->bytes;
PRH->PR->data = tile_data_pointer(tile, offx, offy);
}
else
{

View File

@ -25,7 +25,6 @@
static void tile_manager_destroy_level (TileManager *tm,
TileLevel *level);
static void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
static int tile_manager_get_tile_num (TileManager *tm,
int xpixel,
int ypixel,
@ -444,7 +443,20 @@ tile_manager_destroy_level (TileManager *tm, TileLevel *level)
}
static void
void
tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
int xpixel, int ypixel, int level)
{
int tile_num;
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
if (tile_num < 0) return;
tile_invalidate (tile_ptr, tm, tile_num);
}
void
tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num)
{
Tile *tile = *tile_ptr;

View File

@ -119,6 +119,10 @@ void tile_manager_map (TileManager *tm,
void tile_manager_validate (TileManager *tm,
Tile *tile);
void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
void tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
int xpixel, int ypixel, int level);
/* Given a toplevel tile, this procedure will invalidate
* (set the dirty bit) for all tiles in lower levels which
* contain this toplevel tile.

View File

@ -204,6 +204,43 @@ tile_size (Tile *tile)
}
int
tile_ewidth (Tile *tile)
{
return tile->ewidth;
}
int
tile_eheight (Tile *tile)
{
return tile->eheight;
}
int
tile_bpp (Tile *tile)
{
return tile->bpp;
}
int
tile_is_valid (Tile *tile)
{
return tile->valid;
}
void
tile_mark_valid (Tile *tile)
{
TILE_MUTEX_LOCK (tile);
tile->valid = TRUE;
TILE_MUTEX_UNLOCK (tile);
}
void
tile_attach (Tile *tile, void *tm, int tile_num)
{
@ -264,3 +301,9 @@ tile_detach (Tile *tile, void *tm, int tile_num)
}
void *
tile_data_pointer (Tile *tile, int xoff, int yoff)
{
int offset = yoff * tile->ewidth + xoff;
return (void *)(tile->data + offset * tile->bpp);
}

View File

@ -45,6 +45,16 @@ void tile_alloc (Tile *tile);
*/
int tile_size (Tile *tile);
int tile_ewidth (Tile *tile);
int tile_eheight (Tile *tile);
int tile_bpp (Tile *tile);
int tile_is_valid (Tile *tile);
void tile_mark_valid (Tile *tile);
void *tile_data_pointer (Tile *tile, int xoff, int yoff);
/* tile_attach attaches a tile to a tile manager: this function
* increments the tile's share count and inserts a tilelink into the
* tile's link list. tile_detach reverses the process.

View File

@ -37,7 +37,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* target size */
#define TARGET_HEIGHT 15
@ -1034,7 +1034,7 @@ gradient_calc_shapeburst_angular_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = 1.0 - *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
tile_release (tile, FALSE);
return value;
@ -1052,7 +1052,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
tile_release (tile, FALSE);
@ -1071,7 +1071,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
tile_release (tile, FALSE);

View File

@ -21,7 +21,7 @@
#include "errors.h"
#include "boundary.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* half intensity for mask */
#define HALF_WAY 127
@ -126,8 +126,8 @@ find_empty_segs (PixelRegion *maskPR,
if (tile)
tile_release (tile, FALSE);
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, 0, TRUE, FALSE);
data = tile->data + tile->bpp *
((scanline % TILE_HEIGHT) * tile->ewidth + (x % TILE_WIDTH)) + (tile->bpp - 1);
data = tile_data_pointer (tile, x % TILE_WIDTH, scanline % TILE_HEIGHT) + (tile_bpp(tile) - 1);
tilex = x / TILE_WIDTH;
}
@ -143,7 +143,7 @@ find_empty_segs (PixelRegion *maskPR,
(*num_empty)++;
last = val;
data += tile->bpp;
data += tile_bpp(tile);
}
if (last > 0)

View File

@ -30,7 +30,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define DEFAULT_FUZZINESS 15
#define PREVIEW_WIDTH 256
@ -361,7 +361,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= gdisp->gimage->width || y >= gdisp->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, gimage_composite_type(gdisp->gimage), col, data);
tile_release (tile, FALSE);
}
@ -370,7 +370,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, drawable_type(drawable), col, data);
tile_release (tile, FALSE);
}
@ -932,7 +932,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= bcd->gimage->width || y >= bcd->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
else
{
@ -944,7 +944,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
by_color_select (bcd->gimage, drawable, col,

View File

@ -31,7 +31,7 @@
#include "undo.h"
#include "channel_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/*
enum {
@ -111,7 +111,8 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
memset (tile_data_pointer (tile, 0, 0),
TRANSPARENT_OPACITY, tile_size(tile));
}
@ -549,7 +550,7 @@ channel_value (Channel *mask, int x, int y)
}
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[(y % TILE_HEIGHT) * TILE_WIDTH + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;

View File

@ -26,7 +26,7 @@
#include "palette.h"
#include "tools.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
/* maximum information buffer size */
@ -328,8 +328,7 @@ get_color (GImage *gimage,
if (x >= 0 && y >= 0 && x < width && y < height)
{
tile = tile_manager_get_tile (tiles, x, y, 0, TRUE, FALSE);
src = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
else
return FALSE;

View File

@ -31,7 +31,7 @@
#include "undo.h"
#include "channel_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/*
enum {
@ -111,7 +111,8 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
memset (tile_data_pointer (tile, 0, 0),
TRANSPARENT_OPACITY, tile_size(tile));
}
@ -549,7 +550,7 @@ channel_value (Channel *mask, int x, int y)
}
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[(y % TILE_HEIGHT) * TILE_WIDTH + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;

View File

@ -31,7 +31,7 @@
#include "undo.h"
#include "channel_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/*
enum {
@ -111,7 +111,8 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
memset (tile_data_pointer (tile, 0, 0),
TRANSPARENT_OPACITY, tile_size(tile));
}
@ -549,7 +550,7 @@ channel_value (Channel *mask, int x, int y)
}
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[(y % TILE_HEIGHT) * TILE_WIDTH + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;

View File

@ -37,7 +37,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* target size */
#define TARGET_HEIGHT 15
@ -1034,7 +1034,7 @@ gradient_calc_shapeburst_angular_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = 1.0 - *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
tile_release (tile, FALSE);
return value;
@ -1052,7 +1052,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
tile_release (tile, FALSE);
@ -1071,7 +1071,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
tile_release (tile, FALSE);

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -40,7 +40,7 @@
#include "layer_pvt.h"
#include "channel_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
@ -618,14 +618,23 @@ undo_pop_image (GImage *gimage,
for (j = x; j < image_undo->x2; j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
src_tile = tile_manager_get_tile (tiles, j, i, 0, FALSE, FALSE);
if (src_tile->valid == TRUE)
if (tile_is_valid (src_tile) == TRUE)
{
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, TRUE);
swap_pixels (src_tile->data, dest_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_release (dest_tile, TRUE);
tile_release (src_tile, TRUE);
/* swap tiles, not pixels! */
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, FALSE /* TRUE */);
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, FALSE /* TRUE */);
tile_manager_map_tile (tiles, j, i, 0, dest_tile);
tile_manager_map_tile (drawable_data (image_undo->drawable), j, i, 0, 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 */);
}
}
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -31,7 +31,7 @@
#include "layer_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
enum {
LAST_SIGNAL
@ -942,11 +942,16 @@ layer_pick_correlate (layer, x, y)
*/
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH) + 1) - 1];
val = * (unsigned char*) (tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
tile_bpp (tile) - 1);
if (layer->mask)
{
unsigned char *ptr;
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
val = (val * mask_tile->data[mask_tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)]) / 255;
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
val = val * (*ptr) / 255;
tile_release (mask_tile, FALSE);
}

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -26,7 +26,7 @@
#include "pixel_region.h"
#include "scale.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
typedef struct _RenderInfo RenderInfo;
typedef void (*RenderFunc) (RenderInfo *info);
@ -2438,10 +2438,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return NULL;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(info->src_x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
scale = info->scale;
step = info->scalesrc * info->src_bpp;
dest = tile_buf;
@ -2468,9 +2467,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return tile_buf;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
}
}
}

View File

@ -26,7 +26,7 @@
#include "pixel_region.h"
#include "scale.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
typedef struct _RenderInfo RenderInfo;
typedef void (*RenderFunc) (RenderInfo *info);
@ -2438,10 +2438,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return NULL;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(info->src_x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
scale = info->scale;
step = info->scalesrc * info->src_bpp;
dest = tile_buf;
@ -2468,9 +2467,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return tile_buf;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
}
}
}

View File

@ -23,7 +23,7 @@
#include "drawable.h"
#include "drawable_cmds.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
static int int_value;
static int success;
@ -1270,7 +1270,7 @@ drawable_set_pixel_invoker (Argument *args)
x %= TILE_WIDTH;
y %= TILE_HEIGHT;
p = tile->data + tile->bpp * (tile->ewidth * y + x);
p = tile_data_pointer (tile, y, x);
for (b = 0; b < num_channels; b++)
*p++ = *pixel++;
@ -1374,7 +1374,7 @@ drawable_get_pixel_invoker (Argument *args)
x %= TILE_WIDTH;
y %= TILE_HEIGHT;
p = tile->data + tile->bpp * (tile->ewidth * y + x);
p = tile_data_pointer (tile, x, y);
for (b = 0; b < num_channels; b++)
pixel[b] = p[b];

View File

@ -28,7 +28,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define NO 0
#define YES 1
@ -131,8 +131,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
*s_tile = tile_manager_get_tile (src, x, y, 0, TRUE, FALSE);
*m_tile = tile_manager_get_tile (mask, x, y, 0, TRUE, TRUE);
*s = (*s_tile)->data + (*s_tile)->bpp * ((*s_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
*m = (*m_tile)->data + (*m_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH);
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
static int
@ -215,7 +215,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
if (y < 0 || y >= src->h) return;
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile,
x%TILE_WIDTH, y%TILE_HEIGHT));
tile_release (tile, FALSE);
if (val != 0)
return;
@ -283,8 +284,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
if (tile)
{
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);

View File

@ -31,7 +31,7 @@
#include "undo.h"
#include "channel_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/*
enum {
@ -111,7 +111,8 @@ static void
channel_validate (TileManager *tm, Tile *tile, int level)
{
/* Set the contents of the tile to empty */
memset (tile->data, TRANSPARENT_OPACITY, tile->ewidth * tile->eheight);
memset (tile_data_pointer (tile, 0, 0),
TRANSPARENT_OPACITY, tile_size(tile));
}
@ -549,7 +550,7 @@ channel_value (Channel *mask, int x, int y)
}
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[(y % TILE_HEIGHT) * TILE_WIDTH + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;

View File

@ -26,8 +26,8 @@
#include "undo.h"
#include "gimpsignal.h"
#include "tile_manager.h" /* ick. */
#include "tile_pvt.h"
#include "tile_manager.h"
#include "tile.h"
#include "layer_pvt.h"
#include "drawable_pvt.h" /* ick ick. */
@ -1234,19 +1234,19 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
if (! flat)
{
/* check if the tile is outside the bounds */
if ((MIN ((j + tile->ewidth), x2) - MAX (j, x1)) <= 0)
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (j < x1)
startx = MAX (startx, (j + tile->ewidth));
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile->eheight), y2) - MAX (i, y1) <= 0)
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile->valid = FALSE;
tile_invalidate_tile (&tile, tm, j, i, 0);
if (i < y1)
starty = MAX (starty, (i + tile->eheight));
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
@ -1255,17 +1255,17 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile->valid == FALSE)
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile->ewidth);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile->eheight);
endy = MAX (endy, tiley + tile_eheight(tile));
tile->valid = TRUE;
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
@ -1287,8 +1287,8 @@ gimp_image_validate (TileManager *tm, Tile *tile, int level)
/* Find the coordinates of this tile */
tile_manager_get_tile_coordinates (tm, tile, &x, &y);
w = tile->ewidth;
h = tile->eheight;
w = tile_ewidth(tile);
h = tile_eheight(tile);
gimp_image_construct (gimage, x, y, w, h);
}

View File

@ -31,7 +31,7 @@
#include "layer_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
enum {
LAST_SIGNAL
@ -942,11 +942,16 @@ layer_pick_correlate (layer, x, y)
*/
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH) + 1) - 1];
val = * (unsigned char*) (tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
tile_bpp (tile) - 1);
if (layer->mask)
{
unsigned char *ptr;
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
val = (val * mask_tile->data[mask_tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)]) / 255;
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
val = val * (*ptr) / 255;
tile_release (mask_tile, FALSE);
}

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -26,7 +26,7 @@
#include "pixel_region.h"
#include "scale.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
typedef struct _RenderInfo RenderInfo;
typedef void (*RenderFunc) (RenderInfo *info);
@ -2438,10 +2438,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return NULL;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(info->src_x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
info->src_x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
scale = info->scale;
step = info->scalesrc * info->src_bpp;
dest = tile_buf;
@ -2468,9 +2467,9 @@ render_image_tile_fault (RenderInfo *info)
if (!tile)
return tile_buf;
data = (tile->data +
((info->src_y % TILE_HEIGHT) * tile->ewidth +
(x % TILE_WIDTH)) * tile->bpp);
data = tile_data_pointer (tile,
x % TILE_WIDTH,
info->src_y % TILE_HEIGHT);
}
}
}

View File

@ -26,7 +26,7 @@
#include "undo.h"
#include "blob.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#include <math.h>
#include <stdlib.h>
@ -975,14 +975,11 @@ ink_set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1002,10 +999,12 @@ ink_set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0),
0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -31,7 +31,7 @@
#include "layer_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
enum {
LAST_SIGNAL
@ -942,11 +942,16 @@ layer_pick_correlate (layer, x, y)
*/
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH) + 1) - 1];
val = * (unsigned char*) (tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
tile_bpp (tile) - 1);
if (layer->mask)
{
unsigned char *ptr;
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
val = (val * mask_tile->data[mask_tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)]) / 255;
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
val = val * (*ptr) / 255;
tile_release (mask_tile, FALSE);
}

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -26,7 +26,7 @@
#include "tile_manager.h"
#include "tile_manager_pvt.h" /* For copy-on-write */
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define STD_BUF_SIZE 1021
#define MAXDIFF 195076
@ -3707,10 +3707,10 @@ shapeburst_region (PixelRegion *srcPR,
while (y >= end)
{
tile = tile_manager_get_tile (srcPR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = MINIMUM ((y % TILE_HEIGHT), (tile->ewidth - (x % TILE_WIDTH) - 1));
tile_data = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
boundary = MINIMUM ((y % TILE_HEIGHT), (tile_ewidth(tile) - (x % TILE_WIDTH) - 1));
boundary = MINIMUM (boundary, (y - end)) + 1;
inc = 1 - tile->ewidth;
inc = 1 - tile_ewidth (tile);
while (boundary--)
{

View File

@ -26,7 +26,7 @@
#include "undo.h"
#include "blob.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#include <math.h>
#include <stdlib.h>
@ -975,14 +975,11 @@ ink_set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1002,10 +999,12 @@ ink_set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0),
0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -33,7 +33,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SQR(x) ((x) * (x))
#define EPSILON 0.00001
@ -676,13 +676,14 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
/* If the undo tile corresponding to this location is valid, use it */
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y,
0, FALSE, FALSE);
if (undo_tile->valid == TRUE)
if (tile_is_valid (undo_tile) == TRUE)
{
refd = 1;
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y,
0, TRUE, FALSE);
s = undo_tile->data + srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
srcPR.bytes * (srcPR.x % TILE_WIDTH);
s = tile_data_pointer (undo_tile, 0, 0) +
srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
srcPR.bytes * (srcPR.x % TILE_WIDTH); /* dubious... */
}
else
{
@ -1244,14 +1245,11 @@ set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1270,10 +1268,11 @@ set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0), 0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -26,7 +26,7 @@
#include "tile_manager.h"
#include "tile_manager_pvt.h" /* For copy-on-write */
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define STD_BUF_SIZE 1021
#define MAXDIFF 195076
@ -3707,10 +3707,10 @@ shapeburst_region (PixelRegion *srcPR,
while (y >= end)
{
tile = tile_manager_get_tile (srcPR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = MINIMUM ((y % TILE_HEIGHT), (tile->ewidth - (x % TILE_WIDTH) - 1));
tile_data = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
boundary = MINIMUM ((y % TILE_HEIGHT), (tile_ewidth(tile) - (x % TILE_WIDTH) - 1));
boundary = MINIMUM (boundary, (y - end)) + 1;
inc = 1 - tile->ewidth;
inc = 1 - tile_ewidth (tile);
while (boundary--)
{

View File

@ -23,7 +23,7 @@
#include "pixel_region.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
typedef struct _PixelRegionHolder PixelRegionHolder;
@ -144,25 +144,25 @@ pixel_region_get_row (PR, x, y, w, data, subsample)
while (x < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
npixels = tile->ewidth - (x % TILE_WIDTH);
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
npixels = tile_ewidth (tile) - (x % TILE_WIDTH);
if ((x + npixels) > end) /* make sure we don't write past the end */
npixels = end - x;
if (subsample == 1) /* optimize for the common case */
{
memcpy(data, tile_data, tile->bpp*npixels);
data += tile->bpp*npixels;
memcpy(data, tile_data, tile_bpp(tile)*npixels);
data += tile_bpp(tile)*npixels;
x += npixels;
}
else
{
boundary = x + npixels;
inc = subsample * tile->bpp;
inc = subsample * tile_bpp(tile);
for ( ; x < boundary; x += subsample)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
*data++ = tile_data[b];
tile_data += inc;
}
@ -191,16 +191,16 @@ pixel_region_set_row (PR, x, y, w, data)
while (x < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, TRUE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
npixels = tile->ewidth - (x % TILE_WIDTH);
npixels = tile_ewidth(tile) - (x % TILE_WIDTH);
if ((x + npixels) > end) /* make sure we don't write past the end */
npixels = end - x;
memcpy(tile_data, data, tile->bpp*npixels);
memcpy(tile_data, data, tile_bpp(tile)*npixels);
data += tile->bpp*npixels;
data += tile_bpp(tile)*npixels;
x += npixels;
tile_release (tile, TRUE);
@ -230,16 +230,16 @@ pixel_region_get_col (PR, x, y, h, data, subsample)
while (y < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, FALSE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = y + (tile->eheight - (y % TILE_HEIGHT));
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
boundary = y + (tile_eheight(tile) - (y % TILE_HEIGHT));
if (boundary > end) /* make sure we don't write past the end */
boundary = end;
inc = subsample * tile->bpp * tile->ewidth;
inc = subsample * tile_bpp(tile) * tile_ewidth(tile);
for ( ; y < boundary; y += subsample)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
*data++ = tile_data[b];
tile_data += inc;
}
@ -270,16 +270,16 @@ pixel_region_set_col (PR, x, y, h, data)
while (y < end)
{
tile = tile_manager_get_tile (PR->tiles, x, y, 0, TRUE, TRUE);
tile_data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
boundary = y + (tile->eheight - (y % TILE_HEIGHT));
inc = tile->bpp * tile->ewidth;
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
boundary = y + (tile_eheight(tile) - (y % TILE_HEIGHT));
inc = tile_bpp(tile) * tile_ewidth(tile);
if (boundary > end) /* make sure we don't write past the end */
boundary = end;
for ( ; y < boundary; y++)
{
for (b = 0; b < tile->bpp; b++)
for (b = 0; b < tile_bpp(tile); b++)
tile_data[b] = *data++;
tile_data += inc;
}
@ -596,8 +596,8 @@ pixel_region_configure (PRH, PRI)
offx = PRH->PR->x % TILE_WIDTH;
offy = PRH->PR->y % TILE_HEIGHT;
PRH->PR->rowstride = tile->ewidth * PRH->PR->bytes;
PRH->PR->data = tile->data + offy * PRH->PR->rowstride + offx * PRH->PR->bytes;
PRH->PR->rowstride = tile_ewidth(tile) * PRH->PR->bytes;
PRH->PR->data = tile_data_pointer(tile, offx, offy);
}
else
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -47,7 +47,7 @@
#include "menus.h"
#include "plug_in.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SEPARATE_PROGRESS_BAR
@ -1367,9 +1367,9 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
}
if (tile_data.use_shm)
memcpy (tile->data, shm_addr, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), shm_addr, tile_size (tile));
else
memcpy (tile->data, tile_info->data, tile_size (tile));
memcpy (tile_data_pointer (tile, 0, 0), tile_info->data, tile_size (tile));
tile_release (tile, TRUE);
@ -1406,15 +1406,15 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
tile_data.drawable_ID = tile_req->drawable_ID;
tile_data.tile_num = tile_req->tile_num;
tile_data.shadow = tile_req->shadow;
tile_data.bpp = tile->bpp;
tile_data.width = tile->ewidth;
tile_data.height = tile->eheight;
tile_data.bpp = tile_bpp(tile);
tile_data.width = tile_ewidth(tile);
tile_data.height = tile_eheight(tile);
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
if (tile_data.use_shm)
memcpy (shm_addr, tile->data, tile_size (tile));
memcpy (shm_addr, tile_data_pointer (tile, 0, 0), tile_size (tile));
else
tile_data.data = tile->data;
tile_data.data = tile_data_pointer (tile, 0, 0);
if (!gp_tile_data_write (current_writefd, &tile_data))
{

View File

@ -204,6 +204,43 @@ tile_size (Tile *tile)
}
int
tile_ewidth (Tile *tile)
{
return tile->ewidth;
}
int
tile_eheight (Tile *tile)
{
return tile->eheight;
}
int
tile_bpp (Tile *tile)
{
return tile->bpp;
}
int
tile_is_valid (Tile *tile)
{
return tile->valid;
}
void
tile_mark_valid (Tile *tile)
{
TILE_MUTEX_LOCK (tile);
tile->valid = TRUE;
TILE_MUTEX_UNLOCK (tile);
}
void
tile_attach (Tile *tile, void *tm, int tile_num)
{
@ -264,3 +301,9 @@ tile_detach (Tile *tile, void *tm, int tile_num)
}
void *
tile_data_pointer (Tile *tile, int xoff, int yoff)
{
int offset = yoff * tile->ewidth + xoff;
return (void *)(tile->data + offset * tile->bpp);
}

View File

@ -45,6 +45,16 @@ void tile_alloc (Tile *tile);
*/
int tile_size (Tile *tile);
int tile_ewidth (Tile *tile);
int tile_eheight (Tile *tile);
int tile_bpp (Tile *tile);
int tile_is_valid (Tile *tile);
void tile_mark_valid (Tile *tile);
void *tile_data_pointer (Tile *tile, int xoff, int yoff);
/* tile_attach attaches a tile to a tile manager: this function
* increments the tile's share count and inserts a tilelink into the
* tile's link list. tile_detach reverses the process.

View File

@ -25,7 +25,6 @@
static void tile_manager_destroy_level (TileManager *tm,
TileLevel *level);
static void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
static int tile_manager_get_tile_num (TileManager *tm,
int xpixel,
int ypixel,
@ -444,7 +443,20 @@ tile_manager_destroy_level (TileManager *tm, TileLevel *level)
}
static void
void
tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
int xpixel, int ypixel, int level)
{
int tile_num;
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
if (tile_num < 0) return;
tile_invalidate (tile_ptr, tm, tile_num);
}
void
tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num)
{
Tile *tile = *tile_ptr;

View File

@ -119,6 +119,10 @@ void tile_manager_map (TileManager *tm,
void tile_manager_validate (TileManager *tm,
Tile *tile);
void tile_invalidate (Tile **tile_ptr, TileManager *tm, int tile_num);
void tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
int xpixel, int ypixel, int level);
/* Given a toplevel tile, this procedure will invalidate
* (set the dirty bit) for all tiles in lower levels which
* contain this toplevel tile.

View File

@ -37,7 +37,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* target size */
#define TARGET_HEIGHT 15
@ -1034,7 +1034,7 @@ gradient_calc_shapeburst_angular_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = 1.0 - *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
tile_release (tile, FALSE);
return value;
@ -1052,7 +1052,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
tile_release (tile, FALSE);
@ -1071,7 +1071,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
tile_release (tile, FALSE);

View File

@ -30,7 +30,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define DEFAULT_FUZZINESS 15
#define PREVIEW_WIDTH 256
@ -361,7 +361,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= gdisp->gimage->width || y >= gdisp->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, gimage_composite_type(gdisp->gimage), col, data);
tile_release (tile, FALSE);
}
@ -370,7 +370,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, drawable_type(drawable), col, data);
tile_release (tile, FALSE);
}
@ -932,7 +932,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= bcd->gimage->width || y >= bcd->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
else
{
@ -944,7 +944,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
by_color_select (bcd->gimage, drawable, col,

View File

@ -26,7 +26,7 @@
#include "palette.h"
#include "tools.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
/* maximum information buffer size */
@ -328,8 +328,7 @@ get_color (GImage *gimage,
if (x >= 0 && y >= 0 && x < width && y < height)
{
tile = tile_manager_get_tile (tiles, x, y, 0, TRUE, FALSE);
src = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
else
return FALSE;

View File

@ -28,7 +28,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define NO 0
#define YES 1
@ -131,8 +131,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
*s_tile = tile_manager_get_tile (src, x, y, 0, TRUE, FALSE);
*m_tile = tile_manager_get_tile (mask, x, y, 0, TRUE, TRUE);
*s = (*s_tile)->data + (*s_tile)->bpp * ((*s_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
*m = (*m_tile)->data + (*m_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH);
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
static int
@ -215,7 +215,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
if (y < 0 || y >= src->h) return;
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile,
x%TILE_WIDTH, y%TILE_HEIGHT));
tile_release (tile, FALSE);
if (val != 0)
return;
@ -283,8 +284,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
if (tile)
{
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);

View File

@ -37,7 +37,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h"
/* target size */
#define TARGET_HEIGHT 15
@ -1034,7 +1034,7 @@ gradient_calc_shapeburst_angular_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = 1.0 - *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
tile_release (tile, FALSE);
return value;
@ -1052,7 +1052,7 @@ gradient_calc_shapeburst_spherical_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = 1.0 - sin (0.5 * M_PI * value);
tile_release (tile, FALSE);
@ -1071,7 +1071,7 @@ gradient_calc_shapeburst_dimpled_factor (double x,
ix = (int) BOUNDS (x, 0, distR.w);
iy = (int) BOUNDS (y, 0, distR.h);
tile = tile_manager_get_tile (distR.tiles, ix, iy, 0, TRUE, FALSE);
value = *(((float *) tile->data) + ((iy % TILE_HEIGHT) * tile->ewidth + (ix % TILE_WIDTH)));
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
value = cos (0.5 * M_PI * value);
tile_release (tile, FALSE);

View File

@ -30,7 +30,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define DEFAULT_FUZZINESS 15
#define PREVIEW_WIDTH 256
@ -361,7 +361,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= gdisp->gimage->width || y >= gdisp->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, gimage_composite_type(gdisp->gimage), col, data);
tile_release (tile, FALSE);
}
@ -370,7 +370,7 @@ by_color_select_button_release (Tool *tool,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
data = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
gimage_get_color (gdisp->gimage, drawable_type(drawable), col, data);
tile_release (tile, FALSE);
}
@ -932,7 +932,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= bcd->gimage->width || y >= bcd->gimage->height)
return;
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
else
{
@ -944,7 +944,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
if (x < 0 || y < 0 || x >= drawable_width (drawable) || y >= drawable_height (drawable))
return;
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
col = tile->data + tile->bpp * (tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
by_color_select (bcd->gimage, drawable, col,

View File

@ -28,7 +28,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define NO 0
#define YES 1
@ -131,8 +131,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
*s_tile = tile_manager_get_tile (src, x, y, 0, TRUE, FALSE);
*m_tile = tile_manager_get_tile (mask, x, y, 0, TRUE, TRUE);
*s = (*s_tile)->data + (*s_tile)->bpp * ((*s_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
*m = (*m_tile)->data + (*m_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH);
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
static int
@ -215,7 +215,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
if (y < 0 || y >= src->h) return;
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile,
x%TILE_WIDTH, y%TILE_HEIGHT));
tile_release (tile, FALSE);
if (val != 0)
return;
@ -283,8 +284,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
if (tile)
{
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);

View File

@ -26,7 +26,7 @@
#include "undo.h"
#include "blob.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#include <math.h>
#include <stdlib.h>
@ -975,14 +975,11 @@ ink_set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1002,10 +999,12 @@ ink_set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0),
0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -28,7 +28,7 @@
#include "gdisplay.h"
#include "rect_select.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define NO 0
#define YES 1
@ -131,8 +131,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
*s_tile = tile_manager_get_tile (src, x, y, 0, TRUE, FALSE);
*m_tile = tile_manager_get_tile (mask, x, y, 0, TRUE, TRUE);
*s = (*s_tile)->data + (*s_tile)->bpp * ((*s_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH));
*m = (*m_tile)->data + (*m_tile)->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH);
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
}
static int
@ -215,7 +215,8 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
if (y < 0 || y >= src->h) return;
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
val = tile->data[tile->ewidth * (y % TILE_HEIGHT) + (x % TILE_WIDTH)];
val = *(unsigned char *)(tile_data_pointer (tile,
x%TILE_WIDTH, y%TILE_HEIGHT));
tile_release (tile, FALSE);
if (val != 0)
return;
@ -283,8 +284,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
if (tile)
{
start = tile->data + tile->ewidth * tile->bpp * (y % TILE_HEIGHT) +
tile->bpp * (x % TILE_WIDTH);
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
find_contiguous_region_helper (&maskPR, &srcPR, has_alpha, antialias, threshold, bytes, x, y, start);

View File

@ -26,7 +26,7 @@
#include "undo.h"
#include "blob.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#include <math.h>
#include <stdlib.h>
@ -975,14 +975,11 @@ ink_set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1002,10 +999,12 @@ ink_set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0),
0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -33,7 +33,7 @@
#include "tools.h"
#include "undo.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SQR(x) ((x) * (x))
#define EPSILON 0.00001
@ -676,13 +676,14 @@ paint_core_get_orig_image (paint_core, drawable, x1, y1, x2, y2)
/* If the undo tile corresponding to this location is valid, use it */
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y,
0, FALSE, FALSE);
if (undo_tile->valid == TRUE)
if (tile_is_valid (undo_tile) == TRUE)
{
refd = 1;
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y,
0, TRUE, FALSE);
s = undo_tile->data + srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
srcPR.bytes * (srcPR.x % TILE_WIDTH);
s = tile_data_pointer (undo_tile, 0, 0) +
srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
srcPR.bytes * (srcPR.x % TILE_WIDTH); /* dubious... */
}
else
{
@ -1244,14 +1245,11 @@ set_undo_tiles (drawable, x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, FALSE, FALSE);
if (dest_tile->valid == FALSE)
if (tile_is_valid (dest_tile) == FALSE)
{
dest_tile = tile_manager_get_tile (undo_tiles, j, i, 0, TRUE, TRUE);
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
memcpy (dest_tile->data, src_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
tile_release (src_tile, FALSE);
tile_release (dest_tile, TRUE);
}
}
}
@ -1270,10 +1268,11 @@ set_canvas_tiles (x, y, w, h)
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, FALSE, FALSE);
if (tile->valid == FALSE)
if (tile_is_valid (tile) == FALSE)
{
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
memset (tile->data, 0, (tile->ewidth * tile->eheight * tile->bpp));
memset (tile_data_pointer (tile, 0, 0), 0,
tile_size (tile));
tile_release (tile, TRUE);
}
}

View File

@ -38,7 +38,7 @@
#include "layer_pvt.h"
#include "drawable_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SQR(x) ((x) * (x))
@ -65,7 +65,7 @@ static void invert (Matrix, Matrix);
#define REF_TILE(i,x,y) \
tile[i] = tile_manager_get_tile (float_tiles, x, y, 0, TRUE, FALSE); \
src[i] = tile[i]->data + tile[i]->bpp * (tile[i]->ewidth * ((y) % TILE_HEIGHT) + ((x) % TILE_WIDTH));
src[i] = tile_data_pointer (tile[i], (x) % TILE_WIDTH, (y) % TILE_HEIGHT);
void

View File

@ -38,7 +38,7 @@
#include "layer_pvt.h"
#include "drawable_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
#define SQR(x) ((x) * (x))
@ -65,7 +65,7 @@ static void invert (Matrix, Matrix);
#define REF_TILE(i,x,y) \
tile[i] = tile_manager_get_tile (float_tiles, x, y, 0, TRUE, FALSE); \
src[i] = tile[i]->data + tile[i]->bpp * (tile[i]->ewidth * ((y) % TILE_HEIGHT) + ((x) % TILE_WIDTH));
src[i] = tile_data_pointer (tile[i], (x) % TILE_WIDTH, (y) % TILE_HEIGHT);
void

View File

@ -40,7 +40,7 @@
#include "layer_pvt.h"
#include "channel_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
@ -618,14 +618,23 @@ undo_pop_image (GImage *gimage,
for (j = x; j < image_undo->x2; j += (TILE_WIDTH - (j % TILE_WIDTH)))
{
src_tile = tile_manager_get_tile (tiles, j, i, 0, FALSE, FALSE);
if (src_tile->valid == TRUE)
if (tile_is_valid (src_tile) == TRUE)
{
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, TRUE);
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, TRUE);
swap_pixels (src_tile->data, dest_tile->data,
(src_tile->ewidth * src_tile->eheight * src_tile->bpp));
tile_release (dest_tile, TRUE);
tile_release (src_tile, TRUE);
/* swap tiles, not pixels! */
src_tile = tile_manager_get_tile (tiles, j, i, 0, TRUE, FALSE /* TRUE */);
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 0, TRUE, FALSE /* TRUE */);
tile_manager_map_tile (tiles, j, i, 0, dest_tile);
tile_manager_map_tile (drawable_data (image_undo->drawable), j, i, 0, 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 */);
}
}
}

View File

@ -26,7 +26,7 @@
#include "layer_pvt.h"
#include "channel_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
/* #define SWAP_FROM_FILE */
@ -1090,7 +1090,8 @@ xcf_save_tile (XcfInfo *info,
Tile *tile)
{
tile_lock (tile);
info->cp += xcf_write_int8 (info->fp, tile->data, tile_size (tile));
info->cp += xcf_write_int8 (info->fp, tile_data_pointer (tile, 0, 0),
tile_size (tile));
tile_release (tile, FALSE);
}
@ -1110,16 +1111,16 @@ xcf_save_tile_rle (XcfInfo *info,
tile_lock (tile);
bpp = tile->bpp;
bpp = tile_bpp (tile);
for (i = 0; i < bpp; i++)
{
data = tile->data + i;
data = tile_data_pointer (tile, 0, 0) + i;
state = 0;
length = 0;
count = 0;
size = tile->ewidth * tile->eheight;
size = tile_ewidth(tile) * tile_eheight(tile);
last = -1;
while (size > 0)
@ -1207,7 +1208,7 @@ xcf_save_tile_rle (XcfInfo *info,
}
}
if (count != (tile->ewidth * tile->eheight))
if (count != (tile_ewidth (tile) * tile_eheight (tile)))
g_print ("xcf: uh oh! xcf rle tile saving error: %d\n", count);
}
@ -1944,10 +1945,11 @@ xcf_load_level (XcfInfo *info,
if (previous != NULL)
{
tile_lock (previous);
if (tile->ewidth == previous->ewidth &&
tile->eheight == previous->eheight &&
tile->bpp == previous->bpp &&
memcmp (tile->data, previous->data,
if (tile_ewidth (tile) == tile_ewidth (previous) &&
tile_eheight (tile) == tile_eheight (previous) &&
tile_bpp (tile) == tile_bpp (previous) &&
memcmp (tile_data_pointer(tile, 0, 0),
tile_data_pointer(previous, 0, 0),
tile_size (tile)) == 0)
{
tile_release (tile, TRUE);
@ -2007,7 +2009,8 @@ xcf_load_tile (XcfInfo *info,
#else
info->cp += xcf_read_int8 (info->fp, tile->data, tile_size (tile));
info->cp += xcf_read_int8 (info->fp, tile_data_pointer(tile, 0, 0),
tile_size (tile));
#endif
@ -2028,13 +2031,13 @@ xcf_load_tile_rle (XcfInfo *info,
int bpp;
int i, j;
data = tile->data;
bpp = tile->bpp;
data = tile_data_pointer (tile, 0, 0);
bpp = tile_bpp (tile);
for (i = 0; i < bpp; i++)
{
data = tile->data + i;
size = tile->ewidth * tile->eheight;
data = tile_data_pointer (tile, 0, 0) + i;
size = tile_ewidth (tile) * tile_eheight (tile);
count = 0;
while (size > 0)

View File

@ -26,7 +26,7 @@
#include "layer_pvt.h"
#include "channel_pvt.h"
#include "tile_manager_pvt.h"
#include "tile_pvt.h" /* ick. */
#include "tile.h" /* ick. */
/* #define SWAP_FROM_FILE */
@ -1090,7 +1090,8 @@ xcf_save_tile (XcfInfo *info,
Tile *tile)
{
tile_lock (tile);
info->cp += xcf_write_int8 (info->fp, tile->data, tile_size (tile));
info->cp += xcf_write_int8 (info->fp, tile_data_pointer (tile, 0, 0),
tile_size (tile));
tile_release (tile, FALSE);
}
@ -1110,16 +1111,16 @@ xcf_save_tile_rle (XcfInfo *info,
tile_lock (tile);
bpp = tile->bpp;
bpp = tile_bpp (tile);
for (i = 0; i < bpp; i++)
{
data = tile->data + i;
data = tile_data_pointer (tile, 0, 0) + i;
state = 0;
length = 0;
count = 0;
size = tile->ewidth * tile->eheight;
size = tile_ewidth(tile) * tile_eheight(tile);
last = -1;
while (size > 0)
@ -1207,7 +1208,7 @@ xcf_save_tile_rle (XcfInfo *info,
}
}
if (count != (tile->ewidth * tile->eheight))
if (count != (tile_ewidth (tile) * tile_eheight (tile)))
g_print ("xcf: uh oh! xcf rle tile saving error: %d\n", count);
}
@ -1944,10 +1945,11 @@ xcf_load_level (XcfInfo *info,
if (previous != NULL)
{
tile_lock (previous);
if (tile->ewidth == previous->ewidth &&
tile->eheight == previous->eheight &&
tile->bpp == previous->bpp &&
memcmp (tile->data, previous->data,
if (tile_ewidth (tile) == tile_ewidth (previous) &&
tile_eheight (tile) == tile_eheight (previous) &&
tile_bpp (tile) == tile_bpp (previous) &&
memcmp (tile_data_pointer(tile, 0, 0),
tile_data_pointer(previous, 0, 0),
tile_size (tile)) == 0)
{
tile_release (tile, TRUE);
@ -2007,7 +2009,8 @@ xcf_load_tile (XcfInfo *info,
#else
info->cp += xcf_read_int8 (info->fp, tile->data, tile_size (tile));
info->cp += xcf_read_int8 (info->fp, tile_data_pointer(tile, 0, 0),
tile_size (tile));
#endif
@ -2028,13 +2031,13 @@ xcf_load_tile_rle (XcfInfo *info,
int bpp;
int i, j;
data = tile->data;
bpp = tile->bpp;
data = tile_data_pointer (tile, 0, 0);
bpp = tile_bpp (tile);
for (i = 0; i < bpp; i++)
{
data = tile->data + i;
size = tile->ewidth * tile->eheight;
data = tile_data_pointer (tile, 0, 0) + i;
size = tile_ewidth (tile) * tile_eheight (tile);
count = 0;
while (size > 0)