mirror of https://github.com/GNOME/gimp.git
Another tile tweak. This one eliminates tile levels (which add
bookkeeping without being used). Made copy_region more intelligent on when to use tile sharing; some changes made to pixel_regions to facilitate this. Fixed a refcount problem with xcf load and probably a few other bugs that I've forgotten about. Added a sanity check in set_undo_tiles to help with a problem larry is reporting with airbrush and xinput. --sg
This commit is contained in:
parent
8e5e63d7ca
commit
85393964a0
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
Sat Aug 15 14:09:12 1998 Scott Goehring <scott@poverty.bloomington.in.us>
|
||||
|
||||
* blend.c boundary.c by_color_select.c channel.c color_picker.c
|
||||
convert.c drawable_cmds.c file_new_dialog.c flip_tool.c
|
||||
floating_sel.c fuzzy_select.c gimage_mask.c gimpimage.c
|
||||
gimpimage.h global_edit.c image_map.c image_render.c ink.c
|
||||
layer.c paint_core.c paint_funcs.c perspective_tool.c
|
||||
pixel_region.c pixel_region.h plug_in.c rotate_tool.c
|
||||
scale_tool.c shear_tool.c text_tool.c tile_manager.c
|
||||
tile_manager.h tile_manager_pvt.h transform_core.c undo.c xcf.c:
|
||||
|
||||
Another tile tweak. This one eliminates tile levels (which add
|
||||
bookkeeping without being used). Made copy_region more
|
||||
intelligent on when to use tile sharing; some changes made to
|
||||
pixel_regions to facilitate this. Fixed a refcount problem with
|
||||
xcf load and probably a few other bugs that I've forgotten
|
||||
about. Added a sanity check in set_undo_tiles to help with a
|
||||
problem larry is reporting with airbrush and xinput.
|
||||
|
||||
Sat Aug 15 16:11:07 MEST 1998 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* TODO: updated the TODO file
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -125,7 +125,7 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
{
|
||||
if (tile)
|
||||
tile_release (tile, FALSE);
|
||||
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, TRUE, FALSE);
|
||||
data = tile_data_pointer (tile, x % TILE_WIDTH, scanline % TILE_HEIGHT) + (tile_bpp(tile) - 1);
|
||||
|
||||
tilex = x / TILE_WIDTH;
|
||||
|
|
|
@ -74,8 +74,9 @@ pixel_region_init (PR, tiles, x, y, w, h, dirty)
|
|||
int dirty;
|
||||
{
|
||||
PR->tiles = tiles;
|
||||
PR->curtile = NULL;
|
||||
PR->data = NULL;
|
||||
PR->bytes = tiles->levels[0].bpp;
|
||||
PR->bytes = tiles->bpp;
|
||||
PR->rowstride = PR->bytes * TILE_WIDTH;
|
||||
PR->x = x;
|
||||
PR->y = y;
|
||||
|
@ -118,7 +119,7 @@ pixel_region_get_async (PR, ulx, uly, lrx, lry)
|
|||
|
||||
for (y = uly; y < lry; y += TILE_HEIGHT)
|
||||
for (x = ulx; x < lrx; x += TILE_WIDTH)
|
||||
tile_manager_get_async (PR->tiles, x, y, 0);
|
||||
tile_manager_get_async (PR->tiles, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -143,7 +144,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
|
||||
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
npixels = tile_ewidth (tile) - (x % TILE_WIDTH);
|
||||
|
||||
|
@ -190,7 +191,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, TRUE);
|
||||
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
|
||||
npixels = tile_ewidth(tile) - (x % TILE_WIDTH);
|
||||
|
@ -229,7 +230,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
|
||||
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 */
|
||||
|
@ -269,7 +270,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, TRUE);
|
||||
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);
|
||||
|
@ -370,8 +371,8 @@ pixel_regions_process (PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, FALSE, FALSE);
|
||||
tile_release (tile, PRH->PR->dirty);
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
|
||||
PRH->PR->x += PRI->portion_width;
|
||||
|
@ -417,8 +418,8 @@ pixel_regions_process_stop (PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, FALSE, FALSE);
|
||||
tile_release (tile, PRH->PR->dirty);
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,16 +589,14 @@ pixel_region_configure (PRH, PRI)
|
|||
*/
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile;
|
||||
int offx, offy;
|
||||
PRH->PR->curtile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty);
|
||||
|
||||
tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, TRUE, PRH->PR->dirty);
|
||||
PRH->PR->offx = PRH->PR->x % TILE_WIDTH;
|
||||
PRH->PR->offy = PRH->PR->y % TILE_HEIGHT;
|
||||
|
||||
offx = PRH->PR->x % TILE_WIDTH;
|
||||
offy = PRH->PR->y % TILE_HEIGHT;
|
||||
|
||||
PRH->PR->rowstride = tile_ewidth(tile) * PRH->PR->bytes;
|
||||
PRH->PR->data = tile_data_pointer(tile, offx, offy);
|
||||
PRH->PR->rowstride = tile_ewidth(PRH->PR->curtile) * PRH->PR->bytes;
|
||||
PRH->PR->data = tile_data_pointer(PRH->PR->curtile,
|
||||
PRH->PR->offx, PRH->PR->offy);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,6 +26,8 @@ struct _PixelRegion
|
|||
{
|
||||
unsigned char * data; /* pointer to region data */
|
||||
TileManager * tiles; /* pointer to tiles */
|
||||
Tile * curtile; /* current tile */
|
||||
int offx, offy; /* tile offsets */
|
||||
int rowstride; /* bytes per pixel row */
|
||||
int x, y; /* origin */
|
||||
int w, h; /* width and height of region */
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
|
||||
#include "tile.h"
|
||||
|
||||
struct _TileLevel
|
||||
struct _TileManager
|
||||
{
|
||||
int x, y; /* tile manager offsets */
|
||||
|
||||
int width; /* the width of the tiled area */
|
||||
int height; /* the height of the tiled area */
|
||||
int bpp; /* the bpp of each tile */
|
||||
|
@ -30,13 +32,6 @@ struct _TileLevel
|
|||
int ntile_cols; /* the number of tiles in each columns */
|
||||
|
||||
Tile **tiles; /* the tiles for this level */
|
||||
};
|
||||
|
||||
struct _TileManager
|
||||
{
|
||||
int x, y; /* tile manager offsets */
|
||||
int nlevels; /* the number of tile levels in the hierarchy */
|
||||
TileLevel *levels; /* the hierarchy */
|
||||
TileValidateProc validate_proc; /* this proc is called when an attempt to get an
|
||||
* invalid tile is made.
|
||||
*/
|
||||
|
|
|
@ -23,12 +23,9 @@
|
|||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h" /* ick. */
|
||||
|
||||
static void tile_manager_destroy_level (TileManager *tm,
|
||||
TileLevel *level);
|
||||
static int tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level);
|
||||
int ypixel);
|
||||
|
||||
|
||||
TileManager*
|
||||
|
@ -37,120 +34,48 @@ tile_manager_new (int toplevel_width,
|
|||
int bpp)
|
||||
{
|
||||
TileManager *tm;
|
||||
int tmp1, tmp2;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
tm = g_new (TileManager, 1);
|
||||
|
||||
tmp1 = tile_manager_calc_levels (toplevel_width, TILE_WIDTH);
|
||||
tmp2 = tile_manager_calc_levels (toplevel_height, TILE_HEIGHT);
|
||||
|
||||
tm->nlevels = MAX (tmp1, tmp2);
|
||||
tm->levels = g_new (TileLevel, tm->nlevels);
|
||||
tm->user_data = NULL;
|
||||
tm->validate_proc = NULL;
|
||||
|
||||
width = toplevel_width;
|
||||
height = toplevel_height;
|
||||
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
{
|
||||
tm->levels[i].width = width;
|
||||
tm->levels[i].height = height;
|
||||
tm->levels[i].bpp = bpp;
|
||||
tm->levels[i].ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
tm->levels[i].ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
tm->levels[i].tiles = NULL;
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
}
|
||||
|
||||
tm->width = width;
|
||||
tm->height = height;
|
||||
tm->bpp = bpp;
|
||||
tm->ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
tm->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
tm->tiles = NULL;
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_destroy (TileManager *tm)
|
||||
{
|
||||
int ntiles;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
tile_manager_destroy_level (tm, &tm->levels[i]);
|
||||
if (tm->tiles)
|
||||
{
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
for (i = 0; i < ntiles; i++)
|
||||
{
|
||||
TILE_MUTEX_LOCK (tm->tiles[i]);
|
||||
tile_detach (tm->tiles[i], tm, i);
|
||||
}
|
||||
|
||||
g_free (tm->tiles);
|
||||
}
|
||||
|
||||
g_free (tm->levels);
|
||||
g_free (tm);
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_calc_levels (int size,
|
||||
int tile_size)
|
||||
{
|
||||
int levels;
|
||||
|
||||
levels = 1;
|
||||
while (size > tile_size)
|
||||
{
|
||||
size /= 2;
|
||||
levels += 1;
|
||||
}
|
||||
|
||||
return levels;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_nlevels (TileManager *tm,
|
||||
int nlevels)
|
||||
{
|
||||
TileLevel *levels;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
if ((nlevels < 1) || (nlevels == tm->nlevels))
|
||||
return;
|
||||
|
||||
levels = g_new (TileLevel, nlevels);
|
||||
|
||||
if (nlevels > tm->nlevels)
|
||||
{
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
levels[i] = tm->levels[i];
|
||||
|
||||
width = tm->levels[tm->nlevels - 1].width;
|
||||
height = tm->levels[tm->nlevels - 1].height;
|
||||
|
||||
for (; i < nlevels; i++)
|
||||
{
|
||||
levels[i].width = width;
|
||||
levels[i].height = height;
|
||||
levels[i].bpp = tm->levels[0].bpp;
|
||||
levels[i].ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
levels[i].ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
levels[i].tiles = NULL;
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nlevels; i++)
|
||||
levels[i] = tm->levels[i];
|
||||
|
||||
for (; i < tm->nlevels; i++)
|
||||
tile_manager_destroy_level (tm, &tm->levels[i]);
|
||||
}
|
||||
|
||||
g_free (tm->levels);
|
||||
|
||||
tm->nlevels = nlevels;
|
||||
tm->levels = levels;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_validate_proc (TileManager *tm,
|
||||
|
@ -159,31 +84,29 @@ tile_manager_set_validate_proc (TileManager *tm,
|
|||
tm->validate_proc = proc;
|
||||
}
|
||||
|
||||
|
||||
Tile*
|
||||
tile_manager_get_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite)
|
||||
{
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return NULL;
|
||||
|
||||
return tile_manager_get (tm, tile_num, level, wantread, wantwrite);
|
||||
return tile_manager_get (tm, tile_num, wantread, wantwrite);
|
||||
}
|
||||
|
||||
Tile*
|
||||
tile_manager_get (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile **tiles;
|
||||
Tile **tile_ptr;
|
||||
int ntiles;
|
||||
|
@ -192,32 +115,28 @@ tile_manager_get (TileManager *tm,
|
|||
int bottom_tile;
|
||||
int i, j, k;
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
return NULL;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
ntiles = tile_level->ntile_rows * tile_level->ntile_cols;
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
return NULL;
|
||||
|
||||
if (!tile_level->tiles)
|
||||
if (!tm->tiles)
|
||||
{
|
||||
tile_level->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tile_level->tiles;
|
||||
tm->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tm->tiles;
|
||||
|
||||
nrows = tile_level->ntile_rows;
|
||||
ncols = tile_level->ntile_cols;
|
||||
nrows = tm->ntile_rows;
|
||||
ncols = tm->ntile_cols;
|
||||
|
||||
right_tile = tile_level->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tile_level->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
right_tile = tm->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tm->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
|
||||
for (i = 0, k = 0; i < nrows; i++)
|
||||
{
|
||||
for (j = 0; j < ncols; j++, k++)
|
||||
{
|
||||
tiles[k] = g_new (Tile, 1);
|
||||
tile_init (tiles[k], tile_level->bpp);
|
||||
tile_init (tiles[k], tm->bpp);
|
||||
tile_attach (tiles[k], tm, k);
|
||||
|
||||
if (j == (ncols - 1))
|
||||
|
@ -229,7 +148,7 @@ tile_manager_get (TileManager *tm,
|
|||
}
|
||||
}
|
||||
|
||||
tile_ptr = &tile_level->tiles[tile_num];
|
||||
tile_ptr = &tm->tiles[tile_num];
|
||||
|
||||
if (wantread)
|
||||
{
|
||||
|
@ -268,19 +187,16 @@ tile_manager_get (TileManager *tm,
|
|||
void
|
||||
tile_manager_get_async (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level)
|
||||
int ypixel)
|
||||
{
|
||||
Tile *tile_ptr;
|
||||
TileLevel *tile_level;
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
tile_ptr = tile_level->tiles[tile_num];
|
||||
tile_ptr = tm->tiles[tile_num];
|
||||
|
||||
tile_swap_in_async (tile_ptr);
|
||||
}
|
||||
|
@ -292,164 +208,40 @@ tile_manager_validate (TileManager *tm,
|
|||
tile->valid = TRUE;
|
||||
|
||||
if (tm->validate_proc)
|
||||
(* tm->validate_proc) (tm, tile, -1);
|
||||
(* tm->validate_proc) (tm, tile);
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_invalidate_tiles (TileManager *tm,
|
||||
Tile *toplevel_tile)
|
||||
{
|
||||
TileLevel *level;
|
||||
double x, y;
|
||||
int row, col;
|
||||
int num;
|
||||
int i;
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->levels[0].ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->levels[0].ntile_cols;
|
||||
col = toplevel_tile->tlink->tile_num % tm->ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->ntile_cols;
|
||||
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->levels[0].width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->levels[0].height;
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->height;
|
||||
|
||||
for (i = 1; i < tm->nlevels; i++)
|
||||
if (tm->tiles)
|
||||
{
|
||||
level = &tm->levels[i];
|
||||
if (level->tiles)
|
||||
{
|
||||
col = x * level->width / TILE_WIDTH;
|
||||
row = y * level->height / TILE_HEIGHT;
|
||||
num = row * level->ntile_cols + col;
|
||||
tile_invalidate (&level->tiles[num], tm, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_invalidate_sublevels (TileManager *tm)
|
||||
{
|
||||
int ntiles;
|
||||
int i, j;
|
||||
|
||||
for (i = 1; i < tm->nlevels; i++)
|
||||
{
|
||||
if (tm->levels[i].tiles)
|
||||
{
|
||||
ntiles = tm->levels[i].ntile_rows * tm->levels[i].ntile_cols;
|
||||
for (j = 0; j < ntiles; j++)
|
||||
tile_invalidate (&tm->levels[i].tiles[j], tm, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_update_tile (TileManager *tm,
|
||||
Tile *toplevel_tile,
|
||||
int level)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile *tile;
|
||||
guchar *src, *dest;
|
||||
double x, y;
|
||||
int srcx, srcy;
|
||||
int tilex, tiley;
|
||||
int tilew, tileh;
|
||||
int bpp;
|
||||
int row, col;
|
||||
int num;
|
||||
int i, j, k;
|
||||
|
||||
if ((level < 1) || (level >= tm->nlevels))
|
||||
return;
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->levels[0].ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->levels[0].ntile_cols;
|
||||
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->levels[0].width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->levels[0].height;
|
||||
|
||||
tilex = ((col * TILE_WIDTH) >> level) % 64;
|
||||
tiley = ((row * TILE_HEIGHT) >> level) % 64;
|
||||
|
||||
if (level > 6)
|
||||
{
|
||||
if (((col % (level - 6)) != 0) ||
|
||||
((row % (level - 6)) != 0))
|
||||
return;
|
||||
|
||||
tilew = 1;
|
||||
tileh = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tilew = (toplevel_tile->ewidth) >> level;
|
||||
tileh = (toplevel_tile->eheight) >> level;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
col = (x * tile_level->width) / TILE_WIDTH;
|
||||
row = (y * tile_level->height) / TILE_HEIGHT;
|
||||
num = row * tile_level->ntile_cols + col;
|
||||
|
||||
tile = tile_manager_get (tm, num, level, TRUE, TRUE);
|
||||
|
||||
tile_lock (toplevel_tile);
|
||||
|
||||
tilew += tilex;
|
||||
tileh += tiley;
|
||||
|
||||
bpp = tile->bpp;
|
||||
|
||||
for (i = tiley; i < tileh; i++)
|
||||
{
|
||||
srcx = tilex << level;
|
||||
srcy = tiley << level;
|
||||
|
||||
src = toplevel_tile->data + (srcy * toplevel_tile->ewidth + srcx) * bpp;
|
||||
dest = tile->data + (tiley * tile->ewidth + tilex) * bpp;
|
||||
|
||||
for (j = tilex; j < tilew; j++)
|
||||
{
|
||||
for (k = 0; k < bpp; k++)
|
||||
dest[k] = src[k];
|
||||
|
||||
dest += bpp;
|
||||
src += (bpp << level);
|
||||
}
|
||||
}
|
||||
|
||||
tile_release (tile, TRUE);
|
||||
tile_release (toplevel_tile, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tile_manager_destroy_level (TileManager *tm, TileLevel *level)
|
||||
{
|
||||
int ntiles;
|
||||
int i;
|
||||
|
||||
if (level->tiles)
|
||||
{
|
||||
ntiles = level->ntile_rows * level->ntile_cols;
|
||||
|
||||
for (i = 0; i < ntiles; i++)
|
||||
{
|
||||
TILE_MUTEX_LOCK (level->tiles[i]);
|
||||
tile_detach (level->tiles[i], tm, i);
|
||||
}
|
||||
|
||||
g_free (level->tiles);
|
||||
col = x * tm->width / TILE_WIDTH;
|
||||
row = y * tm->height / TILE_HEIGHT;
|
||||
num = row * tm->ntile_cols + col;
|
||||
tile_invalidate (&tm->tiles[num], tm, num);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
|
||||
int xpixel, int ypixel, int level)
|
||||
int xpixel, int ypixel)
|
||||
{
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0) return;
|
||||
|
||||
tile_invalidate (tile_ptr, tm, tile_num);
|
||||
|
@ -505,26 +297,14 @@ void
|
|||
tile_manager_map_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
Tile *srctile)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
int tile_row;
|
||||
int tile_col;
|
||||
int tile_num;
|
||||
|
||||
/* printf("#");fflush(stdout); */
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
{
|
||||
g_warning ("tile_manager_map_tile: level out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tile_level->width) ||
|
||||
(ypixel < 0) || (ypixel >= tile_level->height))
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
{
|
||||
g_warning ("tile_manager_map_tile: tile co-ord out of range.");
|
||||
return;
|
||||
|
@ -532,18 +312,16 @@ tile_manager_map_tile (TileManager *tm,
|
|||
|
||||
tile_row = ypixel / TILE_HEIGHT;
|
||||
tile_col = xpixel / TILE_WIDTH;
|
||||
tile_num = tile_row * tile_level->ntile_cols + tile_col;
|
||||
tile_num = tile_row * tm->ntile_cols + tile_col;
|
||||
|
||||
tile_manager_map (tm, tile_num, level, srctile);
|
||||
tile_manager_map (tm, tile_num, srctile);
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_map (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
Tile *srctile)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile **tiles;
|
||||
Tile **tile_ptr;
|
||||
int ntiles;
|
||||
|
@ -552,16 +330,7 @@ tile_manager_map (TileManager *tm,
|
|||
int bottom_tile;
|
||||
int i, j, k;
|
||||
|
||||
/* printf("@");fflush(stdout);*/
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
{
|
||||
g_warning ("tile_manager_map: level out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
ntiles = tile_level->ntile_rows * tile_level->ntile_cols;
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
{
|
||||
|
@ -569,18 +338,18 @@ tile_manager_map (TileManager *tm,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!tile_level->tiles)
|
||||
if (!tm->tiles)
|
||||
{
|
||||
/* g_warning ("tile_manager_map: empty tile level - init'ing.");*/
|
||||
|
||||
tile_level->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tile_level->tiles;
|
||||
tm->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tm->tiles;
|
||||
|
||||
nrows = tile_level->ntile_rows;
|
||||
ncols = tile_level->ntile_cols;
|
||||
nrows = tm->ntile_rows;
|
||||
ncols = tm->ntile_cols;
|
||||
|
||||
right_tile = tile_level->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tile_level->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
right_tile = tm->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tm->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
|
||||
for (i = 0, k = 0; i < nrows; i++)
|
||||
{
|
||||
|
@ -589,7 +358,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* printf(",");fflush(stdout);*/
|
||||
|
||||
tiles[k] = g_new (Tile, 1);
|
||||
tile_init (tiles[k], tile_level->bpp);
|
||||
tile_init (tiles[k], tm->bpp);
|
||||
tile_attach (tiles[k], tm, k);
|
||||
|
||||
if (j == (ncols - 1))
|
||||
|
@ -603,7 +372,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* g_warning ("tile_manager_map: empty tile level - done.");*/
|
||||
}
|
||||
|
||||
tile_ptr = &tile_level->tiles[tile_num];
|
||||
tile_ptr = &tm->tiles[tile_num];
|
||||
|
||||
/* printf(")");fflush(stdout);*/
|
||||
|
||||
|
@ -632,25 +401,19 @@ tile_manager_map (TileManager *tm,
|
|||
static int
|
||||
tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level)
|
||||
int ypixel)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
int tile_row;
|
||||
int tile_col;
|
||||
int tile_num;
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
return -1;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
if ((xpixel < 0) || (xpixel >= tile_level->width) ||
|
||||
(ypixel < 0) || (ypixel >= tile_level->height))
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
return -1;
|
||||
|
||||
tile_row = ypixel / TILE_HEIGHT;
|
||||
tile_col = xpixel / TILE_WIDTH;
|
||||
tile_num = tile_row * tile_level->ntile_cols + tile_col;
|
||||
tile_num = tile_row * tm->ntile_cols + tile_col;
|
||||
|
||||
return tile_num;
|
||||
}
|
||||
|
@ -669,21 +432,21 @@ tile_manager_get_user_data (TileManager *tm)
|
|||
}
|
||||
|
||||
int
|
||||
tile_manager_level_width (TileManager *tm, int level)
|
||||
tile_manager_level_width (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].width;
|
||||
return tm->width;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_height (TileManager *tm, int level)
|
||||
tile_manager_level_height (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].height;
|
||||
return tm->height;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_bpp (TileManager *tm, int level)
|
||||
tile_manager_level_bpp (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].bpp;
|
||||
return tm->bpp;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -702,8 +465,28 @@ tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile, int *x, int *y)
|
|||
return;
|
||||
}
|
||||
|
||||
*x = TILE_WIDTH * (tl->tile_num % tm->levels[0].ntile_cols);
|
||||
*y = TILE_HEIGHT * (tl->tile_num / tm->levels[0].ntile_cols);
|
||||
*x = TILE_WIDTH * (tl->tile_num % tm->ntile_cols);
|
||||
*y = TILE_HEIGHT * (tl->tile_num / tm->ntile_cols);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile)
|
||||
{
|
||||
TileLink *tl;
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
}
|
||||
|
||||
if (tl == NULL)
|
||||
{
|
||||
g_warning ("tile_manager_map_over_tile: tile not attached to manager");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_manager_map (tm, tl->tile_num, srctile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,10 @@
|
|||
#include "tile.h"
|
||||
|
||||
|
||||
typedef struct _TileLevel TileLevel;
|
||||
typedef struct _TileManager TileManager;
|
||||
|
||||
typedef void (*TileValidateProc) (TileManager *tm,
|
||||
Tile *tile,
|
||||
int level);
|
||||
Tile *tile);
|
||||
|
||||
|
||||
/* Creates a new tile manager with the specified
|
||||
|
@ -47,23 +45,6 @@ TileManager* tile_manager_new (int toplevel_width,
|
|||
*/
|
||||
void tile_manager_destroy (TileManager *tm);
|
||||
|
||||
/* Calculate the number of levels necessary to have a complete
|
||||
* hierarchy. This procedure is normally called twice with
|
||||
* the width and then height and the maximum value returned
|
||||
* is then used as the number of levels an image needs.
|
||||
*/
|
||||
int tile_manager_calc_levels (int size,
|
||||
int tile_size);
|
||||
|
||||
/* Set the number of levels this tile manager is managing.
|
||||
* This procedure may destroy unnecessary levels in the
|
||||
* tile manager if the new number of levels is less than
|
||||
* the old number of levels.
|
||||
* Any newly added levels will consist of invalid tiles.
|
||||
*/
|
||||
void tile_manager_set_nlevels (TileManager *tm,
|
||||
int nlevels);
|
||||
|
||||
/* Set the validate procedure for the tile manager.
|
||||
* The validate procedure is called when an invalid tile
|
||||
* is referenced. If the procedure is NULL, then the tile
|
||||
|
@ -73,15 +54,11 @@ void tile_manager_set_nlevels (TileManager *tm,
|
|||
void tile_manager_set_validate_proc (TileManager *tm,
|
||||
TileValidateProc proc);
|
||||
|
||||
/* Get a specified tile from a tile manager. The tile
|
||||
* is from the given level and contains the specified
|
||||
* pixel. Be aware that the pixel coordinates are
|
||||
* dependent on the level.
|
||||
/* Get a specified tile from a tile manager.
|
||||
*/
|
||||
Tile* tile_manager_get_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite);
|
||||
|
||||
|
@ -89,29 +66,25 @@ Tile* tile_manager_get_tile (TileManager *tm,
|
|||
*/
|
||||
Tile* tile_manager_get (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite);
|
||||
|
||||
/* Request that (if possible) the tile at x,y,layer be swapped
|
||||
/* Request that (if possible) the tile at x,y be swapped
|
||||
* in. This is only a hint to improve performance; no guarantees.
|
||||
* The tile may be swapped in or otherwise made more accessible
|
||||
* if it is convenient...
|
||||
*/
|
||||
void tile_manager_get_async (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level);
|
||||
int ypixel);
|
||||
|
||||
void tile_manager_map_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
Tile *srctile);
|
||||
|
||||
void tile_manager_map (TileManager *tm,
|
||||
int time_num,
|
||||
int level,
|
||||
Tile *srctile);
|
||||
|
||||
/* Validate a tiles memory.
|
||||
|
@ -121,37 +94,27 @@ void tile_manager_validate (TileManager *tm,
|
|||
|
||||
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);
|
||||
int xpixel, int ypixel);
|
||||
|
||||
/* Given a toplevel tile, this procedure will invalidate
|
||||
* (set the dirty bit) for all tiles in lower levels which
|
||||
* contain this toplevel tile.
|
||||
* Note: if a level hasn't been created then the tile for that
|
||||
* level won't be invalidated.
|
||||
* (set the dirty bit) for this toplevel tile.
|
||||
*/
|
||||
void tile_manager_invalidate_tiles (TileManager *tm,
|
||||
Tile *toplevel_tile);
|
||||
|
||||
/* Invalidates all the tiles in the sublevels.
|
||||
*/
|
||||
void tile_manager_invalidate_sublevels (TileManager *tm);
|
||||
|
||||
/* Update a portion lower level tile given a toplevel tile.
|
||||
*/
|
||||
void tile_manager_update_tile (TileManager *tm,
|
||||
Tile *toplevel_tile,
|
||||
int level);
|
||||
|
||||
void tile_manager_set_user_data (TileManager *tm,
|
||||
void *user_data);
|
||||
|
||||
void *tile_manager_get_user_data (TileManager *tm);
|
||||
|
||||
int tile_manager_level_width (TileManager *tm, int level);
|
||||
int tile_manager_level_height (TileManager *tm, int level);
|
||||
int tile_manager_level_bpp (TileManager *tm, int level);
|
||||
int tile_manager_level_width (TileManager *tm);
|
||||
int tile_manager_level_height (TileManager *tm);
|
||||
int tile_manager_level_bpp (TileManager *tm);
|
||||
|
||||
void tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile,
|
||||
int *x, int *y);
|
||||
|
||||
void tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile);
|
||||
|
||||
|
||||
#endif /* __TILE_MANAGER_H__ */
|
||||
|
|
|
@ -1033,7 +1033,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
@ -1051,7 +1051,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -1070,7 +1070,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
value = cos (0.5 * M_PI * value);
|
||||
tile_release (tile, FALSE);
|
||||
|
|
|
@ -125,7 +125,7 @@ find_empty_segs (PixelRegion *maskPR,
|
|||
{
|
||||
if (tile)
|
||||
tile_release (tile, FALSE);
|
||||
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, TRUE, FALSE);
|
||||
data = tile_data_pointer (tile, x % TILE_WIDTH, scanline % TILE_HEIGHT) + (tile_bpp(tile) - 1);
|
||||
|
||||
tilex = x / TILE_WIDTH;
|
||||
|
|
|
@ -360,7 +360,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);
|
||||
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -369,7 +369,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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -931,7 +931,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = bcd->gimage->height * bevent->y / bcd->preview->requisition.height;
|
||||
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);
|
||||
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
else
|
||||
|
@ -943,7 +943,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = drawable_height (drawable) * bevent->y / bcd->preview->requisition.height - offy;
|
||||
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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int channel_get_count = 0;
|
|||
/* Function definitions */
|
||||
|
||||
static void
|
||||
channel_validate (TileManager *tm, Tile *tile, int level)
|
||||
channel_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
/* Set the contents of the tile to empty */
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
@ -549,7 +549,7 @@ channel_value (Channel *mask, int x, int y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
|
|
@ -327,7 +327,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);
|
||||
tile = tile_manager_get_tile (tiles, x, y, TRUE, FALSE);
|
||||
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2471,7 +2471,7 @@ median_cut_pass2_fs_dither_gray (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -2627,7 +2627,7 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -81,12 +81,12 @@ crop_buffer (TileManager *tiles,
|
|||
void * pr;
|
||||
unsigned char black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->levels[0].bpp;
|
||||
bytes = tiles->bpp;
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->levels[0].width;
|
||||
y1 = tiles->levels[0].height;
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
|
@ -119,17 +119,17 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->levels[0].width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->levels[0].height);
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->height);
|
||||
|
||||
empty = (x1 == tiles->levels[0].width && y1 == tiles->levels[0].height);
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->levels[0].width &&
|
||||
y2 == tiles->levels[0].height && border == 0)
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
|
@ -657,9 +657,9 @@ new_named_buffer (TileManager *tiles,
|
|||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
nb->buf = tile_manager_new (tiles->levels[0].width, tiles->levels[0].height, tiles->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->levels[0].width, tiles->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->levels[0].width, tiles->levels[0].height, TRUE);
|
||||
nb->buf = tile_manager_new (tiles->width, tiles->height, tiles->bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->width, tiles->height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->width, tiles->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
|
|
|
@ -108,7 +108,7 @@ int channel_get_count = 0;
|
|||
/* Function definitions */
|
||||
|
||||
static void
|
||||
channel_validate (TileManager *tm, Tile *tile, int level)
|
||||
channel_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
/* Set the contents of the tile to empty */
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
@ -549,7 +549,7 @@ channel_value (Channel *mask, int x, int y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int channel_get_count = 0;
|
|||
/* Function definitions */
|
||||
|
||||
static void
|
||||
channel_validate (TileManager *tm, Tile *tile, int level)
|
||||
channel_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
/* Set the contents of the tile to empty */
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
@ -549,7 +549,7 @@ channel_value (Channel *mask, int x, int y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
|
|
@ -1033,7 +1033,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
@ -1051,7 +1051,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -1070,7 +1070,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
value = cos (0.5 * M_PI * value);
|
||||
tile_release (tile, FALSE);
|
||||
|
|
|
@ -81,12 +81,12 @@ crop_buffer (TileManager *tiles,
|
|||
void * pr;
|
||||
unsigned char black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->levels[0].bpp;
|
||||
bytes = tiles->bpp;
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->levels[0].width;
|
||||
y1 = tiles->levels[0].height;
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
|
@ -119,17 +119,17 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->levels[0].width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->levels[0].height);
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->height);
|
||||
|
||||
empty = (x1 == tiles->levels[0].width && y1 == tiles->levels[0].height);
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->levels[0].width &&
|
||||
y2 == tiles->levels[0].height && border == 0)
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
|
@ -657,9 +657,9 @@ new_named_buffer (TileManager *tiles,
|
|||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
nb->buf = tile_manager_new (tiles->levels[0].width, tiles->levels[0].height, tiles->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->levels[0].width, tiles->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->levels[0].width, tiles->levels[0].height, TRUE);
|
||||
nb->buf = tile_manager_new (tiles->width, tiles->height, tiles->bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->width, tiles->height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->width, tiles->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
|
|
|
@ -2471,7 +2471,7 @@ median_cut_pass2_fs_dither_gray (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -2627,7 +2627,7 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ gimage_mask_extract (gimage, drawable, cut_gimage, keep_indexed)
|
|||
|
||||
/* Update the region */
|
||||
gdisplays_update_area (gimage, tiles->x, tiles->y,
|
||||
tiles->levels[0].width, tiles->levels[0].height);
|
||||
tiles->width, tiles->height);
|
||||
|
||||
/* Invalidate the preview */
|
||||
drawable_invalidate_preview (drawable);
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -534,8 +534,8 @@ undo_push_image_mod (GImage *gimage,
|
|||
y2 = BOUNDS (y2, 0, dheight);
|
||||
|
||||
tiles = (TileManager *) tiles_ptr;
|
||||
size = tiles->levels[0].width * tiles->levels[0].height *
|
||||
tiles->levels[0].bpp + sizeof (void *) * 2;
|
||||
size = tiles->width * tiles->height *
|
||||
tiles->bpp + sizeof (void *) * 2;
|
||||
|
||||
if ((new = undo_push (gimage, size, IMAGE_MOD_UNDO)))
|
||||
{
|
||||
|
@ -595,8 +595,8 @@ undo_pop_image (GImage *gimage,
|
|||
|
||||
if (image_undo->sparse == FALSE)
|
||||
{
|
||||
w = tiles->levels[0].width;
|
||||
h = tiles->levels[0].height;
|
||||
w = tiles->width;
|
||||
h = tiles->height;
|
||||
|
||||
pixel_region_init (&PR1, tiles, 0, 0, w, h, TRUE);
|
||||
pixel_region_init (&PR2, drawable_data (image_undo->drawable), x, y, w, h, TRUE);
|
||||
|
@ -617,16 +617,16 @@ 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);
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (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 */);
|
||||
src_tile = tile_manager_get_tile (tiles, j, i, TRUE, FALSE /* TRUE */);
|
||||
dest_tile = tile_manager_get_tile (drawable_data (image_undo->drawable), j, i, 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);
|
||||
tile_manager_map_tile (tiles, j, i, dest_tile);
|
||||
tile_manager_map_tile (drawable_data (image_undo->drawable), j, i, src_tile);
|
||||
#if 0
|
||||
swap_pixels (tile_data_pointer (src_tile, 0, 0),
|
||||
tile_data_pointer (dest_tile, 0, 0),
|
||||
|
@ -672,7 +672,7 @@ undo_push_mask (GImage *gimage,
|
|||
|
||||
mask_undo = (MaskUndo *) mask_ptr;
|
||||
if (mask_undo->tiles)
|
||||
size = mask_undo->tiles->levels[0].width * mask_undo->tiles->levels[0].height;
|
||||
size = mask_undo->tiles->width * mask_undo->tiles->height;
|
||||
else
|
||||
size = 0;
|
||||
|
||||
|
@ -733,8 +733,8 @@ undo_pop_mask (GImage *gimage,
|
|||
|
||||
if (mask_undo->tiles)
|
||||
{
|
||||
width = mask_undo->tiles->levels[0].width;
|
||||
height = mask_undo->tiles->levels[0].height;
|
||||
width = mask_undo->tiles->width;
|
||||
height = mask_undo->tiles->height;
|
||||
pixel_region_init (&srcPR, mask_undo->tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, GIMP_DRAWABLE(sel_mask)->tiles, mask_undo->x, mask_undo->y, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
@ -1271,9 +1271,9 @@ undo_pop_layer_mod (GImage *gimage,
|
|||
GIMP_DRAWABLE(layer)->tiles = tiles;
|
||||
GIMP_DRAWABLE(layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE(layer)->offset_y = tiles->y;
|
||||
GIMP_DRAWABLE(layer)->width = tiles->levels[0].width;
|
||||
GIMP_DRAWABLE(layer)->height = tiles->levels[0].height;
|
||||
GIMP_DRAWABLE(layer)->bytes = tiles->levels[0].bpp;
|
||||
GIMP_DRAWABLE(layer)->width = tiles->width;
|
||||
GIMP_DRAWABLE(layer)->height = tiles->height;
|
||||
GIMP_DRAWABLE(layer)->bytes = tiles->bpp;
|
||||
GIMP_DRAWABLE(layer)->type = layer_type;
|
||||
GIMP_DRAWABLE(layer)->has_alpha = TYPE_HAS_ALPHA (layer_type);
|
||||
|
||||
|
@ -1618,8 +1618,8 @@ undo_pop_channel_mod (GImage *gimage,
|
|||
|
||||
temp = GIMP_DRAWABLE(channel)->tiles;
|
||||
GIMP_DRAWABLE(channel)->tiles = tiles;
|
||||
GIMP_DRAWABLE(channel)->width = tiles->levels[0].width;
|
||||
GIMP_DRAWABLE(channel)->height = tiles->levels[0].height;
|
||||
GIMP_DRAWABLE(channel)->width = tiles->width;
|
||||
GIMP_DRAWABLE(channel)->height = tiles->height;
|
||||
|
||||
/* Set the new buffer */
|
||||
data[1] = temp;
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -146,21 +146,21 @@ image_map_apply (ImageMap image_map,
|
|||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->x != x1 ||
|
||||
_image_map->undo_tiles->y != y1 ||
|
||||
_image_map->undo_tiles->levels[0].width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->levels[0].height != (y2 - y1))
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
{
|
||||
/* If undo tiles exist, copy them to the drawable*/
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&_image_map->destPR, drawable_data ( (_image_map->drawable)),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
|
||||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
|
@ -168,8 +168,8 @@ image_map_apply (ImageMap image_map,
|
|||
|
||||
/* If either the extents changed or the tiles don't exist, allocate new */
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->levels[0].width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->levels[0].height != (y2 - y1))
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
{
|
||||
/* Destroy old tiles--If they exist */
|
||||
if (_image_map->undo_tiles != NULL)
|
||||
|
@ -234,8 +234,8 @@ image_map_commit (ImageMap image_map)
|
|||
{
|
||||
x1 = _image_map->undo_tiles->x;
|
||||
y1 = _image_map->undo_tiles->y;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->levels[0].width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->levels[0].height;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->height;
|
||||
drawable_apply_image ( (_image_map->drawable), x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
||||
|
@ -266,13 +266,13 @@ image_map_abort (ImageMap image_map)
|
|||
{
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&destPR, drawable_data ( (_image_map->drawable)),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
|
||||
/* if the user has changed the image depth get out quickly */
|
||||
|
@ -289,8 +289,8 @@ image_map_abort (ImageMap image_map)
|
|||
/* Update the area */
|
||||
drawable_update ( (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height);
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height);
|
||||
|
||||
/* Free the undo_tiles tile manager */
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
|
|
|
@ -226,9 +226,9 @@ floating_sel_store (Layer *layer,
|
|||
int x1, y1, x2, y2;
|
||||
|
||||
/* Check the backing store & make sure it has the correct dimensions */
|
||||
if (layer->fs.backing_store->levels[0].width != drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->levels[0].height != drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->levels[0].bpp != drawable_bytes (layer->fs.drawable))
|
||||
if (layer->fs.backing_store->width != drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->height != drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->bpp != drawable_bytes (layer->fs.drawable))
|
||||
{
|
||||
/* free the backing store and allocate anew */
|
||||
tile_manager_destroy (layer->fs.backing_store);
|
||||
|
|
|
@ -392,7 +392,7 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
layer_type = drawable_type_with_alpha ( (drawable));
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->levels[0].width, tiles->levels[0].height,
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer) {
|
||||
|
@ -404,14 +404,14 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
pixel_region_init (&layerPR, GIMP_DRAWABLE(new_layer)->tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, TRUE);
|
||||
pixel_region_init (&bufPR, tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, FALSE);
|
||||
|
||||
if ((tiles->levels[0].bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->levels[0].bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
if ((tiles->bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
/* If we want a layer the same type as the buffer */
|
||||
copy_region (&bufPR, &layerPR);
|
||||
else
|
||||
/* Transform the contents of the buf to the new_layer */
|
||||
transform_color (gimage, &layerPR, &bufPR, GIMP_DRAWABLE(new_layer),
|
||||
(tiles->levels[0].bpp == 4) ? RGB : GRAY);
|
||||
(tiles->bpp == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ layer_pick_correlate (layer, x, y)
|
|||
/* Otherwise, determine if the alpha value at
|
||||
* the given point is non-zero
|
||||
*/
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, TRUE, FALSE);
|
||||
|
||||
val = * (unsigned char*) (tile_data_pointer (tile,
|
||||
x % TILE_WIDTH,
|
||||
|
@ -949,7 +949,7 @@ layer_pick_correlate (layer, x, y)
|
|||
if (layer->mask)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, TRUE, FALSE);
|
||||
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
val = val * (*ptr) / 255;
|
||||
tile_release (mask_tile, FALSE);
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -463,8 +463,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if(global_buf && !last_new_image)
|
||||
{
|
||||
vals->width = global_buf->levels[0].width;
|
||||
vals->height = global_buf->levels[0].height;
|
||||
vals->width = global_buf->width;
|
||||
vals->height = global_buf->height;
|
||||
}
|
||||
|
||||
vals->dlg = gtk_dialog_new ();
|
||||
|
|
|
@ -2434,7 +2434,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -2463,7 +2463,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
|
@ -2434,7 +2434,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -2463,7 +2463,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
|
@ -1265,7 +1265,7 @@ drawable_set_pixel_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
{
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, TRUE);
|
||||
|
||||
x %= TILE_WIDTH;
|
||||
y %= TILE_HEIGHT;
|
||||
|
@ -1369,7 +1369,7 @@ drawable_get_pixel_invoker (Argument *args)
|
|||
if (success)
|
||||
{
|
||||
pixel = (unsigned char *) g_new (unsigned char, num_channels);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
|
||||
x %= TILE_WIDTH;
|
||||
y %= TILE_HEIGHT;
|
||||
|
|
|
@ -463,8 +463,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if(global_buf && !last_new_image)
|
||||
{
|
||||
vals->width = global_buf->levels[0].width;
|
||||
vals->height = global_buf->levels[0].height;
|
||||
vals->width = global_buf->width;
|
||||
vals->height = global_buf->height;
|
||||
}
|
||||
|
||||
vals->dlg = gtk_dialog_new ();
|
||||
|
|
|
@ -248,9 +248,9 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -258,14 +258,14 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].width; i++)
|
||||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->levels[0].width - i - 1), 0, 1, orig->levels[0].height, TRUE);
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
@ -289,9 +289,9 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -299,14 +299,14 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].height; i++)
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->levels[0].width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->levels[0].height - i - 1), orig->levels[0].width, 1, TRUE);
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
|
|
@ -226,9 +226,9 @@ floating_sel_store (Layer *layer,
|
|||
int x1, y1, x2, y2;
|
||||
|
||||
/* Check the backing store & make sure it has the correct dimensions */
|
||||
if (layer->fs.backing_store->levels[0].width != drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->levels[0].height != drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->levels[0].bpp != drawable_bytes (layer->fs.drawable))
|
||||
if (layer->fs.backing_store->width != drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->height != drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->bpp != drawable_bytes (layer->fs.drawable))
|
||||
{
|
||||
/* free the backing store and allocate anew */
|
||||
tile_manager_destroy (layer->fs.backing_store);
|
||||
|
|
|
@ -128,8 +128,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
|
|||
if (*m_tile != NULL)
|
||||
tile_release (*m_tile, TRUE);
|
||||
|
||||
*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_tile = tile_manager_get_tile (src, x, y, TRUE, FALSE);
|
||||
*m_tile = tile_manager_get_tile (mask, x, y, TRUE, TRUE);
|
||||
|
||||
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
|
@ -214,7 +214,7 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
|
|||
if (x < 0 || x >= src->w) return;
|
||||
if (y < 0 || y >= src->h) return;
|
||||
|
||||
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (mask->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile,
|
||||
x%TILE_WIDTH, y%TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
@ -281,7 +281,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
|
|||
mask = channel_new_mask (gimage, srcPR.w, srcPR.h);
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
|
||||
|
||||
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (srcPR.tiles, x, y, TRUE, FALSE);
|
||||
if (tile)
|
||||
{
|
||||
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
|
||||
|
|
|
@ -274,7 +274,7 @@ gimage_mask_extract (gimage, drawable, cut_gimage, keep_indexed)
|
|||
|
||||
/* Update the region */
|
||||
gdisplays_update_area (gimage, tiles->x, tiles->y,
|
||||
tiles->levels[0].width, tiles->levels[0].height);
|
||||
tiles->width, tiles->height);
|
||||
|
||||
/* Invalidate the preview */
|
||||
drawable_invalidate_preview (drawable);
|
||||
|
|
|
@ -108,7 +108,7 @@ int channel_get_count = 0;
|
|||
/* Function definitions */
|
||||
|
||||
static void
|
||||
channel_validate (TileManager *tm, Tile *tile, int level)
|
||||
channel_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
/* Set the contents of the tile to empty */
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
|
@ -549,7 +549,7 @@ channel_value (Channel *mask, int x, int y)
|
|||
return 0;
|
||||
}
|
||||
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(mask)->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
|
|
@ -2471,7 +2471,7 @@ median_cut_pass2_fs_dither_gray (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -2627,7 +2627,7 @@ median_cut_pass2_fs_dither_rgb (QuantizeObj *quantobj,
|
|||
pixel_region_init (&srcPR, GIMP_DRAWABLE(layer)->tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height, TRUE);
|
||||
src_bytes = GIMP_DRAWABLE(layer)->bytes;
|
||||
dest_bytes = new_tiles->levels[0].bpp;
|
||||
dest_bytes = new_tiles->bpp;
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -411,9 +411,9 @@ TileManager *
|
|||
gimp_image_shadow (GimpImage *gimage, int width, int height, int bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow, 0)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow, 0)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow, 0))))
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -1226,7 +1226,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, 0, FALSE, FALSE);
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* invalidate all lower level tiles */
|
||||
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
|
||||
|
@ -1236,7 +1236,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (j < x1)
|
||||
startx = MAX (startx, (j + tile_ewidth(tile)));
|
||||
else
|
||||
|
@ -1244,7 +1244,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i, 0);
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
if (i < y1)
|
||||
starty = MAX (starty, (i + tile_eheight(tile)));
|
||||
else
|
||||
|
@ -1276,7 +1276,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_validate (TileManager *tm, Tile *tile, int level)
|
||||
gimp_image_validate (TileManager *tm, Tile *tile)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
int x, y;
|
||||
|
@ -2575,8 +2575,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((tile_manager_level_width (gimage->projection, 0) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection, 0) != gimage->height))
|
||||
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
gimp_image_allocate_projection (gimage);
|
||||
|
||||
return gimage->projection;
|
||||
|
|
|
@ -157,7 +157,7 @@ Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
|||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
void gimp_image_inflate (GimpImage *);
|
||||
void gimp_image_deflate (GimpImage *);
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
layer_type = drawable_type_with_alpha ( (drawable));
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->levels[0].width, tiles->levels[0].height,
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer) {
|
||||
|
@ -404,14 +404,14 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
pixel_region_init (&layerPR, GIMP_DRAWABLE(new_layer)->tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, TRUE);
|
||||
pixel_region_init (&bufPR, tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, FALSE);
|
||||
|
||||
if ((tiles->levels[0].bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->levels[0].bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
if ((tiles->bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
/* If we want a layer the same type as the buffer */
|
||||
copy_region (&bufPR, &layerPR);
|
||||
else
|
||||
/* Transform the contents of the buf to the new_layer */
|
||||
transform_color (gimage, &layerPR, &bufPR, GIMP_DRAWABLE(new_layer),
|
||||
(tiles->levels[0].bpp == 4) ? RGB : GRAY);
|
||||
(tiles->bpp == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ layer_pick_correlate (layer, x, y)
|
|||
/* Otherwise, determine if the alpha value at
|
||||
* the given point is non-zero
|
||||
*/
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, TRUE, FALSE);
|
||||
|
||||
val = * (unsigned char*) (tile_data_pointer (tile,
|
||||
x % TILE_WIDTH,
|
||||
|
@ -949,7 +949,7 @@ layer_pick_correlate (layer, x, y)
|
|||
if (layer->mask)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, TRUE, FALSE);
|
||||
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
val = val * (*ptr) / 255;
|
||||
tile_release (mask_tile, FALSE);
|
||||
|
|
|
@ -81,12 +81,12 @@ crop_buffer (TileManager *tiles,
|
|||
void * pr;
|
||||
unsigned char black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->levels[0].bpp;
|
||||
bytes = tiles->bpp;
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->levels[0].width;
|
||||
y1 = tiles->levels[0].height;
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
|
@ -119,17 +119,17 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->levels[0].width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->levels[0].height);
|
||||
x2 = BOUNDS (x2 + 1, 0, tiles->width);
|
||||
y2 = BOUNDS (y2 + 1, 0, tiles->height);
|
||||
|
||||
empty = (x1 == tiles->levels[0].width && y1 == tiles->levels[0].height);
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->levels[0].width &&
|
||||
y2 == tiles->levels[0].height && border == 0)
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
|
@ -657,9 +657,9 @@ new_named_buffer (TileManager *tiles,
|
|||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
nb->buf = tile_manager_new (tiles->levels[0].width, tiles->levels[0].height, tiles->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->levels[0].width, tiles->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->levels[0].width, tiles->levels[0].height, TRUE);
|
||||
nb->buf = tile_manager_new (tiles->width, tiles->height, tiles->bpp);
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, tiles->width, tiles->height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, tiles->width, tiles->height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
|
|
|
@ -463,8 +463,8 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if(global_buf && !last_new_image)
|
||||
{
|
||||
vals->width = global_buf->levels[0].width;
|
||||
vals->height = global_buf->levels[0].height;
|
||||
vals->width = global_buf->width;
|
||||
vals->height = global_buf->height;
|
||||
}
|
||||
|
||||
vals->dlg = gtk_dialog_new ();
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -146,21 +146,21 @@ image_map_apply (ImageMap image_map,
|
|||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->x != x1 ||
|
||||
_image_map->undo_tiles->y != y1 ||
|
||||
_image_map->undo_tiles->levels[0].width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->levels[0].height != (y2 - y1))
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
{
|
||||
/* If undo tiles exist, copy them to the drawable*/
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&_image_map->destPR, drawable_data ( (_image_map->drawable)),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
|
||||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
|
@ -168,8 +168,8 @@ image_map_apply (ImageMap image_map,
|
|||
|
||||
/* If either the extents changed or the tiles don't exist, allocate new */
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->levels[0].width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->levels[0].height != (y2 - y1))
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
{
|
||||
/* Destroy old tiles--If they exist */
|
||||
if (_image_map->undo_tiles != NULL)
|
||||
|
@ -234,8 +234,8 @@ image_map_commit (ImageMap image_map)
|
|||
{
|
||||
x1 = _image_map->undo_tiles->x;
|
||||
y1 = _image_map->undo_tiles->y;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->levels[0].width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->levels[0].height;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->height;
|
||||
drawable_apply_image ( (_image_map->drawable), x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
||||
|
@ -266,13 +266,13 @@ image_map_abort (ImageMap image_map)
|
|||
{
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&destPR, drawable_data ( (_image_map->drawable)),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
|
||||
/* if the user has changed the image depth get out quickly */
|
||||
|
@ -289,8 +289,8 @@ image_map_abort (ImageMap image_map)
|
|||
/* Update the area */
|
||||
drawable_update ( (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->levels[0].width,
|
||||
_image_map->undo_tiles->levels[0].height);
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height);
|
||||
|
||||
/* Free the undo_tiles tile manager */
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
|
|
|
@ -2434,7 +2434,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -2463,7 +2463,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
10
app/ink.c
10
app/ink.c
|
@ -979,11 +979,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);
|
||||
dest_tile = tile_manager_get_tile (undo_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, src_tile);
|
||||
tile_release (src_tile, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1003,10 +1003,10 @@ 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);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, TRUE, TRUE);
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
0,
|
||||
tile_size (tile));
|
||||
|
|
12
app/layer.c
12
app/layer.c
|
@ -392,7 +392,7 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
layer_type = drawable_type_with_alpha ( (drawable));
|
||||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0, tiles->levels[0].width, tiles->levels[0].height,
|
||||
new_layer = layer_new (0, tiles->width, tiles->height,
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer) {
|
||||
|
@ -404,14 +404,14 @@ layer_from_tiles (gimage_ptr, drawable, tiles, name, opacity, mode)
|
|||
pixel_region_init (&layerPR, GIMP_DRAWABLE(new_layer)->tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, TRUE);
|
||||
pixel_region_init (&bufPR, tiles, 0, 0, GIMP_DRAWABLE(new_layer)->width, GIMP_DRAWABLE(new_layer)->height, FALSE);
|
||||
|
||||
if ((tiles->levels[0].bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->levels[0].bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
if ((tiles->bpp == 4 && GIMP_DRAWABLE(new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tiles->bpp == 2 && GIMP_DRAWABLE(new_layer)->type == GRAYA_GIMAGE))
|
||||
/* If we want a layer the same type as the buffer */
|
||||
copy_region (&bufPR, &layerPR);
|
||||
else
|
||||
/* Transform the contents of the buf to the new_layer */
|
||||
transform_color (gimage, &layerPR, &bufPR, GIMP_DRAWABLE(new_layer),
|
||||
(tiles->levels[0].bpp == 4) ? RGB : GRAY);
|
||||
(tiles->bpp == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ layer_pick_correlate (layer, x, y)
|
|||
/* Otherwise, determine if the alpha value at
|
||||
* the given point is non-zero
|
||||
*/
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (GIMP_DRAWABLE(layer)->tiles, x, y, TRUE, FALSE);
|
||||
|
||||
val = * (unsigned char*) (tile_data_pointer (tile,
|
||||
x % TILE_WIDTH,
|
||||
|
@ -949,7 +949,7 @@ layer_pick_correlate (layer, x, y)
|
|||
if (layer->mask)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, 0, TRUE, FALSE);
|
||||
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE(layer->mask)->tiles, x, y, TRUE, FALSE);
|
||||
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
val = val * (*ptr) / 255;
|
||||
tile_release (mask_tile, FALSE);
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "tile_manager_pvt.h" /* For copy-on-write */
|
||||
#include "tile.h" /* ick. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define STD_BUF_SIZE 1021
|
||||
#define MAXDIFF 195076
|
||||
#define HASH_TABLE_SIZE 1021
|
||||
|
@ -2587,113 +2589,41 @@ copy_region (PixelRegion *src,
|
|||
unsigned char * s, * d;
|
||||
void * pr;
|
||||
|
||||
/* g_print ("CR: %d,%d (%dx%d) -> %d,%d (%dx%d) :: [%d] [%d]\n",
|
||||
src->x,
|
||||
src->y,
|
||||
src->w,
|
||||
src->h,
|
||||
dest->x,
|
||||
dest->y,
|
||||
dest->w,
|
||||
dest->h,
|
||||
src->tiles->levels->width,
|
||||
dest->tiles->levels->width);fflush(stdout);*/
|
||||
|
||||
|
||||
/* If we're copying from the same offset in each drawable,
|
||||
* and the PixelRegions are the same size, and the drawables are
|
||||
* the same size, we can do a quick'n'cheap Copy-On-Write. Otherwise
|
||||
* we have to do the copy the old fashioned way.
|
||||
*
|
||||
* For COW the PixelRegions must also be of the same dimensions as the
|
||||
* tilemanager level, for reasons of simplicity. Future work
|
||||
* may remove this restriction.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
printf("SPR[ D%p T%p R%d O%d,%d S%d,%d B%d d%d P%d ]\n",
|
||||
src->data, src->tiles, src->rowstride, src->x,
|
||||
src->y, src->w, src->h, src->bytes, src->dirty,
|
||||
src->process_count);
|
||||
printf("DPR[ D%p T%p R%d O%d,%d S%d,%d B%d d%d P%d ]\n",
|
||||
dest->data, dest->tiles, dest->rowstride, dest->x,
|
||||
dest->y, dest->w, dest->h, dest->bytes, dest->dirty,
|
||||
dest->process_count);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if ((src->x == dest->x) &&
|
||||
(src->y == dest->y) &&
|
||||
(src->w == dest->w) &&
|
||||
(src->h == dest->h)
|
||||
&&
|
||||
(src->tiles) &&
|
||||
(dest->tiles)
|
||||
&&
|
||||
(src->tiles->levels) &&
|
||||
(dest->tiles->levels) &&
|
||||
(dest->tiles->levels->width == src->tiles->levels->width) &&
|
||||
(dest->tiles->levels->height == src->tiles->levels->height)
|
||||
&&
|
||||
(src->w == src->tiles->levels->width) &&
|
||||
(src->h == src->tiles->levels->height)
|
||||
)
|
||||
{
|
||||
Tile *src_tile;
|
||||
gint xstepper,ystepper;
|
||||
|
||||
#if defined (TILE_DEBUG)
|
||||
g_print ("CR: c.o.w. \n");
|
||||
#endif
|
||||
|
||||
/* c.o.w. */
|
||||
|
||||
for (ystepper = src->y;
|
||||
ystepper < (src->y + src->h);
|
||||
ystepper += TILE_HEIGHT)
|
||||
{
|
||||
for (xstepper = src->x;
|
||||
xstepper < (src->x + src->w);
|
||||
xstepper += TILE_WIDTH)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (src->tiles,
|
||||
xstepper, ystepper,
|
||||
0, TRUE, FALSE);
|
||||
|
||||
tile_manager_map_tile (dest->tiles,
|
||||
xstepper, ystepper, 0,
|
||||
src_tile);
|
||||
|
||||
tile_release (src_tile, FALSE);
|
||||
}
|
||||
}
|
||||
#if defined (TILE_DEBUG)
|
||||
g_print (src_tile ? "dest " : "src ");
|
||||
g_print ("CR: END c.o.w. \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* else 'The old-fashioned way.'
|
||||
*/
|
||||
|
||||
fputc('[',stderr);
|
||||
for (pr = pixel_regions_register (2, src, dest);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
pixelwidth = src->w * src->bytes;
|
||||
s = src->data;
|
||||
d = dest->data;
|
||||
h = src->h;
|
||||
|
||||
while (h --)
|
||||
if (src->tiles && dest->tiles &&
|
||||
src->curtile && dest->curtile &&
|
||||
src->offx == 0 && dest->offx == 0 &&
|
||||
src->offy == 0 && dest->offy == 0 &&
|
||||
src->w == tile_ewidth(src->curtile) &&
|
||||
dest->w == tile_ewidth(dest->curtile) &&
|
||||
src->h == tile_eheight(src->curtile) &&
|
||||
dest->h == tile_eheight(dest->curtile))
|
||||
{
|
||||
memcpy (d, s, pixelwidth);
|
||||
s += src->rowstride;
|
||||
d += dest->rowstride;
|
||||
fputc('!',stderr);
|
||||
tile_manager_map_over_tile (dest->tiles, dest->curtile, src->curtile);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputc('.',stderr);
|
||||
pixelwidth = src->w * src->bytes;
|
||||
s = src->data;
|
||||
d = dest->data;
|
||||
h = src->h;
|
||||
|
||||
while (h --)
|
||||
{
|
||||
memcpy (d, s, pixelwidth);
|
||||
s += src->rowstride;
|
||||
d += dest->rowstride;
|
||||
}
|
||||
}
|
||||
}
|
||||
fputc(']',stderr);
|
||||
fputc('\n',stderr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3706,7 +3636,7 @@ shapeburst_region (PixelRegion *srcPR,
|
|||
|
||||
while (y >= end)
|
||||
{
|
||||
tile = tile_manager_get_tile (srcPR->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (srcPR->tiles, x, y, TRUE, FALSE);
|
||||
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;
|
||||
|
|
|
@ -979,11 +979,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);
|
||||
dest_tile = tile_manager_get_tile (undo_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, src_tile);
|
||||
tile_release (src_tile, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1003,10 +1003,10 @@ 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);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, TRUE, TRUE);
|
||||
memset (tile_data_pointer (tile, 0, 0),
|
||||
0,
|
||||
tile_size (tile));
|
||||
|
|
|
@ -675,12 +675,12 @@ 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);
|
||||
FALSE, FALSE);
|
||||
if (tile_is_valid (undo_tile) == TRUE)
|
||||
{
|
||||
refd = 1;
|
||||
undo_tile = tile_manager_get_tile (undo_tiles, srcPR.x, srcPR.y,
|
||||
0, TRUE, FALSE);
|
||||
TRUE, FALSE);
|
||||
s = tile_data_pointer (undo_tile, 0, 0) +
|
||||
srcPR.rowstride * (srcPR.y % TILE_HEIGHT) +
|
||||
srcPR.bytes * (srcPR.x % TILE_WIDTH); /* dubious... */
|
||||
|
@ -1240,15 +1240,21 @@ set_undo_tiles (drawable, x, y, w, h)
|
|||
Tile *src_tile;
|
||||
Tile *dest_tile;
|
||||
|
||||
if (undo_tiles == NULL)
|
||||
{
|
||||
g_warning ("set_undo_tiles: undo_tiles is null");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
{
|
||||
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);
|
||||
dest_tile = tile_manager_get_tile (undo_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (dest_tile) == FALSE)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, 0, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, 0, src_tile);
|
||||
src_tile = tile_manager_get_tile (drawable_data (drawable), j, i, TRUE, FALSE);
|
||||
tile_manager_map_tile (undo_tiles, j, i, src_tile);
|
||||
tile_release (src_tile, FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -1267,10 +1273,10 @@ 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);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, FALSE, FALSE);
|
||||
if (tile_is_valid (tile) == FALSE)
|
||||
{
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get_tile (canvas_tiles, j, i, TRUE, TRUE);
|
||||
memset (tile_data_pointer (tile, 0, 0), 0,
|
||||
tile_size (tile));
|
||||
tile_release (tile, TRUE);
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "tile_manager_pvt.h" /* For copy-on-write */
|
||||
#include "tile.h" /* ick. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define STD_BUF_SIZE 1021
|
||||
#define MAXDIFF 195076
|
||||
#define HASH_TABLE_SIZE 1021
|
||||
|
@ -2587,113 +2589,41 @@ copy_region (PixelRegion *src,
|
|||
unsigned char * s, * d;
|
||||
void * pr;
|
||||
|
||||
/* g_print ("CR: %d,%d (%dx%d) -> %d,%d (%dx%d) :: [%d] [%d]\n",
|
||||
src->x,
|
||||
src->y,
|
||||
src->w,
|
||||
src->h,
|
||||
dest->x,
|
||||
dest->y,
|
||||
dest->w,
|
||||
dest->h,
|
||||
src->tiles->levels->width,
|
||||
dest->tiles->levels->width);fflush(stdout);*/
|
||||
|
||||
|
||||
/* If we're copying from the same offset in each drawable,
|
||||
* and the PixelRegions are the same size, and the drawables are
|
||||
* the same size, we can do a quick'n'cheap Copy-On-Write. Otherwise
|
||||
* we have to do the copy the old fashioned way.
|
||||
*
|
||||
* For COW the PixelRegions must also be of the same dimensions as the
|
||||
* tilemanager level, for reasons of simplicity. Future work
|
||||
* may remove this restriction.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
printf("SPR[ D%p T%p R%d O%d,%d S%d,%d B%d d%d P%d ]\n",
|
||||
src->data, src->tiles, src->rowstride, src->x,
|
||||
src->y, src->w, src->h, src->bytes, src->dirty,
|
||||
src->process_count);
|
||||
printf("DPR[ D%p T%p R%d O%d,%d S%d,%d B%d d%d P%d ]\n",
|
||||
dest->data, dest->tiles, dest->rowstride, dest->x,
|
||||
dest->y, dest->w, dest->h, dest->bytes, dest->dirty,
|
||||
dest->process_count);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
if ((src->x == dest->x) &&
|
||||
(src->y == dest->y) &&
|
||||
(src->w == dest->w) &&
|
||||
(src->h == dest->h)
|
||||
&&
|
||||
(src->tiles) &&
|
||||
(dest->tiles)
|
||||
&&
|
||||
(src->tiles->levels) &&
|
||||
(dest->tiles->levels) &&
|
||||
(dest->tiles->levels->width == src->tiles->levels->width) &&
|
||||
(dest->tiles->levels->height == src->tiles->levels->height)
|
||||
&&
|
||||
(src->w == src->tiles->levels->width) &&
|
||||
(src->h == src->tiles->levels->height)
|
||||
)
|
||||
{
|
||||
Tile *src_tile;
|
||||
gint xstepper,ystepper;
|
||||
|
||||
#if defined (TILE_DEBUG)
|
||||
g_print ("CR: c.o.w. \n");
|
||||
#endif
|
||||
|
||||
/* c.o.w. */
|
||||
|
||||
for (ystepper = src->y;
|
||||
ystepper < (src->y + src->h);
|
||||
ystepper += TILE_HEIGHT)
|
||||
{
|
||||
for (xstepper = src->x;
|
||||
xstepper < (src->x + src->w);
|
||||
xstepper += TILE_WIDTH)
|
||||
{
|
||||
src_tile = tile_manager_get_tile (src->tiles,
|
||||
xstepper, ystepper,
|
||||
0, TRUE, FALSE);
|
||||
|
||||
tile_manager_map_tile (dest->tiles,
|
||||
xstepper, ystepper, 0,
|
||||
src_tile);
|
||||
|
||||
tile_release (src_tile, FALSE);
|
||||
}
|
||||
}
|
||||
#if defined (TILE_DEBUG)
|
||||
g_print (src_tile ? "dest " : "src ");
|
||||
g_print ("CR: END c.o.w. \n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* else 'The old-fashioned way.'
|
||||
*/
|
||||
|
||||
fputc('[',stderr);
|
||||
for (pr = pixel_regions_register (2, src, dest);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
pixelwidth = src->w * src->bytes;
|
||||
s = src->data;
|
||||
d = dest->data;
|
||||
h = src->h;
|
||||
|
||||
while (h --)
|
||||
if (src->tiles && dest->tiles &&
|
||||
src->curtile && dest->curtile &&
|
||||
src->offx == 0 && dest->offx == 0 &&
|
||||
src->offy == 0 && dest->offy == 0 &&
|
||||
src->w == tile_ewidth(src->curtile) &&
|
||||
dest->w == tile_ewidth(dest->curtile) &&
|
||||
src->h == tile_eheight(src->curtile) &&
|
||||
dest->h == tile_eheight(dest->curtile))
|
||||
{
|
||||
memcpy (d, s, pixelwidth);
|
||||
s += src->rowstride;
|
||||
d += dest->rowstride;
|
||||
fputc('!',stderr);
|
||||
tile_manager_map_over_tile (dest->tiles, dest->curtile, src->curtile);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputc('.',stderr);
|
||||
pixelwidth = src->w * src->bytes;
|
||||
s = src->data;
|
||||
d = dest->data;
|
||||
h = src->h;
|
||||
|
||||
while (h --)
|
||||
{
|
||||
memcpy (d, s, pixelwidth);
|
||||
s += src->rowstride;
|
||||
d += dest->rowstride;
|
||||
}
|
||||
}
|
||||
}
|
||||
fputc(']',stderr);
|
||||
fputc('\n',stderr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3706,7 +3636,7 @@ shapeburst_region (PixelRegion *srcPR,
|
|||
|
||||
while (y >= end)
|
||||
{
|
||||
tile = tile_manager_get_tile (srcPR->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (srcPR->tiles, x, y, TRUE, FALSE);
|
||||
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;
|
||||
|
|
|
@ -474,10 +474,10 @@ perspective_invoker (args)
|
|||
cy = float_tiles->y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->levels[0].width)
|
||||
scalex = 1.0 / float_tiles->levels[0].width;
|
||||
if (float_tiles->levels[0].height)
|
||||
scaley = 1.0 / float_tiles->levels[0].height;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
|
||||
/* assemble the transformation matrix */
|
||||
identity_matrix (matrix);
|
||||
|
|
|
@ -74,8 +74,9 @@ pixel_region_init (PR, tiles, x, y, w, h, dirty)
|
|||
int dirty;
|
||||
{
|
||||
PR->tiles = tiles;
|
||||
PR->curtile = NULL;
|
||||
PR->data = NULL;
|
||||
PR->bytes = tiles->levels[0].bpp;
|
||||
PR->bytes = tiles->bpp;
|
||||
PR->rowstride = PR->bytes * TILE_WIDTH;
|
||||
PR->x = x;
|
||||
PR->y = y;
|
||||
|
@ -118,7 +119,7 @@ pixel_region_get_async (PR, ulx, uly, lrx, lry)
|
|||
|
||||
for (y = uly; y < lry; y += TILE_HEIGHT)
|
||||
for (x = ulx; x < lrx; x += TILE_WIDTH)
|
||||
tile_manager_get_async (PR->tiles, x, y, 0);
|
||||
tile_manager_get_async (PR->tiles, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -143,7 +144,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
|
||||
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
npixels = tile_ewidth (tile) - (x % TILE_WIDTH);
|
||||
|
||||
|
@ -190,7 +191,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, TRUE);
|
||||
tile_data = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
|
||||
npixels = tile_ewidth(tile) - (x % TILE_WIDTH);
|
||||
|
@ -229,7 +230,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, FALSE);
|
||||
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 */
|
||||
|
@ -269,7 +270,7 @@ 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 = tile_manager_get_tile (PR->tiles, x, y, TRUE, TRUE);
|
||||
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);
|
||||
|
@ -370,8 +371,8 @@ pixel_regions_process (PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, FALSE, FALSE);
|
||||
tile_release (tile, PRH->PR->dirty);
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
|
||||
PRH->PR->x += PRI->portion_width;
|
||||
|
@ -417,8 +418,8 @@ pixel_regions_process_stop (PRI_ptr)
|
|||
/* Unref the last referenced tile if the underlying region is a tile manager */
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, FALSE, FALSE);
|
||||
tile_release (tile, PRH->PR->dirty);
|
||||
tile_release (PRH->PR->curtile, PRH->PR->dirty);
|
||||
PRH->PR->curtile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,16 +589,14 @@ pixel_region_configure (PRH, PRI)
|
|||
*/
|
||||
if (PRH->PR->tiles)
|
||||
{
|
||||
Tile *tile;
|
||||
int offx, offy;
|
||||
PRH->PR->curtile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, TRUE, PRH->PR->dirty);
|
||||
|
||||
tile = tile_manager_get_tile (PRH->PR->tiles, PRH->PR->x, PRH->PR->y, 0, TRUE, PRH->PR->dirty);
|
||||
PRH->PR->offx = PRH->PR->x % TILE_WIDTH;
|
||||
PRH->PR->offy = PRH->PR->y % TILE_HEIGHT;
|
||||
|
||||
offx = PRH->PR->x % TILE_WIDTH;
|
||||
offy = PRH->PR->y % TILE_HEIGHT;
|
||||
|
||||
PRH->PR->rowstride = tile_ewidth(tile) * PRH->PR->bytes;
|
||||
PRH->PR->data = tile_data_pointer(tile, offx, offy);
|
||||
PRH->PR->rowstride = tile_ewidth(PRH->PR->curtile) * PRH->PR->bytes;
|
||||
PRH->PR->data = tile_data_pointer(PRH->PR->curtile,
|
||||
PRH->PR->offx, PRH->PR->offy);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,6 +26,8 @@ struct _PixelRegion
|
|||
{
|
||||
unsigned char * data; /* pointer to region data */
|
||||
TileManager * tiles; /* pointer to tiles */
|
||||
Tile * curtile; /* current tile */
|
||||
int offx, offy; /* tile offsets */
|
||||
int rowstride; /* bytes per pixel row */
|
||||
int x, y; /* origin */
|
||||
int w, h; /* width and height of region */
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -1358,7 +1358,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, 0, TRUE, TRUE);
|
||||
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
@ -1395,7 +1395,7 @@ plug_in_handle_tile_req (GPTileReq *tile_req)
|
|||
return;
|
||||
}
|
||||
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get (tm, tile_req->tile_num, TRUE, FALSE);
|
||||
if (!tile)
|
||||
{
|
||||
g_message ("plug-in requested invalid tile (killing)\n");
|
||||
|
|
|
@ -479,8 +479,8 @@ rotate_invoker (args)
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->levels[0].width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->levels[0].height / 2.0;
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
|
||||
/* assemble the transformation matrix */
|
||||
identity_matrix (matrix);
|
||||
|
|
|
@ -440,11 +440,11 @@ scale_tool_scale (gimage, drawable, trans_info, float_tiles, interpolation, matr
|
|||
y2 = trans_info[Y2];
|
||||
|
||||
pixel_region_init (&srcPR, float_tiles, 0, 0,
|
||||
float_tiles->levels[0].width,
|
||||
float_tiles->levels[0].height, FALSE);
|
||||
float_tiles->width,
|
||||
float_tiles->height, FALSE);
|
||||
|
||||
/* Create the new tile manager */
|
||||
new_tiles = tile_manager_new ((x2 - x1), (y2 - y1), float_tiles->levels[0].bpp);
|
||||
new_tiles = tile_manager_new ((x2 - x1), (y2 - y1), float_tiles->bpp);
|
||||
pixel_region_init (&destPR, new_tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
|
||||
|
@ -592,10 +592,10 @@ scale_invoker (args)
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->levels[0].width)
|
||||
scalex = (trans_info[X2] - trans_info[X1]) / (double) float_tiles->levels[0].width;
|
||||
if (float_tiles->levels[0].height)
|
||||
scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->levels[0].height;
|
||||
if (float_tiles->width)
|
||||
scalex = (trans_info[X2] - trans_info[X1]) / (double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = (trans_info[Y2] - trans_info[Y1]) / (double) float_tiles->height;
|
||||
|
||||
/* assemble the transformation matrix */
|
||||
identity_matrix (matrix);
|
||||
|
|
|
@ -485,16 +485,16 @@ shear_invoker (args)
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->levels[0].width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->levels[0].height / 2.0;
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
|
||||
identity_matrix (matrix);
|
||||
translate_matrix (matrix, -cx, -cy);
|
||||
/* shear matrix */
|
||||
if (shear_type == HORZ)
|
||||
xshear_matrix (matrix, shear_magnitude / float_tiles->levels[0].height);
|
||||
xshear_matrix (matrix, shear_magnitude / float_tiles->height);
|
||||
else if (shear_type == VERT)
|
||||
yshear_matrix (matrix, shear_magnitude / float_tiles->levels[0].width);
|
||||
yshear_matrix (matrix, shear_magnitude / float_tiles->width);
|
||||
translate_matrix (matrix, +cx, +cy);
|
||||
|
||||
/* shear the buffer */
|
||||
|
|
|
@ -1877,8 +1877,8 @@ text_render (GImage *gimage,
|
|||
tile_manager_destroy (mask);
|
||||
|
||||
if (newmask &&
|
||||
(layer = layer_new (gimage, newmask->levels[0].width,
|
||||
newmask->levels[0].height, layer_type,
|
||||
(layer = layer_new (gimage, newmask->width,
|
||||
newmask->height, layer_type,
|
||||
"Text Layer", OPAQUE_OPACITY, NORMAL_MODE)))
|
||||
{
|
||||
/* color the layer buffer */
|
||||
|
|
|
@ -23,12 +23,9 @@
|
|||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h" /* ick. */
|
||||
|
||||
static void tile_manager_destroy_level (TileManager *tm,
|
||||
TileLevel *level);
|
||||
static int tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level);
|
||||
int ypixel);
|
||||
|
||||
|
||||
TileManager*
|
||||
|
@ -37,120 +34,48 @@ tile_manager_new (int toplevel_width,
|
|||
int bpp)
|
||||
{
|
||||
TileManager *tm;
|
||||
int tmp1, tmp2;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
tm = g_new (TileManager, 1);
|
||||
|
||||
tmp1 = tile_manager_calc_levels (toplevel_width, TILE_WIDTH);
|
||||
tmp2 = tile_manager_calc_levels (toplevel_height, TILE_HEIGHT);
|
||||
|
||||
tm->nlevels = MAX (tmp1, tmp2);
|
||||
tm->levels = g_new (TileLevel, tm->nlevels);
|
||||
tm->user_data = NULL;
|
||||
tm->validate_proc = NULL;
|
||||
|
||||
width = toplevel_width;
|
||||
height = toplevel_height;
|
||||
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
{
|
||||
tm->levels[i].width = width;
|
||||
tm->levels[i].height = height;
|
||||
tm->levels[i].bpp = bpp;
|
||||
tm->levels[i].ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
tm->levels[i].ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
tm->levels[i].tiles = NULL;
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
}
|
||||
|
||||
tm->width = width;
|
||||
tm->height = height;
|
||||
tm->bpp = bpp;
|
||||
tm->ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
tm->ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
tm->tiles = NULL;
|
||||
|
||||
return tm;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_destroy (TileManager *tm)
|
||||
{
|
||||
int ntiles;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
tile_manager_destroy_level (tm, &tm->levels[i]);
|
||||
if (tm->tiles)
|
||||
{
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
for (i = 0; i < ntiles; i++)
|
||||
{
|
||||
TILE_MUTEX_LOCK (tm->tiles[i]);
|
||||
tile_detach (tm->tiles[i], tm, i);
|
||||
}
|
||||
|
||||
g_free (tm->tiles);
|
||||
}
|
||||
|
||||
g_free (tm->levels);
|
||||
g_free (tm);
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_calc_levels (int size,
|
||||
int tile_size)
|
||||
{
|
||||
int levels;
|
||||
|
||||
levels = 1;
|
||||
while (size > tile_size)
|
||||
{
|
||||
size /= 2;
|
||||
levels += 1;
|
||||
}
|
||||
|
||||
return levels;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_nlevels (TileManager *tm,
|
||||
int nlevels)
|
||||
{
|
||||
TileLevel *levels;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
if ((nlevels < 1) || (nlevels == tm->nlevels))
|
||||
return;
|
||||
|
||||
levels = g_new (TileLevel, nlevels);
|
||||
|
||||
if (nlevels > tm->nlevels)
|
||||
{
|
||||
for (i = 0; i < tm->nlevels; i++)
|
||||
levels[i] = tm->levels[i];
|
||||
|
||||
width = tm->levels[tm->nlevels - 1].width;
|
||||
height = tm->levels[tm->nlevels - 1].height;
|
||||
|
||||
for (; i < nlevels; i++)
|
||||
{
|
||||
levels[i].width = width;
|
||||
levels[i].height = height;
|
||||
levels[i].bpp = tm->levels[0].bpp;
|
||||
levels[i].ntile_rows = (height + TILE_HEIGHT - 1) / TILE_HEIGHT;
|
||||
levels[i].ntile_cols = (width + TILE_WIDTH - 1) / TILE_WIDTH;
|
||||
levels[i].tiles = NULL;
|
||||
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nlevels; i++)
|
||||
levels[i] = tm->levels[i];
|
||||
|
||||
for (; i < tm->nlevels; i++)
|
||||
tile_manager_destroy_level (tm, &tm->levels[i]);
|
||||
}
|
||||
|
||||
g_free (tm->levels);
|
||||
|
||||
tm->nlevels = nlevels;
|
||||
tm->levels = levels;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_validate_proc (TileManager *tm,
|
||||
|
@ -159,31 +84,29 @@ tile_manager_set_validate_proc (TileManager *tm,
|
|||
tm->validate_proc = proc;
|
||||
}
|
||||
|
||||
|
||||
Tile*
|
||||
tile_manager_get_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite)
|
||||
{
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return NULL;
|
||||
|
||||
return tile_manager_get (tm, tile_num, level, wantread, wantwrite);
|
||||
return tile_manager_get (tm, tile_num, wantread, wantwrite);
|
||||
}
|
||||
|
||||
Tile*
|
||||
tile_manager_get (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile **tiles;
|
||||
Tile **tile_ptr;
|
||||
int ntiles;
|
||||
|
@ -192,32 +115,28 @@ tile_manager_get (TileManager *tm,
|
|||
int bottom_tile;
|
||||
int i, j, k;
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
return NULL;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
ntiles = tile_level->ntile_rows * tile_level->ntile_cols;
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
return NULL;
|
||||
|
||||
if (!tile_level->tiles)
|
||||
if (!tm->tiles)
|
||||
{
|
||||
tile_level->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tile_level->tiles;
|
||||
tm->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tm->tiles;
|
||||
|
||||
nrows = tile_level->ntile_rows;
|
||||
ncols = tile_level->ntile_cols;
|
||||
nrows = tm->ntile_rows;
|
||||
ncols = tm->ntile_cols;
|
||||
|
||||
right_tile = tile_level->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tile_level->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
right_tile = tm->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tm->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
|
||||
for (i = 0, k = 0; i < nrows; i++)
|
||||
{
|
||||
for (j = 0; j < ncols; j++, k++)
|
||||
{
|
||||
tiles[k] = g_new (Tile, 1);
|
||||
tile_init (tiles[k], tile_level->bpp);
|
||||
tile_init (tiles[k], tm->bpp);
|
||||
tile_attach (tiles[k], tm, k);
|
||||
|
||||
if (j == (ncols - 1))
|
||||
|
@ -229,7 +148,7 @@ tile_manager_get (TileManager *tm,
|
|||
}
|
||||
}
|
||||
|
||||
tile_ptr = &tile_level->tiles[tile_num];
|
||||
tile_ptr = &tm->tiles[tile_num];
|
||||
|
||||
if (wantread)
|
||||
{
|
||||
|
@ -268,19 +187,16 @@ tile_manager_get (TileManager *tm,
|
|||
void
|
||||
tile_manager_get_async (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level)
|
||||
int ypixel)
|
||||
{
|
||||
Tile *tile_ptr;
|
||||
TileLevel *tile_level;
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
tile_ptr = tile_level->tiles[tile_num];
|
||||
tile_ptr = tm->tiles[tile_num];
|
||||
|
||||
tile_swap_in_async (tile_ptr);
|
||||
}
|
||||
|
@ -292,164 +208,40 @@ tile_manager_validate (TileManager *tm,
|
|||
tile->valid = TRUE;
|
||||
|
||||
if (tm->validate_proc)
|
||||
(* tm->validate_proc) (tm, tile, -1);
|
||||
(* tm->validate_proc) (tm, tile);
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_invalidate_tiles (TileManager *tm,
|
||||
Tile *toplevel_tile)
|
||||
{
|
||||
TileLevel *level;
|
||||
double x, y;
|
||||
int row, col;
|
||||
int num;
|
||||
int i;
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->levels[0].ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->levels[0].ntile_cols;
|
||||
col = toplevel_tile->tlink->tile_num % tm->ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->ntile_cols;
|
||||
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->levels[0].width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->levels[0].height;
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->height;
|
||||
|
||||
for (i = 1; i < tm->nlevels; i++)
|
||||
if (tm->tiles)
|
||||
{
|
||||
level = &tm->levels[i];
|
||||
if (level->tiles)
|
||||
{
|
||||
col = x * level->width / TILE_WIDTH;
|
||||
row = y * level->height / TILE_HEIGHT;
|
||||
num = row * level->ntile_cols + col;
|
||||
tile_invalidate (&level->tiles[num], tm, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_invalidate_sublevels (TileManager *tm)
|
||||
{
|
||||
int ntiles;
|
||||
int i, j;
|
||||
|
||||
for (i = 1; i < tm->nlevels; i++)
|
||||
{
|
||||
if (tm->levels[i].tiles)
|
||||
{
|
||||
ntiles = tm->levels[i].ntile_rows * tm->levels[i].ntile_cols;
|
||||
for (j = 0; j < ntiles; j++)
|
||||
tile_invalidate (&tm->levels[i].tiles[j], tm, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_update_tile (TileManager *tm,
|
||||
Tile *toplevel_tile,
|
||||
int level)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile *tile;
|
||||
guchar *src, *dest;
|
||||
double x, y;
|
||||
int srcx, srcy;
|
||||
int tilex, tiley;
|
||||
int tilew, tileh;
|
||||
int bpp;
|
||||
int row, col;
|
||||
int num;
|
||||
int i, j, k;
|
||||
|
||||
if ((level < 1) || (level >= tm->nlevels))
|
||||
return;
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->levels[0].ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->levels[0].ntile_cols;
|
||||
|
||||
x = (col * TILE_WIDTH + toplevel_tile->ewidth / 2.0) / (double) tm->levels[0].width;
|
||||
y = (row * TILE_HEIGHT + toplevel_tile->eheight / 2.0) / (double) tm->levels[0].height;
|
||||
|
||||
tilex = ((col * TILE_WIDTH) >> level) % 64;
|
||||
tiley = ((row * TILE_HEIGHT) >> level) % 64;
|
||||
|
||||
if (level > 6)
|
||||
{
|
||||
if (((col % (level - 6)) != 0) ||
|
||||
((row % (level - 6)) != 0))
|
||||
return;
|
||||
|
||||
tilew = 1;
|
||||
tileh = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tilew = (toplevel_tile->ewidth) >> level;
|
||||
tileh = (toplevel_tile->eheight) >> level;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
col = (x * tile_level->width) / TILE_WIDTH;
|
||||
row = (y * tile_level->height) / TILE_HEIGHT;
|
||||
num = row * tile_level->ntile_cols + col;
|
||||
|
||||
tile = tile_manager_get (tm, num, level, TRUE, TRUE);
|
||||
|
||||
tile_lock (toplevel_tile);
|
||||
|
||||
tilew += tilex;
|
||||
tileh += tiley;
|
||||
|
||||
bpp = tile->bpp;
|
||||
|
||||
for (i = tiley; i < tileh; i++)
|
||||
{
|
||||
srcx = tilex << level;
|
||||
srcy = tiley << level;
|
||||
|
||||
src = toplevel_tile->data + (srcy * toplevel_tile->ewidth + srcx) * bpp;
|
||||
dest = tile->data + (tiley * tile->ewidth + tilex) * bpp;
|
||||
|
||||
for (j = tilex; j < tilew; j++)
|
||||
{
|
||||
for (k = 0; k < bpp; k++)
|
||||
dest[k] = src[k];
|
||||
|
||||
dest += bpp;
|
||||
src += (bpp << level);
|
||||
}
|
||||
}
|
||||
|
||||
tile_release (tile, TRUE);
|
||||
tile_release (toplevel_tile, FALSE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
tile_manager_destroy_level (TileManager *tm, TileLevel *level)
|
||||
{
|
||||
int ntiles;
|
||||
int i;
|
||||
|
||||
if (level->tiles)
|
||||
{
|
||||
ntiles = level->ntile_rows * level->ntile_cols;
|
||||
|
||||
for (i = 0; i < ntiles; i++)
|
||||
{
|
||||
TILE_MUTEX_LOCK (level->tiles[i]);
|
||||
tile_detach (level->tiles[i], tm, i);
|
||||
}
|
||||
|
||||
g_free (level->tiles);
|
||||
col = x * tm->width / TILE_WIDTH;
|
||||
row = y * tm->height / TILE_HEIGHT;
|
||||
num = row * tm->ntile_cols + col;
|
||||
tile_invalidate (&tm->tiles[num], tm, num);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tile_invalidate_tile (Tile **tile_ptr, TileManager *tm,
|
||||
int xpixel, int ypixel, int level)
|
||||
int xpixel, int ypixel)
|
||||
{
|
||||
int tile_num;
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel, level);
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0) return;
|
||||
|
||||
tile_invalidate (tile_ptr, tm, tile_num);
|
||||
|
@ -505,26 +297,14 @@ void
|
|||
tile_manager_map_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
Tile *srctile)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
int tile_row;
|
||||
int tile_col;
|
||||
int tile_num;
|
||||
|
||||
/* printf("#");fflush(stdout); */
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
{
|
||||
g_warning ("tile_manager_map_tile: level out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tile_level->width) ||
|
||||
(ypixel < 0) || (ypixel >= tile_level->height))
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
{
|
||||
g_warning ("tile_manager_map_tile: tile co-ord out of range.");
|
||||
return;
|
||||
|
@ -532,18 +312,16 @@ tile_manager_map_tile (TileManager *tm,
|
|||
|
||||
tile_row = ypixel / TILE_HEIGHT;
|
||||
tile_col = xpixel / TILE_WIDTH;
|
||||
tile_num = tile_row * tile_level->ntile_cols + tile_col;
|
||||
tile_num = tile_row * tm->ntile_cols + tile_col;
|
||||
|
||||
tile_manager_map (tm, tile_num, level, srctile);
|
||||
tile_manager_map (tm, tile_num, srctile);
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_map (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
Tile *srctile)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
Tile **tiles;
|
||||
Tile **tile_ptr;
|
||||
int ntiles;
|
||||
|
@ -552,16 +330,7 @@ tile_manager_map (TileManager *tm,
|
|||
int bottom_tile;
|
||||
int i, j, k;
|
||||
|
||||
/* printf("@");fflush(stdout);*/
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
{
|
||||
g_warning ("tile_manager_map: level out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
ntiles = tile_level->ntile_rows * tile_level->ntile_cols;
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
{
|
||||
|
@ -569,18 +338,18 @@ tile_manager_map (TileManager *tm,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!tile_level->tiles)
|
||||
if (!tm->tiles)
|
||||
{
|
||||
/* g_warning ("tile_manager_map: empty tile level - init'ing.");*/
|
||||
|
||||
tile_level->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tile_level->tiles;
|
||||
tm->tiles = g_new (Tile*, ntiles);
|
||||
tiles = tm->tiles;
|
||||
|
||||
nrows = tile_level->ntile_rows;
|
||||
ncols = tile_level->ntile_cols;
|
||||
nrows = tm->ntile_rows;
|
||||
ncols = tm->ntile_cols;
|
||||
|
||||
right_tile = tile_level->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tile_level->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
right_tile = tm->width - ((ncols - 1) * TILE_WIDTH);
|
||||
bottom_tile = tm->height - ((nrows - 1) * TILE_HEIGHT);
|
||||
|
||||
for (i = 0, k = 0; i < nrows; i++)
|
||||
{
|
||||
|
@ -589,7 +358,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* printf(",");fflush(stdout);*/
|
||||
|
||||
tiles[k] = g_new (Tile, 1);
|
||||
tile_init (tiles[k], tile_level->bpp);
|
||||
tile_init (tiles[k], tm->bpp);
|
||||
tile_attach (tiles[k], tm, k);
|
||||
|
||||
if (j == (ncols - 1))
|
||||
|
@ -603,7 +372,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* g_warning ("tile_manager_map: empty tile level - done.");*/
|
||||
}
|
||||
|
||||
tile_ptr = &tile_level->tiles[tile_num];
|
||||
tile_ptr = &tm->tiles[tile_num];
|
||||
|
||||
/* printf(")");fflush(stdout);*/
|
||||
|
||||
|
@ -632,25 +401,19 @@ tile_manager_map (TileManager *tm,
|
|||
static int
|
||||
tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level)
|
||||
int ypixel)
|
||||
{
|
||||
TileLevel *tile_level;
|
||||
int tile_row;
|
||||
int tile_col;
|
||||
int tile_num;
|
||||
|
||||
if ((level < 0) || (level >= tm->nlevels))
|
||||
return -1;
|
||||
|
||||
tile_level = &tm->levels[level];
|
||||
if ((xpixel < 0) || (xpixel >= tile_level->width) ||
|
||||
(ypixel < 0) || (ypixel >= tile_level->height))
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
return -1;
|
||||
|
||||
tile_row = ypixel / TILE_HEIGHT;
|
||||
tile_col = xpixel / TILE_WIDTH;
|
||||
tile_num = tile_row * tile_level->ntile_cols + tile_col;
|
||||
tile_num = tile_row * tm->ntile_cols + tile_col;
|
||||
|
||||
return tile_num;
|
||||
}
|
||||
|
@ -669,21 +432,21 @@ tile_manager_get_user_data (TileManager *tm)
|
|||
}
|
||||
|
||||
int
|
||||
tile_manager_level_width (TileManager *tm, int level)
|
||||
tile_manager_level_width (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].width;
|
||||
return tm->width;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_height (TileManager *tm, int level)
|
||||
tile_manager_level_height (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].height;
|
||||
return tm->height;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_bpp (TileManager *tm, int level)
|
||||
tile_manager_level_bpp (TileManager *tm)
|
||||
{
|
||||
return tm->levels[level].bpp;
|
||||
return tm->bpp;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -702,8 +465,28 @@ tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile, int *x, int *y)
|
|||
return;
|
||||
}
|
||||
|
||||
*x = TILE_WIDTH * (tl->tile_num % tm->levels[0].ntile_cols);
|
||||
*y = TILE_HEIGHT * (tl->tile_num / tm->levels[0].ntile_cols);
|
||||
*x = TILE_WIDTH * (tl->tile_num % tm->ntile_cols);
|
||||
*y = TILE_HEIGHT * (tl->tile_num / tm->ntile_cols);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile)
|
||||
{
|
||||
TileLink *tl;
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
}
|
||||
|
||||
if (tl == NULL)
|
||||
{
|
||||
g_warning ("tile_manager_map_over_tile: tile not attached to manager");
|
||||
return;
|
||||
}
|
||||
|
||||
tile_manager_map (tm, tl->tile_num, srctile);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,10 @@
|
|||
#include "tile.h"
|
||||
|
||||
|
||||
typedef struct _TileLevel TileLevel;
|
||||
typedef struct _TileManager TileManager;
|
||||
|
||||
typedef void (*TileValidateProc) (TileManager *tm,
|
||||
Tile *tile,
|
||||
int level);
|
||||
Tile *tile);
|
||||
|
||||
|
||||
/* Creates a new tile manager with the specified
|
||||
|
@ -47,23 +45,6 @@ TileManager* tile_manager_new (int toplevel_width,
|
|||
*/
|
||||
void tile_manager_destroy (TileManager *tm);
|
||||
|
||||
/* Calculate the number of levels necessary to have a complete
|
||||
* hierarchy. This procedure is normally called twice with
|
||||
* the width and then height and the maximum value returned
|
||||
* is then used as the number of levels an image needs.
|
||||
*/
|
||||
int tile_manager_calc_levels (int size,
|
||||
int tile_size);
|
||||
|
||||
/* Set the number of levels this tile manager is managing.
|
||||
* This procedure may destroy unnecessary levels in the
|
||||
* tile manager if the new number of levels is less than
|
||||
* the old number of levels.
|
||||
* Any newly added levels will consist of invalid tiles.
|
||||
*/
|
||||
void tile_manager_set_nlevels (TileManager *tm,
|
||||
int nlevels);
|
||||
|
||||
/* Set the validate procedure for the tile manager.
|
||||
* The validate procedure is called when an invalid tile
|
||||
* is referenced. If the procedure is NULL, then the tile
|
||||
|
@ -73,15 +54,11 @@ void tile_manager_set_nlevels (TileManager *tm,
|
|||
void tile_manager_set_validate_proc (TileManager *tm,
|
||||
TileValidateProc proc);
|
||||
|
||||
/* Get a specified tile from a tile manager. The tile
|
||||
* is from the given level and contains the specified
|
||||
* pixel. Be aware that the pixel coordinates are
|
||||
* dependent on the level.
|
||||
/* Get a specified tile from a tile manager.
|
||||
*/
|
||||
Tile* tile_manager_get_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite);
|
||||
|
||||
|
@ -89,29 +66,25 @@ Tile* tile_manager_get_tile (TileManager *tm,
|
|||
*/
|
||||
Tile* tile_manager_get (TileManager *tm,
|
||||
int tile_num,
|
||||
int level,
|
||||
int wantread,
|
||||
int wantwrite);
|
||||
|
||||
/* Request that (if possible) the tile at x,y,layer be swapped
|
||||
/* Request that (if possible) the tile at x,y be swapped
|
||||
* in. This is only a hint to improve performance; no guarantees.
|
||||
* The tile may be swapped in or otherwise made more accessible
|
||||
* if it is convenient...
|
||||
*/
|
||||
void tile_manager_get_async (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level);
|
||||
int ypixel);
|
||||
|
||||
void tile_manager_map_tile (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel,
|
||||
int level,
|
||||
Tile *srctile);
|
||||
|
||||
void tile_manager_map (TileManager *tm,
|
||||
int time_num,
|
||||
int level,
|
||||
Tile *srctile);
|
||||
|
||||
/* Validate a tiles memory.
|
||||
|
@ -121,37 +94,27 @@ void tile_manager_validate (TileManager *tm,
|
|||
|
||||
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);
|
||||
int xpixel, int ypixel);
|
||||
|
||||
/* Given a toplevel tile, this procedure will invalidate
|
||||
* (set the dirty bit) for all tiles in lower levels which
|
||||
* contain this toplevel tile.
|
||||
* Note: if a level hasn't been created then the tile for that
|
||||
* level won't be invalidated.
|
||||
* (set the dirty bit) for this toplevel tile.
|
||||
*/
|
||||
void tile_manager_invalidate_tiles (TileManager *tm,
|
||||
Tile *toplevel_tile);
|
||||
|
||||
/* Invalidates all the tiles in the sublevels.
|
||||
*/
|
||||
void tile_manager_invalidate_sublevels (TileManager *tm);
|
||||
|
||||
/* Update a portion lower level tile given a toplevel tile.
|
||||
*/
|
||||
void tile_manager_update_tile (TileManager *tm,
|
||||
Tile *toplevel_tile,
|
||||
int level);
|
||||
|
||||
void tile_manager_set_user_data (TileManager *tm,
|
||||
void *user_data);
|
||||
|
||||
void *tile_manager_get_user_data (TileManager *tm);
|
||||
|
||||
int tile_manager_level_width (TileManager *tm, int level);
|
||||
int tile_manager_level_height (TileManager *tm, int level);
|
||||
int tile_manager_level_bpp (TileManager *tm, int level);
|
||||
int tile_manager_level_width (TileManager *tm);
|
||||
int tile_manager_level_height (TileManager *tm);
|
||||
int tile_manager_level_bpp (TileManager *tm);
|
||||
|
||||
void tile_manager_get_tile_coordinates (TileManager *tm, Tile *tile,
|
||||
int *x, int *y);
|
||||
|
||||
void tile_manager_map_over_tile (TileManager *tm, Tile *tile, Tile *srctile);
|
||||
|
||||
|
||||
#endif /* __TILE_MANAGER_H__ */
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
|
||||
#include "tile.h"
|
||||
|
||||
struct _TileLevel
|
||||
struct _TileManager
|
||||
{
|
||||
int x, y; /* tile manager offsets */
|
||||
|
||||
int width; /* the width of the tiled area */
|
||||
int height; /* the height of the tiled area */
|
||||
int bpp; /* the bpp of each tile */
|
||||
|
@ -30,13 +32,6 @@ struct _TileLevel
|
|||
int ntile_cols; /* the number of tiles in each columns */
|
||||
|
||||
Tile **tiles; /* the tiles for this level */
|
||||
};
|
||||
|
||||
struct _TileManager
|
||||
{
|
||||
int x, y; /* tile manager offsets */
|
||||
int nlevels; /* the number of tile levels in the hierarchy */
|
||||
TileLevel *levels; /* the hierarchy */
|
||||
TileValidateProc validate_proc; /* this proc is called when an attempt to get an
|
||||
* invalid tile is made.
|
||||
*/
|
||||
|
|
|
@ -1033,7 +1033,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
@ -1051,7 +1051,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -1070,7 +1070,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
value = cos (0.5 * M_PI * value);
|
||||
tile_release (tile, FALSE);
|
||||
|
|
|
@ -360,7 +360,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);
|
||||
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -369,7 +369,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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -931,7 +931,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = bcd->gimage->height * bevent->y / bcd->preview->requisition.height;
|
||||
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);
|
||||
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
else
|
||||
|
@ -943,7 +943,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = drawable_height (drawable) * bevent->y / bcd->preview->requisition.height - offy;
|
||||
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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
|
||||
|
|
|
@ -327,7 +327,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);
|
||||
tile = tile_manager_get_tile (tiles, x, y, TRUE, FALSE);
|
||||
src = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -248,9 +248,9 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -258,14 +258,14 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].width; i++)
|
||||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->levels[0].width - i - 1), 0, 1, orig->levels[0].height, TRUE);
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
@ -289,9 +289,9 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -299,14 +299,14 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].height; i++)
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->levels[0].width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->levels[0].height - i - 1), orig->levels[0].width, 1, TRUE);
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
|
|
@ -128,8 +128,8 @@ ref_tiles (TileManager *src, TileManager *mask, Tile **s_tile, Tile **m_tile,
|
|||
if (*m_tile != NULL)
|
||||
tile_release (*m_tile, TRUE);
|
||||
|
||||
*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_tile = tile_manager_get_tile (src, x, y, TRUE, FALSE);
|
||||
*m_tile = tile_manager_get_tile (mask, x, y, TRUE, TRUE);
|
||||
|
||||
*s = tile_data_pointer (*s_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
*m = tile_data_pointer (*m_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
|
@ -214,7 +214,7 @@ find_contiguous_region_helper (PixelRegion *mask, PixelRegion *src,
|
|||
if (x < 0 || x >= src->w) return;
|
||||
if (y < 0 || y >= src->h) return;
|
||||
|
||||
tile = tile_manager_get_tile (mask->tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (mask->tiles, x, y, TRUE, FALSE);
|
||||
val = *(unsigned char *)(tile_data_pointer (tile,
|
||||
x%TILE_WIDTH, y%TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
@ -281,7 +281,7 @@ find_contiguous_region (GImage *gimage, GimpDrawable *drawable, int antialias,
|
|||
mask = channel_new_mask (gimage, srcPR.w, srcPR.h);
|
||||
pixel_region_init (&maskPR, drawable_data (GIMP_DRAWABLE(mask)), 0, 0, drawable_width (GIMP_DRAWABLE(mask)), drawable_height (GIMP_DRAWABLE(mask)), TRUE);
|
||||
|
||||
tile = tile_manager_get_tile (srcPR.tiles, x, y, 0, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (srcPR.tiles, x, y, TRUE, FALSE);
|
||||
if (tile)
|
||||
{
|
||||
start = tile_data_pointer (tile, x%TILE_WIDTH, y%TILE_HEIGHT);
|
||||
|
|
|
@ -1033,7 +1033,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = 1.0 - *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
|
@ -1051,7 +1051,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -1070,7 +1070,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);
|
||||
tile = tile_manager_get_tile (distR.tiles, ix, iy, TRUE, FALSE);
|
||||
value = *((float *) tile_data_pointer (tile, ix % TILE_WIDTH, iy % TILE_HEIGHT));
|
||||
value = cos (0.5 * M_PI * value);
|
||||
tile_release (tile, FALSE);
|
||||
|
|
|
@ -360,7 +360,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);
|
||||
tile = tile_manager_get_tile (gimage_composite (gdisp->gimage), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -369,7 +369,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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
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);
|
||||
|
@ -931,7 +931,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = bcd->gimage->height * bevent->y / bcd->preview->requisition.height;
|
||||
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);
|
||||
tile = tile_manager_get_tile (gimage_composite (bcd->gimage), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
else
|
||||
|
@ -943,7 +943,7 @@ by_color_select_preview_button_press (ByColorDialog *bcd,
|
|||
y = drawable_height (drawable) * bevent->y / bcd->preview->requisition.height - offy;
|
||||
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);
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y, TRUE, FALSE);
|
||||
col = tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT);
|
||||
}
|
||||
|
||||
|
|
|
@ -248,9 +248,9 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -258,14 +258,14 @@ flip_tool_flip_horz (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].width; i++)
|
||||
for (i = 0; i < orig->width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->levels[0].width - i - 1), 0, 1, orig->levels[0].height, TRUE);
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, (orig->width - i - 1), 0, 1, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
@ -289,9 +289,9 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
|
||||
if (flip > 0)
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->levels[0].width, orig->levels[0].height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->levels[0].width, orig->levels[0].height, TRUE);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
pixel_region_init (&srcPR, orig, 0, 0, orig->width, orig->height, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, 0, orig->width, orig->height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
|
@ -299,14 +299,14 @@ flip_tool_flip_vert (GImage *gimage,
|
|||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig->levels[0].width, orig->levels[0].height, orig->levels[0].bpp);
|
||||
new = tile_manager_new (orig->width, orig->height, orig->bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
|
||||
for (i = 0; i < orig->levels[0].height; i++)
|
||||
for (i = 0; i < orig->height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->levels[0].width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->levels[0].height - i - 1), orig->levels[0].width, 1, TRUE);
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig->width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new, 0, (orig->height - i - 1), orig->width, 1, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue