mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 22:34:37 +00:00
app/convert.c app/floating_sel.c app/gimage_mask.c app/gimpimage.c
2001-01-23 Sven Neumann <sven@gimp.org> * app/convert.c * app/floating_sel.c * app/gimage_mask.c * app/gimpimage.c * app/global_edit.c * app/image_map.c * app/image_new.c * app/layer.c * app/paint_funcs.c * app/pixel_region.c * app/tile_manager.c * app/tile_manager.h * app/tile_manager_pvt.h * app/undo.c * app/xcf.c * app/pdb/tools_cmds.c * app/tools/flip_tool.c * app/tools/perspective_tool.c * app/tools/rotate_tool.c * app/tools/scale_tool.c * app/tools/shear_tool.c * app/tools/text_tool.c * app/tools/transform_core.c * tools/pdbgen/pdb/tools.pdb: made all files execpt xcf.c use the TileManager accessor functions instead of accessing the TileManager struct directly.
This commit is contained in:
parent
f4d65cdfe3
commit
b102101e94
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2001-01-23 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/convert.c
|
||||
* app/floating_sel.c
|
||||
* app/gimage_mask.c
|
||||
* app/gimpimage.c
|
||||
* app/global_edit.c
|
||||
* app/image_map.c
|
||||
* app/image_new.c
|
||||
* app/layer.c
|
||||
* app/paint_funcs.c
|
||||
* app/pixel_region.c
|
||||
* app/tile_manager.c
|
||||
* app/tile_manager.h
|
||||
* app/tile_manager_pvt.h
|
||||
* app/undo.c
|
||||
* app/xcf.c
|
||||
* app/pdb/tools_cmds.c
|
||||
* app/tools/flip_tool.c
|
||||
* app/tools/perspective_tool.c
|
||||
* app/tools/rotate_tool.c
|
||||
* app/tools/scale_tool.c
|
||||
* app/tools/shear_tool.c
|
||||
* app/tools/text_tool.c
|
||||
* app/tools/transform_core.c
|
||||
* tools/pdbgen/pdb/tools.pdb: made all files execpt xcf.c use the
|
||||
TileManager accessor functions instead of accessing the TileManager
|
||||
struct directly.
|
||||
|
||||
2001-01-23 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* TODO.xml: updated, added sections about libgck and script-fu
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "gimprc.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
||||
|
@ -64,7 +63,7 @@ pixel_region_init (PixelRegion *PR,
|
|||
PR->tiles = tiles;
|
||||
PR->curtile = NULL;
|
||||
PR->data = NULL;
|
||||
PR->bytes = tiles->bpp;
|
||||
PR->bytes = tile_manager_bpp (tiles);
|
||||
PR->rowstride = PR->bytes * TILE_WIDTH;
|
||||
PR->x = x;
|
||||
PR->y = y;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
struct _TileManager
|
||||
{
|
||||
gint x, y; /* tile manager offsets */
|
||||
gint x, y; /* tile manager offsets */
|
||||
|
||||
gint width; /* the width of the tiled area */
|
||||
gint height; /* the height of the tiled area */
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include "tile_cache.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_swap.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h" /* ick. */
|
||||
|
||||
|
||||
|
@ -54,6 +54,8 @@ tile_manager_new (gint toplevel_width,
|
|||
width = toplevel_width;
|
||||
height = toplevel_height;
|
||||
|
||||
tm->x = 0;
|
||||
tm->y = 0;
|
||||
tm->width = width;
|
||||
tm->height = height;
|
||||
tm->bpp = bpp;
|
||||
|
@ -70,6 +72,8 @@ tile_manager_destroy (TileManager *tm)
|
|||
gint ntiles;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
if (tm->tiles)
|
||||
{
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
@ -91,6 +95,8 @@ void
|
|||
tile_manager_set_validate_proc (TileManager *tm,
|
||||
TileValidateProc proc)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->validate_proc = proc;
|
||||
}
|
||||
|
||||
|
@ -104,6 +110,8 @@ tile_manager_get_tile (TileManager *tm,
|
|||
{
|
||||
gint tile_num;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return NULL;
|
||||
|
@ -125,6 +133,8 @@ tile_manager_get (TileManager *tm,
|
|||
gint bottom_tile;
|
||||
gint i, j, k;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
|
@ -242,6 +252,8 @@ tile_manager_get_async (TileManager *tm,
|
|||
Tile *tile_ptr;
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
@ -255,6 +267,9 @@ void
|
|||
tile_manager_validate (TileManager *tm,
|
||||
Tile *tile)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (tile != NULL);
|
||||
|
||||
tile->valid = TRUE;
|
||||
|
||||
if (tm->validate_proc)
|
||||
|
@ -280,6 +295,9 @@ tile_manager_invalidate_tiles (TileManager *tm,
|
|||
gint row, col;
|
||||
gint num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (toplevel_tile != NULL);
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->ntile_cols;
|
||||
|
||||
|
@ -304,6 +322,9 @@ tile_invalidate_tile (Tile **tile_ptr,
|
|||
{
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tile_ptr != NULL);
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
@ -319,6 +340,9 @@ tile_invalidate (Tile **tile_ptr,
|
|||
{
|
||||
Tile *tile = *tile_ptr;
|
||||
|
||||
g_return_if_fail (tile_ptr != NULL);
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
TILE_MUTEX_LOCK (tile);
|
||||
|
||||
if (!tile->valid)
|
||||
|
@ -370,6 +394,9 @@ tile_manager_map_tile (TileManager *tm,
|
|||
gint tile_col;
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
{
|
||||
|
@ -397,6 +424,9 @@ tile_manager_map (TileManager *tm,
|
|||
gint bottom_tile;
|
||||
gint i, j, k;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
|
@ -471,7 +501,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* printf("}");fflush(stdout);*/
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
tile_manager_get_tile_num (TileManager *tm,
|
||||
gint xpixel,
|
||||
gint ypixel)
|
||||
|
@ -480,6 +510,8 @@ tile_manager_get_tile_num (TileManager *tm,
|
|||
gint tile_col;
|
||||
gint tile_num;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, -1);
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
return -1;
|
||||
|
@ -495,33 +527,65 @@ void
|
|||
tile_manager_set_user_data (TileManager *tm,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->user_data = user_data;
|
||||
}
|
||||
|
||||
gpointer
|
||||
tile_manager_get_user_data (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
return tm->user_data;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_width (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_width (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->width;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_height (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_height (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->height;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_bpp (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_bpp (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->bpp;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_get_offsets (const TileManager *tm,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
g_return_if_fail (x!= NULL && y != NULL);
|
||||
|
||||
*x = tm->x;
|
||||
*y = tm->y;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_offsets (TileManager *tm,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->x = x;
|
||||
tm->y = y;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
|
@ -530,6 +594,9 @@ tile_manager_get_tile_coordinates (TileManager *tm,
|
|||
{
|
||||
TileLink *tl;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (x != NULL && y != NULL);
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
|
@ -553,6 +620,10 @@ tile_manager_map_over_tile (TileManager *tm,
|
|||
{
|
||||
TileLink *tl;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (tile != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
|
|
|
@ -102,9 +102,16 @@ void tile_manager_set_user_data (TileManager *tm,
|
|||
gpointer user_data);
|
||||
gpointer tile_manager_get_user_data (const TileManager *tm);
|
||||
|
||||
gint tile_manager_level_width (const TileManager *tm);
|
||||
gint tile_manager_level_height (const TileManager *tm);
|
||||
gint tile_manager_level_bpp (const TileManager *tm);
|
||||
gint tile_manager_width (const TileManager *tm);
|
||||
gint tile_manager_height (const TileManager *tm);
|
||||
gint tile_manager_bpp (const TileManager *tm);
|
||||
|
||||
void tile_manager_get_offsets (const TileManager *tm,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void tile_manager_set_offsets (TileManager *tm,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
#include "palette_select.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h" /* ick ick ick. */
|
||||
|
||||
#include "tools/brightness_contrast.h"
|
||||
#include "tools/color_balance.h"
|
||||
|
@ -3523,7 +3522,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -3733,7 +3732,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -100,17 +98,19 @@ crop_buffer (TileManager *tiles,
|
|||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->bpp;
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR); pr != NULL; pr = pixel_regions_process (pr))
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
|
@ -138,18 +138,25 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tiles->width);
|
||||
y2 = CLAMP (y2 + 1, 0, tiles->height);
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
|
@ -173,13 +180,14 @@ crop_buffer (TileManager *tiles,
|
|||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles, x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
new_tiles->x = x1;
|
||||
new_tiles->y = y1;
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
|
@ -375,7 +383,9 @@ edit_paste_as_new (GImage *invoke,
|
|||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage = gimage_new (tile_manager_width (paste),
|
||||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
@ -833,19 +843,24 @@ static void
|
|||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles) return;
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
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);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
nb->name = g_strdup ((gchar *) name);
|
||||
named_buffers = g_slist_append (named_buffers, (void *) nb);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -100,17 +98,19 @@ crop_buffer (TileManager *tiles,
|
|||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->bpp;
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR); pr != NULL; pr = pixel_regions_process (pr))
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
|
@ -138,18 +138,25 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tiles->width);
|
||||
y2 = CLAMP (y2 + 1, 0, tiles->height);
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
|
@ -173,13 +180,14 @@ crop_buffer (TileManager *tiles,
|
|||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles, x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
new_tiles->x = x1;
|
||||
new_tiles->y = y1;
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
|
@ -375,7 +383,9 @@ edit_paste_as_new (GImage *invoke,
|
|||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage = gimage_new (tile_manager_width (paste),
|
||||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
@ -833,19 +843,24 @@ static void
|
|||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles) return;
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
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);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
nb->name = g_strdup ((gchar *) name);
|
||||
named_buffers = g_slist_append (named_buffers, (void *) nb);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
#include "palette_select.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h" /* ick ick ick. */
|
||||
|
||||
#include "tools/brightness_contrast.h"
|
||||
#include "tools/color_balance.h"
|
||||
|
@ -3523,7 +3522,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -3733,7 +3732,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/paint_core.h"
|
||||
|
@ -270,8 +269,7 @@ gimage_mask_extract (GImage *gimage,
|
|||
|
||||
/* Allocate the temp buffer */
|
||||
tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
|
||||
tiles->x = x1 + off_x;
|
||||
tiles->y = y1 + off_y;
|
||||
tile_manager_set_offsets (tiles, x1 + off_x, y1 + off_y);
|
||||
|
||||
/* configure the pixel regions */
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
|
@ -296,8 +294,9 @@ gimage_mask_extract (GImage *gimage,
|
|||
channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* Update the region */
|
||||
gdisplays_update_area (gimage, tiles->x, tiles->y,
|
||||
tiles->width, tiles->height);
|
||||
gdisplays_update_area (gimage,
|
||||
x1 + off_x, y1 + off_y,
|
||||
(x2 - x1), (y2 - y1));
|
||||
|
||||
/* Invalidate the preview */
|
||||
gimp_drawable_invalidate_preview (drawable, TRUE);
|
||||
|
@ -378,8 +377,9 @@ gimage_mask_float (GImage *gimage,
|
|||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* Set the offsets */
|
||||
GIMP_DRAWABLE (layer)->offset_x = tiles->x + off_x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = tiles->y + off_y;
|
||||
tile_manager_get_offsets (tiles, &x1, &y1);
|
||||
GIMP_DRAWABLE (layer)->offset_x = x1 + off_x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = y1 + off_y;
|
||||
|
||||
/* Free the temp buffer */
|
||||
tile_manager_destroy (tiles);
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "path_transform.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -862,8 +861,11 @@ undo_push_image_mod (GImage *gimage,
|
|||
y2 = CLAMP (y2, 0, dheight);
|
||||
|
||||
tiles = (TileManager *) tiles_ptr;
|
||||
size = tiles->width * tiles->height *
|
||||
tiles->bpp + sizeof (gpointer) * 2;
|
||||
size =
|
||||
tile_manager_width (tiles) *
|
||||
tile_manager_height (tiles) *
|
||||
tile_manager_bpp (tiles) +
|
||||
sizeof (gpointer) * 2;
|
||||
|
||||
if ((new = undo_push (gimage, size, IMAGE_MOD_UNDO, TRUE)))
|
||||
{
|
||||
|
@ -911,8 +913,8 @@ undo_pop_image (GImage *gimage,
|
|||
|
||||
if (image_undo->sparse == FALSE)
|
||||
{
|
||||
w = tiles->width;
|
||||
h = tiles->height;
|
||||
w = tile_manager_width (tiles);
|
||||
h = tile_manager_height (tiles);
|
||||
|
||||
pixel_region_init (&PR1, tiles,
|
||||
0, 0, w, h, TRUE);
|
||||
|
@ -992,15 +994,17 @@ undo_push_mask (GImage *gimage,
|
|||
mask_undo = (MaskUndo *) mask_ptr;
|
||||
|
||||
if (mask_undo->tiles)
|
||||
size = mask_undo->tiles->width * mask_undo->tiles->height;
|
||||
size =
|
||||
tile_manager_width (mask_undo->tiles) *
|
||||
tile_manager_height (mask_undo->tiles);
|
||||
else
|
||||
size = 0;
|
||||
|
||||
if ((new = undo_push (gimage, size, MASK_UNDO, FALSE)))
|
||||
{
|
||||
new->data = mask_undo;
|
||||
new->pop_func = undo_pop_mask;
|
||||
new->free_func = undo_free_mask;
|
||||
new->data = mask_undo;
|
||||
new->pop_func = undo_pop_mask;
|
||||
new->free_func = undo_free_mask;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1056,8 +1060,8 @@ undo_pop_mask (GImage *gimage,
|
|||
|
||||
if (mask_undo->tiles)
|
||||
{
|
||||
width = mask_undo->tiles->width;
|
||||
height = mask_undo->tiles->height;
|
||||
width = tile_manager_width (mask_undo->tiles);
|
||||
height = tile_manager_height (mask_undo->tiles);
|
||||
pixel_region_init (&srcPR, mask_undo->tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, GIMP_DRAWABLE (sel_mask)->tiles,
|
||||
|
@ -1540,11 +1544,13 @@ undo_push_layer_mod (GImage *gimage,
|
|||
|
||||
layer = (Layer *) layer_ptr;
|
||||
|
||||
tiles = GIMP_DRAWABLE (layer)->tiles;
|
||||
tiles->x = GIMP_DRAWABLE (layer)->offset_x;
|
||||
tiles->y = GIMP_DRAWABLE (layer)->offset_y;
|
||||
size = (GIMP_DRAWABLE (layer)->width * GIMP_DRAWABLE (layer)->height *
|
||||
GIMP_DRAWABLE (layer)->bytes + sizeof (gpointer) * 3);
|
||||
tiles = GIMP_DRAWABLE (layer)->tiles;
|
||||
tile_manager_set_offsets (tiles,
|
||||
GIMP_DRAWABLE (layer)->offset_x,
|
||||
GIMP_DRAWABLE (layer)->offset_y);
|
||||
|
||||
size = (GIMP_DRAWABLE (layer)->width * GIMP_DRAWABLE (layer)->height *
|
||||
GIMP_DRAWABLE (layer)->bytes + sizeof (gpointer) * 3);
|
||||
|
||||
if ((new = undo_push (gimage, size, LAYER_MOD, TRUE)))
|
||||
{
|
||||
|
@ -1593,25 +1599,28 @@ undo_pop_layer_mod (GImage *gimage,
|
|||
|
||||
/* Create a tile manager to store the current layer contents */
|
||||
temp = GIMP_DRAWABLE (layer)->tiles;
|
||||
temp->x = GIMP_DRAWABLE (layer)->offset_x;
|
||||
temp->y = GIMP_DRAWABLE (layer)->offset_y;
|
||||
tile_manager_set_offsets (temp,
|
||||
GIMP_DRAWABLE (layer)->offset_x,
|
||||
GIMP_DRAWABLE (layer)->offset_y);
|
||||
layer_type = (glong) data[2];
|
||||
data[2] = (gpointer) ((glong) GIMP_DRAWABLE (layer)->type);
|
||||
|
||||
/* restore the layer's data */
|
||||
GIMP_DRAWABLE (layer)->tiles = tiles;
|
||||
GIMP_DRAWABLE (layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = tiles->y;
|
||||
GIMP_DRAWABLE (layer)->width = tiles->width;
|
||||
GIMP_DRAWABLE (layer)->height = tiles->height;
|
||||
GIMP_DRAWABLE (layer)->bytes = tiles->bpp;
|
||||
GIMP_DRAWABLE (layer)->width = tile_manager_width (tiles);
|
||||
GIMP_DRAWABLE (layer)->height = tile_manager_height (tiles);
|
||||
GIMP_DRAWABLE (layer)->bytes = tile_manager_bpp (tiles);
|
||||
GIMP_DRAWABLE (layer)->type = layer_type;
|
||||
GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type);
|
||||
tile_manager_get_offsets (tiles,
|
||||
&(GIMP_DRAWABLE (layer)->offset_x),
|
||||
&(GIMP_DRAWABLE (layer)->offset_y));
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
GIMP_DRAWABLE (layer->mask)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE (layer->mask)->offset_y = tiles->y;
|
||||
tile_manager_get_offsets (tiles,
|
||||
&(GIMP_DRAWABLE (layer->mask)->offset_x),
|
||||
&(GIMP_DRAWABLE (layer->mask)->offset_y));
|
||||
}
|
||||
|
||||
/* If the layer type changed, update the gdisplay titles */
|
||||
|
@ -1928,10 +1937,11 @@ undo_pop_channel_mod (GImage *gimage,
|
|||
|
||||
temp = GIMP_DRAWABLE (channel)->tiles;
|
||||
GIMP_DRAWABLE (channel)->tiles = tiles;
|
||||
GIMP_DRAWABLE (channel)->width = tiles->width;
|
||||
GIMP_DRAWABLE (channel)->height = tiles->height;
|
||||
GIMP_CHANNEL (channel)->bounds_known = FALSE; /* #4840. set to False because bounds
|
||||
reflect previous tile set */
|
||||
GIMP_DRAWABLE (channel)->width = tile_manager_width (tiles);
|
||||
GIMP_DRAWABLE (channel)->height = tile_manager_height (tiles);
|
||||
GIMP_CHANNEL (channel)->bounds_known = FALSE;
|
||||
/* #4840. set to FALSE because bounds
|
||||
reflect previous tile set */
|
||||
|
||||
/* Set the new buffer */
|
||||
data[1] = temp;
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "pixel_region.h"
|
||||
#include "tile.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
|
||||
#define WAITING 0
|
||||
|
@ -133,6 +132,8 @@ image_map_apply (ImageMap image_map,
|
|||
{
|
||||
_ImageMap *_image_map;
|
||||
gint x1, y1, x2, y2;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
|
||||
_image_map = (_ImageMap *) image_map;
|
||||
_image_map->apply_func = apply_func;
|
||||
|
@ -154,16 +155,24 @@ image_map_apply (ImageMap image_map,
|
|||
gimp_drawable_mask_bounds (_image_map->drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
/* If undo tiles don't exist, or change size, (re)allocate */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &offset_x, &offset_y);
|
||||
width = tile_manager_width (_image_map->undo_tiles);
|
||||
height = tile_manager_height (_image_map->undo_tiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
offset_x = offset_y = width = height = 0;
|
||||
}
|
||||
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->x != x1 ||
|
||||
_image_map->undo_tiles->y != y1 ||
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
offset_x != x1 || offset_y != y1 ||
|
||||
width != (x2 - x1) || height != (y2 - y1))
|
||||
{
|
||||
/* If either the extents changed or the tiles don't exist, allocate new */
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
width != (x2 - x1) || height != (y2 - y1))
|
||||
{
|
||||
/* Destroy old tiles--If they exist */
|
||||
if (_image_map->undo_tiles != NULL)
|
||||
|
@ -185,23 +194,17 @@ image_map_apply (ImageMap image_map,
|
|||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
|
||||
/* Set the offsets */
|
||||
_image_map->undo_tiles->x = x1;
|
||||
_image_map->undo_tiles->y = y1;
|
||||
tile_manager_set_offsets (_image_map->undo_tiles, x1, y1);
|
||||
}
|
||||
else /* _image_map->undo_tiles exist AND drawable dimensions have not changed... */
|
||||
{
|
||||
/* Reset to initial drawable conditions. */
|
||||
/* Copy from the backup undo tiles to the drawable */
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&_image_map->destPR,
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
offset_x, offset_y, width, height, TRUE);
|
||||
|
||||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
}
|
||||
|
@ -249,10 +252,9 @@ image_map_commit (ImageMap image_map)
|
|||
/* Register an undo step */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
x1 = _image_map->undo_tiles->x;
|
||||
y1 = _image_map->undo_tiles->y;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->height;
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &x1, &y1);
|
||||
x2 = x1 + tile_manager_width (_image_map->undo_tiles);
|
||||
y2 = y1 + tile_manager_height (_image_map->undo_tiles);
|
||||
drawable_apply_image (_image_map->drawable,
|
||||
x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
@ -284,24 +286,28 @@ image_map_clear (ImageMap image_map)
|
|||
/* restore the original image */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &offset_x, &offset_y);
|
||||
width = tile_manager_width (_image_map->undo_tiles);
|
||||
height = tile_manager_height (_image_map->undo_tiles),
|
||||
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR,
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
offset_x, offset_y, width, height, TRUE);
|
||||
|
||||
/* if the user has changed the image depth get out quickly */
|
||||
if (destPR.bytes != srcPR.bytes)
|
||||
{
|
||||
g_message ("image depth change, unable to restore original image");
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
gimp_image_undo_thaw(_image_map->gdisp->gimage);
|
||||
gimp_image_undo_thaw (_image_map->gdisp->gimage);
|
||||
gdisplay_set_menu_sensitivity (_image_map->gdisp);
|
||||
g_free (_image_map);
|
||||
return;
|
||||
|
@ -310,10 +316,7 @@ image_map_clear (ImageMap image_map)
|
|||
copy_region (&srcPR, &destPR);
|
||||
|
||||
/* Update the area */
|
||||
drawable_update (_image_map->drawable,
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height);
|
||||
drawable_update (_image_map->drawable, offset_x, offset_y, width, height);
|
||||
|
||||
/* Free the undo_tiles tile manager */
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
|
@ -357,9 +360,9 @@ image_map_get_color_at (ImageMap image_map,
|
|||
if (!image_map ||
|
||||
(!gimp_drawable_gimage (_image_map->drawable) &&
|
||||
gimp_drawable_is_indexed (_image_map->drawable)) ||
|
||||
x < 0 || y < 0 ||
|
||||
x >= _image_map->undo_tiles->width ||
|
||||
y >= _image_map->undo_tiles->height)
|
||||
x < 0 || y < 0 ||
|
||||
x >= tile_manager_width (_image_map->undo_tiles) ||
|
||||
y >= tile_manager_height (_image_map->undo_tiles))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h" /* ick. */
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -251,9 +249,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->width != gimp_drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->height != gimp_drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->bpp != gimp_drawable_bytes (layer->fs.drawable))
|
||||
if ((tile_manager_width (layer->fs.backing_store) != gimp_drawable_width (GIMP_DRAWABLE(layer))) ||
|
||||
(tile_manager_height (layer->fs.backing_store) != gimp_drawable_height (GIMP_DRAWABLE(layer))) ||
|
||||
(tile_manager_bpp (layer->fs.backing_store) != gimp_drawable_bytes (layer->fs.drawable)))
|
||||
{
|
||||
/* free the backing store and allocate anew */
|
||||
tile_manager_destroy (layer->fs.backing_store);
|
||||
|
|
|
@ -433,8 +433,8 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0,
|
||||
tile_manager_level_width (tiles),
|
||||
tile_manager_level_height (tiles),
|
||||
tile_manager_width (tiles),
|
||||
tile_manager_height (tiles),
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer)
|
||||
|
@ -455,16 +455,16 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
GIMP_DRAWABLE (new_layer)->height,
|
||||
FALSE);
|
||||
|
||||
if ((tile_manager_level_bpp (tiles) == 4 &&
|
||||
if ((tile_manager_bpp (tiles) == 4 &&
|
||||
GIMP_DRAWABLE (new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tile_manager_level_bpp (tiles) == 2 &&
|
||||
(tile_manager_bpp (tiles) == 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),
|
||||
(tile_manager_level_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
(tile_manager_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h" /* ick. */
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -251,9 +249,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->width != gimp_drawable_width (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->height != gimp_drawable_height (GIMP_DRAWABLE(layer)) ||
|
||||
layer->fs.backing_store->bpp != gimp_drawable_bytes (layer->fs.drawable))
|
||||
if ((tile_manager_width (layer->fs.backing_store) != gimp_drawable_width (GIMP_DRAWABLE(layer))) ||
|
||||
(tile_manager_height (layer->fs.backing_store) != gimp_drawable_height (GIMP_DRAWABLE(layer))) ||
|
||||
(tile_manager_bpp (layer->fs.backing_store) != gimp_drawable_bytes (layer->fs.drawable)))
|
||||
{
|
||||
/* free the backing store and allocate anew */
|
||||
tile_manager_destroy (layer->fs.backing_store);
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "paint_funcs.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools/paint_core.h"
|
||||
|
@ -270,8 +269,7 @@ gimage_mask_extract (GImage *gimage,
|
|||
|
||||
/* Allocate the temp buffer */
|
||||
tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
|
||||
tiles->x = x1 + off_x;
|
||||
tiles->y = y1 + off_y;
|
||||
tile_manager_set_offsets (tiles, x1 + off_x, y1 + off_y);
|
||||
|
||||
/* configure the pixel regions */
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
|
@ -296,8 +294,9 @@ gimage_mask_extract (GImage *gimage,
|
|||
channel_clear (gimp_image_get_mask (gimage));
|
||||
|
||||
/* Update the region */
|
||||
gdisplays_update_area (gimage, tiles->x, tiles->y,
|
||||
tiles->width, tiles->height);
|
||||
gdisplays_update_area (gimage,
|
||||
x1 + off_x, y1 + off_y,
|
||||
(x2 - x1), (y2 - y1));
|
||||
|
||||
/* Invalidate the preview */
|
||||
gimp_drawable_invalidate_preview (drawable, TRUE);
|
||||
|
@ -378,8 +377,9 @@ gimage_mask_float (GImage *gimage,
|
|||
OPAQUE_OPACITY, NORMAL_MODE);
|
||||
|
||||
/* Set the offsets */
|
||||
GIMP_DRAWABLE (layer)->offset_x = tiles->x + off_x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = tiles->y + off_y;
|
||||
tile_manager_get_offsets (tiles, &x1, &y1);
|
||||
GIMP_DRAWABLE (layer)->offset_x = x1 + off_x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = y1 + off_y;
|
||||
|
||||
/* Free the temp buffer */
|
||||
tile_manager_destroy (tiles);
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
#include "palette_select.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h" /* ick ick ick. */
|
||||
|
||||
#include "tools/brightness_contrast.h"
|
||||
#include "tools/color_balance.h"
|
||||
|
@ -3523,7 +3522,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
@ -3733,7 +3732,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->bpp;
|
||||
dest_bytes = tile_manager_bpp (new_tiles);
|
||||
width = GIMP_DRAWABLE(layer)->width;
|
||||
height = GIMP_DRAWABLE(layer)->height;
|
||||
|
||||
|
|
|
@ -767,9 +767,9 @@ gimp_image_shadow (GimpImage *gimage,
|
|||
gint bpp)
|
||||
{
|
||||
if (gimage->shadow &&
|
||||
((width != tile_manager_level_width (gimage->shadow)) ||
|
||||
(height != tile_manager_level_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_level_bpp (gimage->shadow))))
|
||||
((width != tile_manager_width (gimage->shadow)) ||
|
||||
(height != tile_manager_height (gimage->shadow)) ||
|
||||
(bpp != tile_manager_bpp (gimage->shadow))))
|
||||
gimp_image_free_shadow (gimage);
|
||||
else if (gimage->shadow)
|
||||
return gimage->shadow;
|
||||
|
@ -3796,8 +3796,8 @@ gimp_image_projection (GimpImage *gimage)
|
|||
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL);
|
||||
|
||||
if ((gimage->projection == NULL) ||
|
||||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_level_height (gimage->projection) != gimage->height))
|
||||
(tile_manager_width (gimage->projection) != gimage->width) ||
|
||||
(tile_manager_height (gimage->projection) != gimage->height))
|
||||
{
|
||||
gimp_image_allocate_projection (gimage);
|
||||
}
|
||||
|
|
|
@ -433,8 +433,8 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0,
|
||||
tile_manager_level_width (tiles),
|
||||
tile_manager_level_height (tiles),
|
||||
tile_manager_width (tiles),
|
||||
tile_manager_height (tiles),
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer)
|
||||
|
@ -455,16 +455,16 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
GIMP_DRAWABLE (new_layer)->height,
|
||||
FALSE);
|
||||
|
||||
if ((tile_manager_level_bpp (tiles) == 4 &&
|
||||
if ((tile_manager_bpp (tiles) == 4 &&
|
||||
GIMP_DRAWABLE (new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tile_manager_level_bpp (tiles) == 2 &&
|
||||
(tile_manager_bpp (tiles) == 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),
|
||||
(tile_manager_level_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
(tile_manager_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -100,17 +98,19 @@ crop_buffer (TileManager *tiles,
|
|||
void *pr;
|
||||
guchar black[MAX_CHANNELS] = { 0, 0, 0, 0 };
|
||||
|
||||
bytes = tiles->bpp;
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
alpha = bytes - 1;
|
||||
|
||||
/* go through and calculate the bounds */
|
||||
x1 = tiles->width;
|
||||
y1 = tiles->height;
|
||||
x1 = tile_manager_width (tiles);
|
||||
y1 = tile_manager_height (tiles);
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
|
||||
pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
|
||||
for (pr = pixel_regions_register (1, &PR); pr != NULL; pr = pixel_regions_process (pr))
|
||||
for (pr = pixel_regions_register (1, &PR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
data = PR.data + alpha;
|
||||
ex = PR.x + PR.w;
|
||||
|
@ -138,18 +138,25 @@ crop_buffer (TileManager *tiles,
|
|||
}
|
||||
}
|
||||
|
||||
x2 = CLAMP (x2 + 1, 0, tiles->width);
|
||||
y2 = CLAMP (y2 + 1, 0, tiles->height);
|
||||
x2 = CLAMP (x2 + 1, 0, tile_manager_width (tiles));
|
||||
y2 = CLAMP (y2 + 1, 0, tile_manager_height (tiles));
|
||||
|
||||
empty = (x1 == tiles->width && y1 == tiles->height);
|
||||
empty = (x1 == tile_manager_width (tiles) &&
|
||||
y1 == tile_manager_height (tiles));
|
||||
|
||||
/* If there are no visible pixels, return NULL */
|
||||
if (empty)
|
||||
new_tiles = NULL;
|
||||
{
|
||||
new_tiles = NULL;
|
||||
}
|
||||
/* If no cropping, return original buffer */
|
||||
else if (x1 == 0 && y1 == 0 && x2 == tiles->width &&
|
||||
y2 == tiles->height && border == 0)
|
||||
new_tiles = tiles;
|
||||
else if (x1 == 0 && y1 == 0 &&
|
||||
x2 == tile_manager_width (tiles) &&
|
||||
y2 == tile_manager_height (tiles) &&
|
||||
border == 0)
|
||||
{
|
||||
new_tiles = tiles;
|
||||
}
|
||||
/* Otherwise, crop the original area */
|
||||
else
|
||||
{
|
||||
|
@ -173,13 +180,14 @@ crop_buffer (TileManager *tiles,
|
|||
color_region (&destPR, black);
|
||||
}
|
||||
|
||||
pixel_region_init (&srcPR, tiles, x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles, border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
pixel_region_init (&srcPR, tiles,
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, new_tiles,
|
||||
border, border, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
new_tiles->x = x1;
|
||||
new_tiles->y = y1;
|
||||
tile_manager_set_offsets (new_tiles, x1, y1);
|
||||
}
|
||||
|
||||
return new_tiles;
|
||||
|
@ -375,7 +383,9 @@ edit_paste_as_new (GImage *invoke,
|
|||
return FALSE;
|
||||
|
||||
/* create a new image (always of type RGB) */
|
||||
gimage = gimage_new (paste->width, paste->height, RGB);
|
||||
gimage = gimage_new (tile_manager_width (paste),
|
||||
tile_manager_height (paste),
|
||||
RGB);
|
||||
gimp_image_undo_disable (gimage);
|
||||
gimp_image_set_resolution (gimage, invoke->xresolution, invoke->yresolution);
|
||||
gimp_image_set_unit (gimage, invoke->unit);
|
||||
|
@ -833,19 +843,24 @@ static void
|
|||
new_named_buffer (TileManager *tiles,
|
||||
gchar *name)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
PixelRegion srcPR, destPR;
|
||||
NamedBuffer *nb;
|
||||
gint width, height;
|
||||
|
||||
if (! tiles) return;
|
||||
if (! tiles)
|
||||
return;
|
||||
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
|
||||
nb = (NamedBuffer *) g_malloc (sizeof (NamedBuffer));
|
||||
|
||||
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);
|
||||
nb->buf = tile_manager_new (width, height, tile_manager_bpp (tiles));
|
||||
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, nb->buf, 0, 0, width, height, TRUE);
|
||||
copy_region (&srcPR, &destPR);
|
||||
|
||||
nb->name = g_strdup ((char *) name);
|
||||
nb->name = g_strdup ((gchar *) name);
|
||||
named_buffers = g_slist_append (named_buffers, (void *) nb);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "pixel_region.h"
|
||||
#include "tile.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
|
||||
#define WAITING 0
|
||||
|
@ -133,6 +132,8 @@ image_map_apply (ImageMap image_map,
|
|||
{
|
||||
_ImageMap *_image_map;
|
||||
gint x1, y1, x2, y2;
|
||||
gint offset_x, offset_y;
|
||||
gint width, height;
|
||||
|
||||
_image_map = (_ImageMap *) image_map;
|
||||
_image_map->apply_func = apply_func;
|
||||
|
@ -154,16 +155,24 @@ image_map_apply (ImageMap image_map,
|
|||
gimp_drawable_mask_bounds (_image_map->drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
/* If undo tiles don't exist, or change size, (re)allocate */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &offset_x, &offset_y);
|
||||
width = tile_manager_width (_image_map->undo_tiles);
|
||||
height = tile_manager_height (_image_map->undo_tiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
offset_x = offset_y = width = height = 0;
|
||||
}
|
||||
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->x != x1 ||
|
||||
_image_map->undo_tiles->y != y1 ||
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
offset_x != x1 || offset_y != y1 ||
|
||||
width != (x2 - x1) || height != (y2 - y1))
|
||||
{
|
||||
/* If either the extents changed or the tiles don't exist, allocate new */
|
||||
if (!_image_map->undo_tiles ||
|
||||
_image_map->undo_tiles->width != (x2 - x1) ||
|
||||
_image_map->undo_tiles->height != (y2 - y1))
|
||||
width != (x2 - x1) || height != (y2 - y1))
|
||||
{
|
||||
/* Destroy old tiles--If they exist */
|
||||
if (_image_map->undo_tiles != NULL)
|
||||
|
@ -185,23 +194,17 @@ image_map_apply (ImageMap image_map,
|
|||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
|
||||
/* Set the offsets */
|
||||
_image_map->undo_tiles->x = x1;
|
||||
_image_map->undo_tiles->y = y1;
|
||||
tile_manager_set_offsets (_image_map->undo_tiles, x1, y1);
|
||||
}
|
||||
else /* _image_map->undo_tiles exist AND drawable dimensions have not changed... */
|
||||
{
|
||||
/* Reset to initial drawable conditions. */
|
||||
/* Copy from the backup undo tiles to the drawable */
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&_image_map->srcPR, _image_map->undo_tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&_image_map->destPR,
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
offset_x, offset_y, width, height, TRUE);
|
||||
|
||||
copy_region (&_image_map->srcPR, &_image_map->destPR);
|
||||
}
|
||||
|
@ -249,10 +252,9 @@ image_map_commit (ImageMap image_map)
|
|||
/* Register an undo step */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
x1 = _image_map->undo_tiles->x;
|
||||
y1 = _image_map->undo_tiles->y;
|
||||
x2 = _image_map->undo_tiles->x + _image_map->undo_tiles->width;
|
||||
y2 = _image_map->undo_tiles->y + _image_map->undo_tiles->height;
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &x1, &y1);
|
||||
x2 = x1 + tile_manager_width (_image_map->undo_tiles);
|
||||
y2 = y1 + tile_manager_height (_image_map->undo_tiles);
|
||||
drawable_apply_image (_image_map->drawable,
|
||||
x1, y1, x2, y2, _image_map->undo_tiles, FALSE);
|
||||
}
|
||||
|
@ -284,24 +286,28 @@ image_map_clear (ImageMap image_map)
|
|||
/* restore the original image */
|
||||
if (_image_map->undo_tiles)
|
||||
{
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
tile_manager_get_offsets (_image_map->undo_tiles, &offset_x, &offset_y);
|
||||
width = tile_manager_width (_image_map->undo_tiles);
|
||||
height = tile_manager_height (_image_map->undo_tiles),
|
||||
|
||||
/* Copy from the drawable to the tiles */
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles, 0, 0,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
FALSE);
|
||||
pixel_region_init (&srcPR, _image_map->undo_tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR,
|
||||
gimp_drawable_data (_image_map->drawable),
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height,
|
||||
TRUE);
|
||||
offset_x, offset_y, width, height, TRUE);
|
||||
|
||||
/* if the user has changed the image depth get out quickly */
|
||||
if (destPR.bytes != srcPR.bytes)
|
||||
{
|
||||
g_message ("image depth change, unable to restore original image");
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
gimp_image_undo_thaw(_image_map->gdisp->gimage);
|
||||
gimp_image_undo_thaw (_image_map->gdisp->gimage);
|
||||
gdisplay_set_menu_sensitivity (_image_map->gdisp);
|
||||
g_free (_image_map);
|
||||
return;
|
||||
|
@ -310,10 +316,7 @@ image_map_clear (ImageMap image_map)
|
|||
copy_region (&srcPR, &destPR);
|
||||
|
||||
/* Update the area */
|
||||
drawable_update (_image_map->drawable,
|
||||
_image_map->undo_tiles->x, _image_map->undo_tiles->y,
|
||||
_image_map->undo_tiles->width,
|
||||
_image_map->undo_tiles->height);
|
||||
drawable_update (_image_map->drawable, offset_x, offset_y, width, height);
|
||||
|
||||
/* Free the undo_tiles tile manager */
|
||||
tile_manager_destroy (_image_map->undo_tiles);
|
||||
|
@ -357,9 +360,9 @@ image_map_get_color_at (ImageMap image_map,
|
|||
if (!image_map ||
|
||||
(!gimp_drawable_gimage (_image_map->drawable) &&
|
||||
gimp_drawable_is_indexed (_image_map->drawable)) ||
|
||||
x < 0 || y < 0 ||
|
||||
x >= _image_map->undo_tiles->width ||
|
||||
y >= _image_map->undo_tiles->height)
|
||||
x < 0 || y < 0 ||
|
||||
x >= tile_manager_width (_image_map->undo_tiles) ||
|
||||
y >= tile_manager_height (_image_map->undo_tiles))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
#include "drawable.h"
|
||||
#include "gimprc.h"
|
||||
#include "file_new_dialog.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimage.h"
|
||||
#include "image_new.h"
|
||||
#include "layer.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "tile_manager.h"
|
||||
|
||||
#include "libgimp/gimpparasite.h"
|
||||
|
||||
|
@ -152,8 +152,8 @@ image_new_create_window (const GimpImageNewValues *create_values,
|
|||
*/
|
||||
if (global_buf && current_cut_buffer)
|
||||
{
|
||||
values->width = global_buf->width;
|
||||
values->height = global_buf->height;
|
||||
values->width = tile_manager_width (global_buf);
|
||||
values->height = tile_manager_height (global_buf);
|
||||
}
|
||||
|
||||
ui_new_image_window_create (values);
|
||||
|
|
10
app/layer.c
10
app/layer.c
|
@ -433,8 +433,8 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
|
||||
/* Create the new layer */
|
||||
new_layer = layer_new (0,
|
||||
tile_manager_level_width (tiles),
|
||||
tile_manager_level_height (tiles),
|
||||
tile_manager_width (tiles),
|
||||
tile_manager_height (tiles),
|
||||
layer_type, name, opacity, mode);
|
||||
|
||||
if (!new_layer)
|
||||
|
@ -455,16 +455,16 @@ layer_new_from_tiles (GimpImage *gimage,
|
|||
GIMP_DRAWABLE (new_layer)->height,
|
||||
FALSE);
|
||||
|
||||
if ((tile_manager_level_bpp (tiles) == 4 &&
|
||||
if ((tile_manager_bpp (tiles) == 4 &&
|
||||
GIMP_DRAWABLE (new_layer)->type == RGBA_GIMAGE) ||
|
||||
(tile_manager_level_bpp (tiles) == 2 &&
|
||||
(tile_manager_bpp (tiles) == 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),
|
||||
(tile_manager_level_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
(tile_manager_bpp (tiles) == 4) ? RGB : GRAY);
|
||||
|
||||
return new_layer;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "pixel_processor.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "pixel_processor.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "drawable.h"
|
||||
#include "gimpimage.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tools/airbrush.h"
|
||||
#include "tools/blend.h"
|
||||
#include "tools/bucket_fill.h"
|
||||
|
@ -2111,9 +2110,10 @@ perspective_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
double scalex, scaley;
|
||||
double trans_info[8];
|
||||
gint offset_x, offset_y;
|
||||
gdouble cx, cy;
|
||||
gdouble scalex, scaley;
|
||||
gdouble trans_info[8];
|
||||
GimpMatrix3 m, matrix;
|
||||
|
||||
drawable = gimp_drawable_get_by_ID (args[0].value.pdb_int);
|
||||
|
@ -2153,14 +2153,15 @@ perspective_invoker (Argument *args)
|
|||
*/
|
||||
perspective_find_transform (trans_info, m);
|
||||
|
||||
cx = float_tiles->x;
|
||||
cy = float_tiles->y;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = (gdouble) offset_x;
|
||||
cy = (gdouble) offset_y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = 1.0 / tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = 1.0 / tile_manager_height (float_tiles);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -2388,7 +2389,8 @@ rotate_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
gint offset_x, offset_y;
|
||||
gdouble cx, cy;
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
drawable = gimp_drawable_get_by_ID (args[0].value.pdb_int);
|
||||
|
@ -2409,8 +2411,9 @@ rotate_invoker (Argument *args)
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -2496,8 +2499,9 @@ scale_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
gboolean new_layer;
|
||||
double scalex, scaley;
|
||||
double trans_info[4];
|
||||
gint offset_x, offset_y;
|
||||
gdouble scalex, scaley;
|
||||
gdouble trans_info[4];
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
drawable = gimp_drawable_get_by_ID (args[0].value.pdb_int);
|
||||
|
@ -2528,16 +2532,18 @@ scale_invoker (Argument *args)
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
(gdouble) tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(gdouble) tile_manager_height (float_tiles);
|
||||
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, float_tiles->x, float_tiles->y);
|
||||
gimp_matrix3_translate (matrix, offset_x, offset_y);
|
||||
gimp_matrix3_scale (matrix, scalex, scaley);
|
||||
gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]);
|
||||
|
||||
|
@ -2639,7 +2645,8 @@ shear_invoker (Argument *args)
|
|||
GimpImage *gimage;
|
||||
TileManager *float_tiles, *new_tiles;
|
||||
gboolean new_layer;
|
||||
double cx, cy;
|
||||
gdouble cx, cy;
|
||||
gint offset_x, offset_y;
|
||||
GimpMatrix3 matrix;
|
||||
|
||||
drawable = gimp_drawable_get_by_ID (args[0].value.pdb_int);
|
||||
|
@ -2664,8 +2671,10 @@ shear_invoker (Argument *args)
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, -cx, -cy);
|
||||
|
@ -2675,9 +2684,9 @@ shear_invoker (Argument *args)
|
|||
ORIENTATION_UNKNOWN;
|
||||
|
||||
if (shear_type == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix3_xshear (matrix, magnitude / float_tiles->height);
|
||||
gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles));
|
||||
else if (shear_type == ORIENTATION_VERTICAL)
|
||||
gimp_matrix3_yshear (matrix, magnitude / float_tiles->width);
|
||||
gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles));
|
||||
gimp_matrix3_translate (matrix, +cx, +cy);
|
||||
|
||||
/* Shear the buffer */
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "gimprc.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
||||
|
@ -64,7 +63,7 @@ pixel_region_init (PixelRegion *PR,
|
|||
PR->tiles = tiles;
|
||||
PR->curtile = NULL;
|
||||
PR->data = NULL;
|
||||
PR->bytes = tiles->bpp;
|
||||
PR->bytes = tile_manager_bpp (tiles);
|
||||
PR->rowstride = PR->bytes * TILE_WIDTH;
|
||||
PR->x = x;
|
||||
PR->y = y;
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include "tile_cache.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_swap.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_pvt.h" /* ick. */
|
||||
|
||||
|
||||
|
@ -54,6 +54,8 @@ tile_manager_new (gint toplevel_width,
|
|||
width = toplevel_width;
|
||||
height = toplevel_height;
|
||||
|
||||
tm->x = 0;
|
||||
tm->y = 0;
|
||||
tm->width = width;
|
||||
tm->height = height;
|
||||
tm->bpp = bpp;
|
||||
|
@ -70,6 +72,8 @@ tile_manager_destroy (TileManager *tm)
|
|||
gint ntiles;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
if (tm->tiles)
|
||||
{
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
@ -91,6 +95,8 @@ void
|
|||
tile_manager_set_validate_proc (TileManager *tm,
|
||||
TileValidateProc proc)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->validate_proc = proc;
|
||||
}
|
||||
|
||||
|
@ -104,6 +110,8 @@ tile_manager_get_tile (TileManager *tm,
|
|||
{
|
||||
gint tile_num;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return NULL;
|
||||
|
@ -125,6 +133,8 @@ tile_manager_get (TileManager *tm,
|
|||
gint bottom_tile;
|
||||
gint i, j, k;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
|
@ -242,6 +252,8 @@ tile_manager_get_async (TileManager *tm,
|
|||
Tile *tile_ptr;
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
@ -255,6 +267,9 @@ void
|
|||
tile_manager_validate (TileManager *tm,
|
||||
Tile *tile)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (tile != NULL);
|
||||
|
||||
tile->valid = TRUE;
|
||||
|
||||
if (tm->validate_proc)
|
||||
|
@ -280,6 +295,9 @@ tile_manager_invalidate_tiles (TileManager *tm,
|
|||
gint row, col;
|
||||
gint num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (toplevel_tile != NULL);
|
||||
|
||||
col = toplevel_tile->tlink->tile_num % tm->ntile_cols;
|
||||
row = toplevel_tile->tlink->tile_num / tm->ntile_cols;
|
||||
|
||||
|
@ -304,6 +322,9 @@ tile_invalidate_tile (Tile **tile_ptr,
|
|||
{
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tile_ptr != NULL);
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
|
||||
if (tile_num < 0)
|
||||
return;
|
||||
|
@ -319,6 +340,9 @@ tile_invalidate (Tile **tile_ptr,
|
|||
{
|
||||
Tile *tile = *tile_ptr;
|
||||
|
||||
g_return_if_fail (tile_ptr != NULL);
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
TILE_MUTEX_LOCK (tile);
|
||||
|
||||
if (!tile->valid)
|
||||
|
@ -370,6 +394,9 @@ tile_manager_map_tile (TileManager *tm,
|
|||
gint tile_col;
|
||||
gint tile_num;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
{
|
||||
|
@ -397,6 +424,9 @@ tile_manager_map (TileManager *tm,
|
|||
gint bottom_tile;
|
||||
gint i, j, k;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
ntiles = tm->ntile_rows * tm->ntile_cols;
|
||||
|
||||
if ((tile_num < 0) || (tile_num >= ntiles))
|
||||
|
@ -471,7 +501,7 @@ tile_manager_map (TileManager *tm,
|
|||
/* printf("}");fflush(stdout);*/
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
tile_manager_get_tile_num (TileManager *tm,
|
||||
gint xpixel,
|
||||
gint ypixel)
|
||||
|
@ -480,6 +510,8 @@ tile_manager_get_tile_num (TileManager *tm,
|
|||
gint tile_col;
|
||||
gint tile_num;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, -1);
|
||||
|
||||
if ((xpixel < 0) || (xpixel >= tm->width) ||
|
||||
(ypixel < 0) || (ypixel >= tm->height))
|
||||
return -1;
|
||||
|
@ -495,33 +527,65 @@ void
|
|||
tile_manager_set_user_data (TileManager *tm,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->user_data = user_data;
|
||||
}
|
||||
|
||||
gpointer
|
||||
tile_manager_get_user_data (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, NULL);
|
||||
|
||||
return tm->user_data;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_width (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_width (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->width;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_height (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_height (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->height;
|
||||
}
|
||||
|
||||
int
|
||||
tile_manager_level_bpp (const TileManager *tm)
|
||||
gint
|
||||
tile_manager_bpp (const TileManager *tm)
|
||||
{
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
return tm->bpp;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_get_offsets (const TileManager *tm,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
g_return_if_fail (x!= NULL && y != NULL);
|
||||
|
||||
*x = tm->x;
|
||||
*y = tm->y;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_set_offsets (TileManager *tm,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
g_return_if_fail (tm != NULL);
|
||||
|
||||
tm->x = x;
|
||||
tm->y = y;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
|
@ -530,6 +594,9 @@ tile_manager_get_tile_coordinates (TileManager *tm,
|
|||
{
|
||||
TileLink *tl;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (x != NULL && y != NULL);
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
|
@ -553,6 +620,10 @@ tile_manager_map_over_tile (TileManager *tm,
|
|||
{
|
||||
TileLink *tl;
|
||||
|
||||
g_return_if_fail (tm != NULL);
|
||||
g_return_if_fail (tile != NULL);
|
||||
g_return_if_fail (srctile != NULL);
|
||||
|
||||
for (tl = tile->tlink; tl; tl = tl->next)
|
||||
{
|
||||
if (tl->tm == tm) break;
|
||||
|
|
|
@ -102,9 +102,16 @@ void tile_manager_set_user_data (TileManager *tm,
|
|||
gpointer user_data);
|
||||
gpointer tile_manager_get_user_data (const TileManager *tm);
|
||||
|
||||
gint tile_manager_level_width (const TileManager *tm);
|
||||
gint tile_manager_level_height (const TileManager *tm);
|
||||
gint tile_manager_level_bpp (const TileManager *tm);
|
||||
gint tile_manager_width (const TileManager *tm);
|
||||
gint tile_manager_height (const TileManager *tm);
|
||||
gint tile_manager_bpp (const TileManager *tm);
|
||||
|
||||
void tile_manager_get_offsets (const TileManager *tm,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void tile_manager_set_offsets (TileManager *tm,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
struct _TileManager
|
||||
{
|
||||
gint x, y; /* tile manager offsets */
|
||||
gint x, y; /* tile manager offsets */
|
||||
|
||||
gint width; /* the width of the tiled area */
|
||||
gint height; /* the height of the tiled area */
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "appenv.h"
|
||||
#include "cursorutil.h"
|
||||
#include "drawable.h"
|
||||
#include "flip_tool.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpimage.h"
|
||||
|
@ -38,7 +37,8 @@
|
|||
#include "pixel_region.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "flip_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
|
@ -266,14 +266,16 @@ flip_tool_flip (GimpImage *gimage,
|
|||
gint orig_width;
|
||||
gint orig_height;
|
||||
gint orig_bpp;
|
||||
gint orig_x, orig_y;
|
||||
gint i;
|
||||
|
||||
if (! orig)
|
||||
return NULL;
|
||||
|
||||
orig_width = tile_manager_level_width (orig);
|
||||
orig_height = tile_manager_level_height (orig);
|
||||
orig_bpp = tile_manager_level_bpp (orig);
|
||||
orig_width = tile_manager_width (orig);
|
||||
orig_height = tile_manager_height (orig);
|
||||
orig_bpp = tile_manager_bpp (orig);
|
||||
tile_manager_get_offsets (orig, &orig_x, &orig_y);
|
||||
|
||||
if (flip > 0)
|
||||
{
|
||||
|
@ -284,17 +286,15 @@ flip_tool_flip (GimpImage *gimage,
|
|||
0, 0, orig_width, orig_height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
tile_manager_set_offsets (new, orig_x, orig_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig_width, orig_height, orig_bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
tile_manager_set_offsets (new, orig_x, orig_y);
|
||||
|
||||
if (type == ORIENTATION_HORIZONTAL)
|
||||
for (i = 0; i < orig->width; i++)
|
||||
for (i = 0; i < orig_width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig_height, FALSE);
|
||||
pixel_region_init (&destPR, new,
|
||||
|
@ -302,7 +302,7 @@ flip_tool_flip (GimpImage *gimage,
|
|||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < orig->height; i++)
|
||||
for (i = 0; i < orig_height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig_width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new,
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "appenv.h"
|
||||
#include "cursorutil.h"
|
||||
#include "drawable.h"
|
||||
#include "flip_tool.h"
|
||||
#include "gdisplay.h"
|
||||
#include "gimage_mask.h"
|
||||
#include "gimpimage.h"
|
||||
|
@ -38,7 +37,8 @@
|
|||
#include "pixel_region.h"
|
||||
#include "temp_buf.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "flip_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
|
@ -266,14 +266,16 @@ flip_tool_flip (GimpImage *gimage,
|
|||
gint orig_width;
|
||||
gint orig_height;
|
||||
gint orig_bpp;
|
||||
gint orig_x, orig_y;
|
||||
gint i;
|
||||
|
||||
if (! orig)
|
||||
return NULL;
|
||||
|
||||
orig_width = tile_manager_level_width (orig);
|
||||
orig_height = tile_manager_level_height (orig);
|
||||
orig_bpp = tile_manager_level_bpp (orig);
|
||||
orig_width = tile_manager_width (orig);
|
||||
orig_height = tile_manager_height (orig);
|
||||
orig_bpp = tile_manager_bpp (orig);
|
||||
tile_manager_get_offsets (orig, &orig_x, &orig_y);
|
||||
|
||||
if (flip > 0)
|
||||
{
|
||||
|
@ -284,17 +286,15 @@ flip_tool_flip (GimpImage *gimage,
|
|||
0, 0, orig_width, orig_height, TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
tile_manager_set_offsets (new, orig_x, orig_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
new = tile_manager_new (orig_width, orig_height, orig_bpp);
|
||||
new->x = orig->x;
|
||||
new->y = orig->y;
|
||||
tile_manager_set_offsets (new, orig_x, orig_y);
|
||||
|
||||
if (type == ORIENTATION_HORIZONTAL)
|
||||
for (i = 0; i < orig->width; i++)
|
||||
for (i = 0; i < orig_width; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, i, 0, 1, orig_height, FALSE);
|
||||
pixel_region_init (&destPR, new,
|
||||
|
@ -302,7 +302,7 @@ flip_tool_flip (GimpImage *gimage,
|
|||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < orig->height; i++)
|
||||
for (i = 0; i < orig_height; i++)
|
||||
{
|
||||
pixel_region_init (&srcPR, orig, 0, i, orig_width, 1, FALSE);
|
||||
pixel_region_init (&destPR, new,
|
||||
|
|
|
@ -30,13 +30,14 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "perspective_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "perspective_tool.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -31,14 +31,15 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "rotate_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "rotate_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "scale_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "scale_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
#include "info_dialog.h"
|
||||
#include "shear_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "drawable.h"
|
||||
#include "edit_selection.h"
|
||||
#include "errors.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -48,13 +47,14 @@
|
|||
#include "pixel_region.h"
|
||||
#include "plug_in.h"
|
||||
#include "selection.h"
|
||||
#include "text_tool.h"
|
||||
#include "tile.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "edit_selection.h"
|
||||
#include "text_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
||||
|
@ -762,8 +762,10 @@ text_render (GimpImage *gimage,
|
|||
tile_manager_destroy (mask);
|
||||
|
||||
if (newmask &&
|
||||
(layer = layer_new (gimage, newmask->width,
|
||||
newmask->height, layer_type,
|
||||
(layer = layer_new (gimage,
|
||||
tile_manager_width (newmask),
|
||||
tile_manager_height (newmask),
|
||||
layer_type,
|
||||
_("Text Layer"), OPAQUE_OPACITY, NORMAL_MODE)))
|
||||
{
|
||||
/* color the layer buffer */
|
||||
|
|
|
@ -30,13 +30,14 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "perspective_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "perspective_tool.h"
|
||||
#include "tools.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
|
|
@ -31,14 +31,15 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "rotate_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "rotate_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
#include "gimpprogress.h"
|
||||
#include "gimpui.h"
|
||||
#include "info_dialog.h"
|
||||
#include "scale_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "scale_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
#include "info_dialog.h"
|
||||
#include "shear_tool.h"
|
||||
#include "selection.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "tile_manager_pvt.h"
|
||||
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#include "appenv.h"
|
||||
#include "drawable.h"
|
||||
#include "edit_selection.h"
|
||||
#include "errors.h"
|
||||
#include "floating_sel.h"
|
||||
#include "gdisplay.h"
|
||||
|
@ -48,13 +47,14 @@
|
|||
#include "pixel_region.h"
|
||||
#include "plug_in.h"
|
||||
#include "selection.h"
|
||||
#include "text_tool.h"
|
||||
#include "tile.h"
|
||||
#include "tile_manager.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "edit_selection.h"
|
||||
#include "text_tool.h"
|
||||
#include "tools.h"
|
||||
#include "tool_options.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "undo.h"
|
||||
|
||||
#include "libgimp/gimplimits.h"
|
||||
|
||||
|
@ -762,8 +762,10 @@ text_render (GimpImage *gimage,
|
|||
tile_manager_destroy (mask);
|
||||
|
||||
if (newmask &&
|
||||
(layer = layer_new (gimage, newmask->width,
|
||||
newmask->height, layer_type,
|
||||
(layer = layer_new (gimage,
|
||||
tile_manager_width (newmask),
|
||||
tile_manager_height (newmask),
|
||||
layer_type,
|
||||
_("Text Layer"), OPAQUE_OPACITY, NORMAL_MODE)))
|
||||
{
|
||||
/* color the layer buffer */
|
||||
|
|
|
@ -39,13 +39,13 @@
|
|||
#include "path_transform.h"
|
||||
#include "paint_funcs.h"
|
||||
#include "pixel_region.h"
|
||||
#include "undo.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile.h"
|
||||
|
||||
#include "transform_core.h"
|
||||
#include "transform_tool.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpmath.h"
|
||||
|
@ -124,7 +124,7 @@ pixel_surround_init (PixelSurround *ps,
|
|||
|
||||
ps->tile = NULL;
|
||||
ps->mgr = tm;
|
||||
ps->bpp = tile_manager_level_bpp (tm);
|
||||
ps->bpp = tile_manager_bpp (tm);
|
||||
ps->w = w;
|
||||
ps->h = h;
|
||||
/* make sure buffer is big enough */
|
||||
|
@ -1001,10 +1001,10 @@ transform_core_bounds (Tool *tool,
|
|||
/* find the boundaries */
|
||||
if (tiles)
|
||||
{
|
||||
transform_core->x1 = tiles->x;
|
||||
transform_core->y1 = tiles->y;
|
||||
transform_core->x2 = tiles->x + tiles->width;
|
||||
transform_core->y2 = tiles->y + tiles->height;
|
||||
tile_manager_get_offsets (tiles,
|
||||
&transform_core->x1, &transform_core->y1);
|
||||
transform_core->x2 = transform_core->x1 + tile_manager_width (tiles);
|
||||
transform_core->y2 = transform_core->y1 + tile_manager_height (tiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1206,7 +1206,7 @@ transform_core_do (GImage *gimage,
|
|||
}
|
||||
|
||||
/* enable rotating un-floated non-layers */
|
||||
if (float_tiles->bpp == 1)
|
||||
if (tile_manager_bpp (float_tiles) == 1)
|
||||
{
|
||||
bg_col[0] = OPAQUE_OPACITY;
|
||||
|
||||
|
@ -1232,10 +1232,9 @@ transform_core_do (GImage *gimage,
|
|||
|
||||
path_transform_current_path (gimage, matrix, FALSE);
|
||||
|
||||
x1 = float_tiles->x;
|
||||
y1 = float_tiles->y;
|
||||
x2 = x1 + float_tiles->width;
|
||||
y2 = y1 + float_tiles->height;
|
||||
tile_manager_get_offsets (float_tiles, &x1, &y1);
|
||||
x2 = x1 + tile_manager_width (float_tiles);
|
||||
y2 = y1 + tile_manager_height (float_tiles);
|
||||
|
||||
/* Find the bounding coordinates */
|
||||
if (alpha == 0 || (active_tool && transform_tool_clip ()))
|
||||
|
@ -1269,10 +1268,10 @@ transform_core_do (GImage *gimage,
|
|||
}
|
||||
|
||||
/* Get the new temporary buffer for the transformed result */
|
||||
tiles = tile_manager_new ((tx2 - tx1), (ty2 - ty1), float_tiles->bpp);
|
||||
tiles = tile_manager_new ((tx2 - tx1), (ty2 - ty1),
|
||||
tile_manager_bpp (float_tiles));
|
||||
pixel_region_init (&destPR, tiles, 0, 0, (tx2 - tx1), (ty2 - ty1), TRUE);
|
||||
tiles->x = tx1;
|
||||
tiles->y = ty1;
|
||||
tile_manager_set_offsets (tiles, tx1, ty1);
|
||||
|
||||
/* initialise the pixel_surround accessor */
|
||||
if (interpolation)
|
||||
|
@ -1292,9 +1291,9 @@ transform_core_do (GImage *gimage,
|
|||
pixel_surround_init (&surround, float_tiles, 1, 1, bg_col);
|
||||
}
|
||||
|
||||
width = tiles->width;
|
||||
height = tiles->height;
|
||||
bytes = tiles->bpp;
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
bytes = tile_manager_bpp (tiles);
|
||||
|
||||
dest = g_new (guchar, width * bytes);
|
||||
|
||||
|
@ -1619,8 +1618,10 @@ transform_core_paste (GImage *gimage,
|
|||
g_warning ("transform_core_paste: layer_new_frome_tiles() failed");
|
||||
return FALSE;
|
||||
}
|
||||
GIMP_DRAWABLE (layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = tiles->y;
|
||||
|
||||
tile_manager_get_offsets (tiles,
|
||||
&(GIMP_DRAWABLE (layer)->offset_x),
|
||||
&(GIMP_DRAWABLE (layer)->offset_y));
|
||||
|
||||
/* Start a group undo */
|
||||
undo_push_group_start (gimage, EDIT_PASTE_UNDO);
|
||||
|
@ -1667,11 +1668,11 @@ transform_core_paste (GImage *gimage,
|
|||
drawable->tiles = tiles;
|
||||
|
||||
/* Fill in the new layer's attributes */
|
||||
drawable->width = tiles->width;
|
||||
drawable->height = tiles->height;
|
||||
drawable->bytes = tiles->bpp;
|
||||
drawable->offset_x = tiles->x;
|
||||
drawable->offset_y = tiles->y;
|
||||
drawable->width = tile_manager_width (tiles);
|
||||
drawable->height = tile_manager_height (tiles);
|
||||
drawable->bytes = tile_manager_bpp (tiles);
|
||||
tile_manager_get_offsets (tiles,
|
||||
&drawable->offset_x, &drawable->offset_y);
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
|
68
app/undo.c
68
app/undo.c
|
@ -42,7 +42,6 @@
|
|||
#include "path_transform.h"
|
||||
#include "pixel_region.h"
|
||||
#include "tile_manager.h"
|
||||
#include "tile_manager_pvt.h"
|
||||
#include "tile.h"
|
||||
#include "undo.h"
|
||||
|
||||
|
@ -862,8 +861,11 @@ undo_push_image_mod (GImage *gimage,
|
|||
y2 = CLAMP (y2, 0, dheight);
|
||||
|
||||
tiles = (TileManager *) tiles_ptr;
|
||||
size = tiles->width * tiles->height *
|
||||
tiles->bpp + sizeof (gpointer) * 2;
|
||||
size =
|
||||
tile_manager_width (tiles) *
|
||||
tile_manager_height (tiles) *
|
||||
tile_manager_bpp (tiles) +
|
||||
sizeof (gpointer) * 2;
|
||||
|
||||
if ((new = undo_push (gimage, size, IMAGE_MOD_UNDO, TRUE)))
|
||||
{
|
||||
|
@ -911,8 +913,8 @@ undo_pop_image (GImage *gimage,
|
|||
|
||||
if (image_undo->sparse == FALSE)
|
||||
{
|
||||
w = tiles->width;
|
||||
h = tiles->height;
|
||||
w = tile_manager_width (tiles);
|
||||
h = tile_manager_height (tiles);
|
||||
|
||||
pixel_region_init (&PR1, tiles,
|
||||
0, 0, w, h, TRUE);
|
||||
|
@ -992,15 +994,17 @@ undo_push_mask (GImage *gimage,
|
|||
mask_undo = (MaskUndo *) mask_ptr;
|
||||
|
||||
if (mask_undo->tiles)
|
||||
size = mask_undo->tiles->width * mask_undo->tiles->height;
|
||||
size =
|
||||
tile_manager_width (mask_undo->tiles) *
|
||||
tile_manager_height (mask_undo->tiles);
|
||||
else
|
||||
size = 0;
|
||||
|
||||
if ((new = undo_push (gimage, size, MASK_UNDO, FALSE)))
|
||||
{
|
||||
new->data = mask_undo;
|
||||
new->pop_func = undo_pop_mask;
|
||||
new->free_func = undo_free_mask;
|
||||
new->data = mask_undo;
|
||||
new->pop_func = undo_pop_mask;
|
||||
new->free_func = undo_free_mask;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1056,8 +1060,8 @@ undo_pop_mask (GImage *gimage,
|
|||
|
||||
if (mask_undo->tiles)
|
||||
{
|
||||
width = mask_undo->tiles->width;
|
||||
height = mask_undo->tiles->height;
|
||||
width = tile_manager_width (mask_undo->tiles);
|
||||
height = tile_manager_height (mask_undo->tiles);
|
||||
pixel_region_init (&srcPR, mask_undo->tiles,
|
||||
0, 0, width, height, FALSE);
|
||||
pixel_region_init (&destPR, GIMP_DRAWABLE (sel_mask)->tiles,
|
||||
|
@ -1540,11 +1544,13 @@ undo_push_layer_mod (GImage *gimage,
|
|||
|
||||
layer = (Layer *) layer_ptr;
|
||||
|
||||
tiles = GIMP_DRAWABLE (layer)->tiles;
|
||||
tiles->x = GIMP_DRAWABLE (layer)->offset_x;
|
||||
tiles->y = GIMP_DRAWABLE (layer)->offset_y;
|
||||
size = (GIMP_DRAWABLE (layer)->width * GIMP_DRAWABLE (layer)->height *
|
||||
GIMP_DRAWABLE (layer)->bytes + sizeof (gpointer) * 3);
|
||||
tiles = GIMP_DRAWABLE (layer)->tiles;
|
||||
tile_manager_set_offsets (tiles,
|
||||
GIMP_DRAWABLE (layer)->offset_x,
|
||||
GIMP_DRAWABLE (layer)->offset_y);
|
||||
|
||||
size = (GIMP_DRAWABLE (layer)->width * GIMP_DRAWABLE (layer)->height *
|
||||
GIMP_DRAWABLE (layer)->bytes + sizeof (gpointer) * 3);
|
||||
|
||||
if ((new = undo_push (gimage, size, LAYER_MOD, TRUE)))
|
||||
{
|
||||
|
@ -1593,25 +1599,28 @@ undo_pop_layer_mod (GImage *gimage,
|
|||
|
||||
/* Create a tile manager to store the current layer contents */
|
||||
temp = GIMP_DRAWABLE (layer)->tiles;
|
||||
temp->x = GIMP_DRAWABLE (layer)->offset_x;
|
||||
temp->y = GIMP_DRAWABLE (layer)->offset_y;
|
||||
tile_manager_set_offsets (temp,
|
||||
GIMP_DRAWABLE (layer)->offset_x,
|
||||
GIMP_DRAWABLE (layer)->offset_y);
|
||||
layer_type = (glong) data[2];
|
||||
data[2] = (gpointer) ((glong) GIMP_DRAWABLE (layer)->type);
|
||||
|
||||
/* restore the layer's data */
|
||||
GIMP_DRAWABLE (layer)->tiles = tiles;
|
||||
GIMP_DRAWABLE (layer)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE (layer)->offset_y = tiles->y;
|
||||
GIMP_DRAWABLE (layer)->width = tiles->width;
|
||||
GIMP_DRAWABLE (layer)->height = tiles->height;
|
||||
GIMP_DRAWABLE (layer)->bytes = tiles->bpp;
|
||||
GIMP_DRAWABLE (layer)->width = tile_manager_width (tiles);
|
||||
GIMP_DRAWABLE (layer)->height = tile_manager_height (tiles);
|
||||
GIMP_DRAWABLE (layer)->bytes = tile_manager_bpp (tiles);
|
||||
GIMP_DRAWABLE (layer)->type = layer_type;
|
||||
GIMP_DRAWABLE (layer)->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (layer_type);
|
||||
tile_manager_get_offsets (tiles,
|
||||
&(GIMP_DRAWABLE (layer)->offset_x),
|
||||
&(GIMP_DRAWABLE (layer)->offset_y));
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
GIMP_DRAWABLE (layer->mask)->offset_x = tiles->x;
|
||||
GIMP_DRAWABLE (layer->mask)->offset_y = tiles->y;
|
||||
tile_manager_get_offsets (tiles,
|
||||
&(GIMP_DRAWABLE (layer->mask)->offset_x),
|
||||
&(GIMP_DRAWABLE (layer->mask)->offset_y));
|
||||
}
|
||||
|
||||
/* If the layer type changed, update the gdisplay titles */
|
||||
|
@ -1928,10 +1937,11 @@ undo_pop_channel_mod (GImage *gimage,
|
|||
|
||||
temp = GIMP_DRAWABLE (channel)->tiles;
|
||||
GIMP_DRAWABLE (channel)->tiles = tiles;
|
||||
GIMP_DRAWABLE (channel)->width = tiles->width;
|
||||
GIMP_DRAWABLE (channel)->height = tiles->height;
|
||||
GIMP_CHANNEL (channel)->bounds_known = FALSE; /* #4840. set to False because bounds
|
||||
reflect previous tile set */
|
||||
GIMP_DRAWABLE (channel)->width = tile_manager_width (tiles);
|
||||
GIMP_DRAWABLE (channel)->height = tile_manager_height (tiles);
|
||||
GIMP_CHANNEL (channel)->bounds_known = FALSE;
|
||||
/* #4840. set to FALSE because bounds
|
||||
reflect previous tile set */
|
||||
|
||||
/* Set the new buffer */
|
||||
data[1] = temp;
|
||||
|
|
95
app/xcf.c
95
app/xcf.c
|
@ -1413,19 +1413,26 @@ xcf_save_hierarchy (XcfInfo *info,
|
|||
{
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
gint i;
|
||||
gint nlevels, tmp1, tmp2;
|
||||
gint h, w;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint32 bpp;
|
||||
gint i;
|
||||
gint nlevels;
|
||||
gint tmp1, tmp2;
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->bpp, 1);
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
bpp = tile_manager_bpp (tiles);
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &bpp, 1);
|
||||
|
||||
saved_pos = info->cp;
|
||||
|
||||
tmp1 = xcf_calc_levels (tiles->width, TILE_WIDTH);
|
||||
tmp2 = xcf_calc_levels (tiles->height, TILE_HEIGHT);
|
||||
nlevels = MAX(tmp1, tmp2);
|
||||
tmp1 = xcf_calc_levels (width, TILE_WIDTH);
|
||||
tmp2 = xcf_calc_levels (height, TILE_HEIGHT);
|
||||
nlevels = MAX (tmp1, tmp2);
|
||||
|
||||
xcf_seek_pos (info, info->cp + (1 + nlevels) * 4);
|
||||
|
||||
|
@ -1437,17 +1444,15 @@ xcf_save_hierarchy (XcfInfo *info,
|
|||
{
|
||||
/* write out the level. */
|
||||
xcf_save_level (info, tiles);
|
||||
w = tiles->width;
|
||||
h = tiles->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fake an empty level */
|
||||
tmp1 = 0;
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &w, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &h, 1);
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tmp1, 1);
|
||||
}
|
||||
|
||||
|
@ -1480,20 +1485,25 @@ static void
|
|||
xcf_save_level (XcfInfo *info,
|
||||
TileManager *level)
|
||||
{
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
guint ntiles;
|
||||
gint i;
|
||||
guchar *rlebuf;
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint ntiles;
|
||||
gint i;
|
||||
guchar *rlebuf;
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &level->width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &level->height, 1);
|
||||
width = tile_manager_width (level);
|
||||
height = tile_manager_height (level);
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
|
||||
saved_pos = info->cp;
|
||||
|
||||
/* allocate a temporary buffer to store the rle data before it is
|
||||
written to disk */
|
||||
rlebuf = g_malloc(TILE_WIDTH*TILE_HEIGHT*level->bpp * 1.5);
|
||||
rlebuf = g_malloc (TILE_WIDTH * TILE_HEIGHT * tile_manager_bpp (level) * 1.5);
|
||||
|
||||
if (level->tiles)
|
||||
{
|
||||
|
@ -1542,7 +1552,7 @@ xcf_save_level (XcfInfo *info,
|
|||
}
|
||||
}
|
||||
|
||||
g_free(rlebuf);
|
||||
g_free (rlebuf);
|
||||
|
||||
/* write out a '0' offset position to indicate the end
|
||||
* of the level offsets.
|
||||
|
@ -1583,7 +1593,7 @@ xcf_save_tile_rle (XcfInfo *info,
|
|||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
data = (guchar*)tile_data_pointer (tile, 0, 0) + i;
|
||||
data = (guchar*) tile_data_pointer (tile, 0, 0) + i;
|
||||
|
||||
state = 0;
|
||||
length = 0;
|
||||
|
@ -1668,7 +1678,7 @@ xcf_save_tile_rle (XcfInfo *info,
|
|||
if (count != (tile_ewidth (tile) * tile_eheight (tile)))
|
||||
g_message ("xcf: uh oh! xcf rle tile saving error: %d", count);
|
||||
}
|
||||
info->cp += xcf_write_int8(info->fp, rlebuf, len);
|
||||
info->cp += xcf_write_int8 (info->fp, rlebuf, len);
|
||||
tile_release (tile, FALSE);
|
||||
}
|
||||
|
||||
|
@ -2433,9 +2443,9 @@ xcf_load_hierarchy (XcfInfo *info,
|
|||
/* make sure the values in the file correspond to the values
|
||||
* calculated when the TileManager was created.
|
||||
*/
|
||||
if ((width != tiles->width) ||
|
||||
(height != tiles->height) ||
|
||||
(bpp != tiles->bpp))
|
||||
if (width != tile_manager_width (tiles) ||
|
||||
height != tile_manager_height (tiles) ||
|
||||
bpp != tile_manager_bpp (tiles))
|
||||
return FALSE;
|
||||
|
||||
/* load in the levels...we make sure that the number of levels
|
||||
|
@ -2491,8 +2501,8 @@ xcf_load_level (XcfInfo *info,
|
|||
info->cp += xcf_read_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_read_int32 (info->fp, (guint32*) &height, 1);
|
||||
|
||||
if ((width != tiles->width) ||
|
||||
(height != tiles->height))
|
||||
if (width != tile_manager_width (tiles) ||
|
||||
height != tile_manager_height (tiles))
|
||||
return FALSE;
|
||||
|
||||
/* read in the first tile offset.
|
||||
|
@ -2530,8 +2540,9 @@ xcf_load_level (XcfInfo *info,
|
|||
/* if the offset is 0 then we need to read in the maximum possible
|
||||
allowing for negative compression */
|
||||
if (offset2 == 0)
|
||||
offset2 = offset + TILE_WIDTH*TILE_WIDTH*4*1.5; /* 1.5 is probably more
|
||||
than we need to allow */
|
||||
offset2 = offset + TILE_WIDTH * TILE_WIDTH * 4* 1.5;
|
||||
/* 1.5 is probably more
|
||||
than we need to allow */
|
||||
|
||||
/* seek to the tile offset */
|
||||
xcf_seek_pos (info, offset);
|
||||
|
@ -2577,8 +2588,8 @@ xcf_load_level (XcfInfo *info,
|
|||
if (tile_ewidth (tile) == tile_ewidth (previous) &&
|
||||
tile_eheight (tile) == tile_eheight (previous) &&
|
||||
tile_bpp (tile) == tile_bpp (previous) &&
|
||||
memcmp (tile_data_pointer(tile, 0, 0),
|
||||
tile_data_pointer(previous, 0, 0),
|
||||
memcmp (tile_data_pointer (tile, 0, 0),
|
||||
tile_data_pointer (previous, 0, 0),
|
||||
tile_size (tile)) == 0)
|
||||
tile_manager_map (tiles, i, previous);
|
||||
tile_release (previous, FALSE);
|
||||
|
@ -2613,7 +2624,9 @@ xcf_load_tile (XcfInfo *info,
|
|||
if (!info->swap_num)
|
||||
{
|
||||
info->ref_count = g_new (int, 1);
|
||||
info->swap_num = tile_swap_add (info->filename, xcf_swap_func, info->ref_count);
|
||||
info->swap_num = tile_swap_add (info->filename,
|
||||
xcf_swap_func,
|
||||
info->ref_count);
|
||||
}
|
||||
|
||||
tile->swap_num = info->swap_num;
|
||||
|
@ -2652,7 +2665,7 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
|
||||
/* we have to use fread instead of xcf_read_* because we may be
|
||||
reading past the end of the file here */
|
||||
nmemb_read_successfully = fread ((char*) xcfdata, sizeof (char),
|
||||
nmemb_read_successfully = fread ((gchar*) xcfdata, sizeof (char),
|
||||
data_length, info->fp);
|
||||
info->cp += nmemb_read_successfully;
|
||||
|
||||
|
@ -2660,7 +2673,7 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
data = (guchar*)tile_data_pointer (tile, 0, 0) + i;
|
||||
data = (guchar*) tile_data_pointer (tile, 0, 0) + i;
|
||||
size = tile_ewidth (tile) * tile_eheight (tile);
|
||||
count = 0;
|
||||
|
||||
|
@ -2757,10 +2770,10 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
#ifdef SWAP_FROM_FILE
|
||||
|
||||
static gboolean
|
||||
xcf_swap_func (gint fd,
|
||||
xcf_swap_func (gint fd,
|
||||
Tile *tile,
|
||||
gint cmd,
|
||||
gpointer user_data)
|
||||
gint cmd,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint bytes;
|
||||
gint err;
|
||||
|
|
|
@ -1413,19 +1413,26 @@ xcf_save_hierarchy (XcfInfo *info,
|
|||
{
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
gint i;
|
||||
gint nlevels, tmp1, tmp2;
|
||||
gint h, w;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint32 bpp;
|
||||
gint i;
|
||||
gint nlevels;
|
||||
gint tmp1, tmp2;
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tiles->bpp, 1);
|
||||
width = tile_manager_width (tiles);
|
||||
height = tile_manager_height (tiles);
|
||||
bpp = tile_manager_bpp (tiles);
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &bpp, 1);
|
||||
|
||||
saved_pos = info->cp;
|
||||
|
||||
tmp1 = xcf_calc_levels (tiles->width, TILE_WIDTH);
|
||||
tmp2 = xcf_calc_levels (tiles->height, TILE_HEIGHT);
|
||||
nlevels = MAX(tmp1, tmp2);
|
||||
tmp1 = xcf_calc_levels (width, TILE_WIDTH);
|
||||
tmp2 = xcf_calc_levels (height, TILE_HEIGHT);
|
||||
nlevels = MAX (tmp1, tmp2);
|
||||
|
||||
xcf_seek_pos (info, info->cp + (1 + nlevels) * 4);
|
||||
|
||||
|
@ -1437,17 +1444,15 @@ xcf_save_hierarchy (XcfInfo *info,
|
|||
{
|
||||
/* write out the level. */
|
||||
xcf_save_level (info, tiles);
|
||||
w = tiles->width;
|
||||
h = tiles->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fake an empty level */
|
||||
tmp1 = 0;
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &w, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &h, 1);
|
||||
width /= 2;
|
||||
height /= 2;
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &tmp1, 1);
|
||||
}
|
||||
|
||||
|
@ -1480,20 +1485,25 @@ static void
|
|||
xcf_save_level (XcfInfo *info,
|
||||
TileManager *level)
|
||||
{
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
guint ntiles;
|
||||
gint i;
|
||||
guchar *rlebuf;
|
||||
guint32 saved_pos;
|
||||
guint32 offset;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint ntiles;
|
||||
gint i;
|
||||
guchar *rlebuf;
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &level->width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &level->height, 1);
|
||||
width = tile_manager_width (level);
|
||||
height = tile_manager_height (level);
|
||||
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_write_int32 (info->fp, (guint32*) &height, 1);
|
||||
|
||||
saved_pos = info->cp;
|
||||
|
||||
/* allocate a temporary buffer to store the rle data before it is
|
||||
written to disk */
|
||||
rlebuf = g_malloc(TILE_WIDTH*TILE_HEIGHT*level->bpp * 1.5);
|
||||
rlebuf = g_malloc (TILE_WIDTH * TILE_HEIGHT * tile_manager_bpp (level) * 1.5);
|
||||
|
||||
if (level->tiles)
|
||||
{
|
||||
|
@ -1542,7 +1552,7 @@ xcf_save_level (XcfInfo *info,
|
|||
}
|
||||
}
|
||||
|
||||
g_free(rlebuf);
|
||||
g_free (rlebuf);
|
||||
|
||||
/* write out a '0' offset position to indicate the end
|
||||
* of the level offsets.
|
||||
|
@ -1583,7 +1593,7 @@ xcf_save_tile_rle (XcfInfo *info,
|
|||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
data = (guchar*)tile_data_pointer (tile, 0, 0) + i;
|
||||
data = (guchar*) tile_data_pointer (tile, 0, 0) + i;
|
||||
|
||||
state = 0;
|
||||
length = 0;
|
||||
|
@ -1668,7 +1678,7 @@ xcf_save_tile_rle (XcfInfo *info,
|
|||
if (count != (tile_ewidth (tile) * tile_eheight (tile)))
|
||||
g_message ("xcf: uh oh! xcf rle tile saving error: %d", count);
|
||||
}
|
||||
info->cp += xcf_write_int8(info->fp, rlebuf, len);
|
||||
info->cp += xcf_write_int8 (info->fp, rlebuf, len);
|
||||
tile_release (tile, FALSE);
|
||||
}
|
||||
|
||||
|
@ -2433,9 +2443,9 @@ xcf_load_hierarchy (XcfInfo *info,
|
|||
/* make sure the values in the file correspond to the values
|
||||
* calculated when the TileManager was created.
|
||||
*/
|
||||
if ((width != tiles->width) ||
|
||||
(height != tiles->height) ||
|
||||
(bpp != tiles->bpp))
|
||||
if (width != tile_manager_width (tiles) ||
|
||||
height != tile_manager_height (tiles) ||
|
||||
bpp != tile_manager_bpp (tiles))
|
||||
return FALSE;
|
||||
|
||||
/* load in the levels...we make sure that the number of levels
|
||||
|
@ -2491,8 +2501,8 @@ xcf_load_level (XcfInfo *info,
|
|||
info->cp += xcf_read_int32 (info->fp, (guint32*) &width, 1);
|
||||
info->cp += xcf_read_int32 (info->fp, (guint32*) &height, 1);
|
||||
|
||||
if ((width != tiles->width) ||
|
||||
(height != tiles->height))
|
||||
if (width != tile_manager_width (tiles) ||
|
||||
height != tile_manager_height (tiles))
|
||||
return FALSE;
|
||||
|
||||
/* read in the first tile offset.
|
||||
|
@ -2530,8 +2540,9 @@ xcf_load_level (XcfInfo *info,
|
|||
/* if the offset is 0 then we need to read in the maximum possible
|
||||
allowing for negative compression */
|
||||
if (offset2 == 0)
|
||||
offset2 = offset + TILE_WIDTH*TILE_WIDTH*4*1.5; /* 1.5 is probably more
|
||||
than we need to allow */
|
||||
offset2 = offset + TILE_WIDTH * TILE_WIDTH * 4* 1.5;
|
||||
/* 1.5 is probably more
|
||||
than we need to allow */
|
||||
|
||||
/* seek to the tile offset */
|
||||
xcf_seek_pos (info, offset);
|
||||
|
@ -2577,8 +2588,8 @@ xcf_load_level (XcfInfo *info,
|
|||
if (tile_ewidth (tile) == tile_ewidth (previous) &&
|
||||
tile_eheight (tile) == tile_eheight (previous) &&
|
||||
tile_bpp (tile) == tile_bpp (previous) &&
|
||||
memcmp (tile_data_pointer(tile, 0, 0),
|
||||
tile_data_pointer(previous, 0, 0),
|
||||
memcmp (tile_data_pointer (tile, 0, 0),
|
||||
tile_data_pointer (previous, 0, 0),
|
||||
tile_size (tile)) == 0)
|
||||
tile_manager_map (tiles, i, previous);
|
||||
tile_release (previous, FALSE);
|
||||
|
@ -2613,7 +2624,9 @@ xcf_load_tile (XcfInfo *info,
|
|||
if (!info->swap_num)
|
||||
{
|
||||
info->ref_count = g_new (int, 1);
|
||||
info->swap_num = tile_swap_add (info->filename, xcf_swap_func, info->ref_count);
|
||||
info->swap_num = tile_swap_add (info->filename,
|
||||
xcf_swap_func,
|
||||
info->ref_count);
|
||||
}
|
||||
|
||||
tile->swap_num = info->swap_num;
|
||||
|
@ -2652,7 +2665,7 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
|
||||
/* we have to use fread instead of xcf_read_* because we may be
|
||||
reading past the end of the file here */
|
||||
nmemb_read_successfully = fread ((char*) xcfdata, sizeof (char),
|
||||
nmemb_read_successfully = fread ((gchar*) xcfdata, sizeof (char),
|
||||
data_length, info->fp);
|
||||
info->cp += nmemb_read_successfully;
|
||||
|
||||
|
@ -2660,7 +2673,7 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
data = (guchar*)tile_data_pointer (tile, 0, 0) + i;
|
||||
data = (guchar*) tile_data_pointer (tile, 0, 0) + i;
|
||||
size = tile_ewidth (tile) * tile_eheight (tile);
|
||||
count = 0;
|
||||
|
||||
|
@ -2757,10 +2770,10 @@ xcf_load_tile_rle (XcfInfo *info,
|
|||
#ifdef SWAP_FROM_FILE
|
||||
|
||||
static gboolean
|
||||
xcf_swap_func (gint fd,
|
||||
xcf_swap_func (gint fd,
|
||||
Tile *tile,
|
||||
gint cmd,
|
||||
gpointer user_data)
|
||||
gint cmd,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint bytes;
|
||||
gint err;
|
||||
|
|
|
@ -977,12 +977,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix3 m, matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'gdouble scalex, scaley',
|
||||
'gdouble trans_info[8]', 'GimpMatrix3 m, matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -998,14 +997,15 @@ HELP
|
|||
*/
|
||||
perspective_find_transform (trans_info, m);
|
||||
|
||||
cx = float_tiles->x;
|
||||
cy = float_tiles->y;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = (gdouble) offset_x;
|
||||
cy = (gdouble) offset_y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = 1.0 / tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = 1.0 / tile_manager_height (float_tiles);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1100,8 +1100,8 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("tools/rotate_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1112,8 +1112,9 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1177,11 +1178,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble scalex, scaley', 'gdouble trans_info[4]',
|
||||
'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (trans_info[X0] < trans_info[X1] &&
|
||||
|
@ -1196,16 +1197,18 @@ HELP
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
(gdouble) tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(gdouble) tile_manager_height (float_tiles);
|
||||
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, float_tiles->x, float_tiles->y);
|
||||
gimp_matrix3_translate (matrix, offset_x, offset_y);
|
||||
gimp_matrix3_scale (matrix, scalex, scaley);
|
||||
gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]);
|
||||
|
||||
|
@ -1265,11 +1268,10 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('sheared') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gdouble cx, cy',
|
||||
'gint offset_x, offset_y', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1280,8 +1282,10 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, -cx, -cy);
|
||||
|
@ -1291,9 +1295,9 @@ HELP
|
|||
ORIENTATION_UNKNOWN;
|
||||
|
||||
if (shear_type == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix3_xshear (matrix, magnitude / float_tiles->height);
|
||||
gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles));
|
||||
else if (shear_type == ORIENTATION_VERTICAL)
|
||||
gimp_matrix3_yshear (matrix, magnitude / float_tiles->width);
|
||||
gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles));
|
||||
gimp_matrix3_translate (matrix, +cx, +cy);
|
||||
|
||||
/* Shear the buffer */
|
||||
|
@ -1359,8 +1363,7 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
|
|
|
@ -977,12 +977,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix3 m, matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'gdouble scalex, scaley',
|
||||
'gdouble trans_info[8]', 'GimpMatrix3 m, matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -998,14 +997,15 @@ HELP
|
|||
*/
|
||||
perspective_find_transform (trans_info, m);
|
||||
|
||||
cx = float_tiles->x;
|
||||
cy = float_tiles->y;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = (gdouble) offset_x;
|
||||
cy = (gdouble) offset_y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = 1.0 / tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = 1.0 / tile_manager_height (float_tiles);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1100,8 +1100,8 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("tools/rotate_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1112,8 +1112,9 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1177,11 +1178,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble scalex, scaley', 'gdouble trans_info[4]',
|
||||
'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (trans_info[X0] < trans_info[X1] &&
|
||||
|
@ -1196,16 +1197,18 @@ HELP
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
(gdouble) tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(gdouble) tile_manager_height (float_tiles);
|
||||
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, float_tiles->x, float_tiles->y);
|
||||
gimp_matrix3_translate (matrix, offset_x, offset_y);
|
||||
gimp_matrix3_scale (matrix, scalex, scaley);
|
||||
gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]);
|
||||
|
||||
|
@ -1265,11 +1268,10 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('sheared') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gdouble cx, cy',
|
||||
'gint offset_x, offset_y', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1280,8 +1282,10 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, -cx, -cy);
|
||||
|
@ -1291,9 +1295,9 @@ HELP
|
|||
ORIENTATION_UNKNOWN;
|
||||
|
||||
if (shear_type == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix3_xshear (matrix, magnitude / float_tiles->height);
|
||||
gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles));
|
||||
else if (shear_type == ORIENTATION_VERTICAL)
|
||||
gimp_matrix3_yshear (matrix, magnitude / float_tiles->width);
|
||||
gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles));
|
||||
gimp_matrix3_translate (matrix, +cx, +cy);
|
||||
|
||||
/* Shear the buffer */
|
||||
|
@ -1359,8 +1363,7 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
|
|
|
@ -977,12 +977,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix3 m, matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'gdouble scalex, scaley',
|
||||
'gdouble trans_info[8]', 'GimpMatrix3 m, matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -998,14 +997,15 @@ HELP
|
|||
*/
|
||||
perspective_find_transform (trans_info, m);
|
||||
|
||||
cx = float_tiles->x;
|
||||
cy = float_tiles->y;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = (gdouble) offset_x;
|
||||
cy = (gdouble) offset_y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = 1.0 / tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = 1.0 / tile_manager_height (float_tiles);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1100,8 +1100,8 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("tools/rotate_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1112,8 +1112,9 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1177,11 +1178,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble scalex, scaley', 'gdouble trans_info[4]',
|
||||
'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (trans_info[X0] < trans_info[X1] &&
|
||||
|
@ -1196,16 +1197,18 @@ HELP
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
(gdouble) tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(gdouble) tile_manager_height (float_tiles);
|
||||
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, float_tiles->x, float_tiles->y);
|
||||
gimp_matrix3_translate (matrix, offset_x, offset_y);
|
||||
gimp_matrix3_scale (matrix, scalex, scaley);
|
||||
gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]);
|
||||
|
||||
|
@ -1265,11 +1268,10 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('sheared') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gdouble cx, cy',
|
||||
'gint offset_x, offset_y', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1280,8 +1282,10 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, -cx, -cy);
|
||||
|
@ -1291,9 +1295,9 @@ HELP
|
|||
ORIENTATION_UNKNOWN;
|
||||
|
||||
if (shear_type == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix3_xshear (matrix, magnitude / float_tiles->height);
|
||||
gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles));
|
||||
else if (shear_type == ORIENTATION_VERTICAL)
|
||||
gimp_matrix3_yshear (matrix, magnitude / float_tiles->width);
|
||||
gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles));
|
||||
gimp_matrix3_translate (matrix, +cx, +cy);
|
||||
|
||||
/* Shear the buffer */
|
||||
|
@ -1359,8 +1363,7 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
|
|
|
@ -977,12 +977,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('newly mapped') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/perspective_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'double scalex, scaley', 'double trans_info[8]',
|
||||
'GimpMatrix3 m, matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'gdouble scalex, scaley',
|
||||
'gdouble trans_info[8]', 'GimpMatrix3 m, matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -998,14 +997,15 @@ HELP
|
|||
*/
|
||||
perspective_find_transform (trans_info, m);
|
||||
|
||||
cx = float_tiles->x;
|
||||
cy = float_tiles->y;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = (gdouble) offset_x;
|
||||
cy = (gdouble) offset_y;
|
||||
scalex = 1.0;
|
||||
scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = 1.0 / float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = 1.0 / float_tiles->height;
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = 1.0 / tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = 1.0 / tile_manager_height (float_tiles);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1100,8 +1100,8 @@ HELP
|
|||
%invoke = (
|
||||
headers => [ qw("tools/rotate_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble cx, cy', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1112,8 +1112,9 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
|
@ -1177,11 +1178,11 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('scaled') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/scale_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double scalex, scaley',
|
||||
'double trans_info[4]', 'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gint offset_x, offset_y',
|
||||
'gdouble scalex, scaley', 'gdouble trans_info[4]',
|
||||
'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (trans_info[X0] < trans_info[X1] &&
|
||||
|
@ -1196,16 +1197,18 @@ HELP
|
|||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
if (tile_manager_width (float_tiles))
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
(gdouble) tile_manager_width (float_tiles);
|
||||
if (tile_manager_height (float_tiles))
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(gdouble) tile_manager_height (float_tiles);
|
||||
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, float_tiles->x, float_tiles->y);
|
||||
gimp_matrix3_translate (matrix, offset_x, offset_y);
|
||||
gimp_matrix3_scale (matrix, scalex, scaley);
|
||||
gimp_matrix3_translate (matrix, trans_info[X0], trans_info[Y0]);
|
||||
|
||||
|
@ -1265,11 +1268,10 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('sheared') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/shear_tool.h" "tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'double cx, cy',
|
||||
'GimpMatrix3 matrix' ],
|
||||
'gboolean new_layer', 'gdouble cx, cy',
|
||||
'gint offset_x, offset_y', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
gimage = gimp_drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
@ -1280,8 +1282,10 @@ HELP
|
|||
/* Cut/Copy from the specified drawable */
|
||||
float_tiles = transform_core_cut (gimage, drawable, &new_layer);
|
||||
|
||||
cx = float_tiles->x + float_tiles->width / 2.0;
|
||||
cy = float_tiles->y + float_tiles->height / 2.0;
|
||||
tile_manager_get_offsets (float_tiles, &offset_x, &offset_y);
|
||||
|
||||
cx = offset_x + tile_manager_width (float_tiles) / 2.0;
|
||||
cy = offset_y + tile_manager_height (float_tiles) / 2.0;
|
||||
|
||||
gimp_matrix3_identity (matrix);
|
||||
gimp_matrix3_translate (matrix, -cx, -cy);
|
||||
|
@ -1291,9 +1295,9 @@ HELP
|
|||
ORIENTATION_UNKNOWN;
|
||||
|
||||
if (shear_type == ORIENTATION_HORIZONTAL)
|
||||
gimp_matrix3_xshear (matrix, magnitude / float_tiles->height);
|
||||
gimp_matrix3_xshear (matrix, magnitude / tile_manager_height (float_tiles));
|
||||
else if (shear_type == ORIENTATION_VERTICAL)
|
||||
gimp_matrix3_yshear (matrix, magnitude / float_tiles->width);
|
||||
gimp_matrix3_yshear (matrix, magnitude / tile_manager_width (float_tiles));
|
||||
gimp_matrix3_translate (matrix, +cx, +cy);
|
||||
|
||||
/* Shear the buffer */
|
||||
|
@ -1359,8 +1363,7 @@ HELP
|
|||
@outargs = ( &drawable_out_arg('transformed') );
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("tools/transform_core.h"
|
||||
"tile_manager_pvt.h") ],
|
||||
headers => [ qw("tools/transform_core.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'TileManager *float_tiles, *new_tiles',
|
||||
'gboolean new_layer', 'GimpMatrix3 matrix' ],
|
||||
code => <<'CODE'
|
||||
|
|
Loading…
Reference in a new issue