mirror of https://github.com/GNOME/gimp.git
More robust and kickin' thumbnail support.
Sun Feb 7 15:04:23 GMT 1999 Adam D. Moss <adam@gimp.org> * app/fileops.c: More robust and kickin' thumbnail support. * app/edit_selection.c app/layer.c app/layer.h: Working on lazy opaque layer moves. Disabled for now. * app/gdisplay.c * app/gimage.h * app/gimpimage.c * app/gimpimage.h * app/image_render.c * app/tile_manager.c: Errr, I don't remember. No, seriously. Nothing of consequence.
This commit is contained in:
parent
dea84972e3
commit
32675c4408
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
Sun Feb 7 15:04:23 GMT 1999 Adam D. Moss <adam@gimp.org>
|
||||
|
||||
* app/fileops.c: More robust and kickin' thumbnail support.
|
||||
|
||||
* app/edit_selection.c app/layer.c app/layer.h: Working
|
||||
on lazy opaque layer moves. Disabled for now.
|
||||
|
||||
* app/gdisplay.c
|
||||
* app/gimage.h
|
||||
* app/gimpimage.c
|
||||
* app/gimpimage.h
|
||||
* app/image_render.c
|
||||
* app/tile_manager.c: Errr, I don't remember. No, seriously.
|
||||
Nothing of consequence.
|
||||
|
||||
Sun Feb 7 02:44:44 PST 1999 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* configure.in: fix setting of $localedir, and use $CONFIG_SHELL
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static int tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel);
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -600,19 +600,28 @@ layer_apply_mask (layer, mode)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
|
||||
static void
|
||||
layer_translate_lowlevel (layer, off_x, off_y, temporary)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
gboolean temporary;
|
||||
{
|
||||
/* the undo call goes here */
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* the undo call goes here */
|
||||
/*g_warning ("setting undo for layer translation");*/
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
}
|
||||
|
||||
/* update the affected region */
|
||||
drawable_update (GIMP_DRAWABLE(layer), 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
|
||||
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
}
|
||||
|
||||
/* update the layer offsets */
|
||||
GIMP_DRAWABLE(layer)->offset_x += off_x;
|
||||
|
@ -625,12 +634,34 @@ layer_translate (layer, off_x, off_y)
|
|||
{
|
||||
GIMP_DRAWABLE(layer->mask)->offset_x += off_x;
|
||||
GIMP_DRAWABLE(layer->mask)->offset_y += off_y;
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_temporarily_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, TRUE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -90,6 +90,7 @@ LayerMask * layer_create_mask (Layer *, AddMaskType);
|
|||
Layer * layer_get_ID (int);
|
||||
void layer_delete (Layer *);
|
||||
void layer_apply_mask (Layer *, int);
|
||||
void layer_temporarily_translate (Layer *, int, int);
|
||||
void layer_translate (Layer *, int, int);
|
||||
void layer_add_alpha (Layer *);
|
||||
void layer_scale (Layer *, int, int, int);
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define OVERHEAD 25 /* in units of pixel area */
|
||||
#define EPSILON 5
|
||||
|
||||
|
@ -1210,6 +1211,14 @@ gdisplay_display_area (GDisplay *gdisp,
|
|||
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
|
||||
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset,
|
||||
dx, dy);
|
||||
#if 0
|
||||
/* Invalidate the projection just after we render it! */
|
||||
gimage_invalidate_without_render (gdisp->gimage,
|
||||
j - gdisp->disp_xoffset,
|
||||
i - gdisp->disp_yoffset,
|
||||
dx, dy,
|
||||
0, 0, 0, 0);
|
||||
#endif
|
||||
gximage_put (gdisp->canvas->window,
|
||||
j, i, dx, dy,
|
||||
gdisp->offset_x,
|
||||
|
|
|
@ -870,6 +870,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
int width;
|
||||
int tilex;
|
||||
int tiley;
|
||||
int srctilex, srctiley;
|
||||
int step;
|
||||
int bpp = info->src_bpp;
|
||||
int x, b;
|
||||
|
@ -877,7 +878,9 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles,
|
||||
srctilex=info->src_x, srctiley=info->src_y,
|
||||
TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -906,7 +909,8 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
|
||||
srctiley=info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define OVERHEAD 25 /* in units of pixel area */
|
||||
#define EPSILON 5
|
||||
|
||||
|
@ -1210,6 +1211,14 @@ gdisplay_display_area (GDisplay *gdisp,
|
|||
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
|
||||
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset,
|
||||
dx, dy);
|
||||
#if 0
|
||||
/* Invalidate the projection just after we render it! */
|
||||
gimage_invalidate_without_render (gdisp->gimage,
|
||||
j - gdisp->disp_xoffset,
|
||||
i - gdisp->disp_yoffset,
|
||||
dx, dy,
|
||||
0, 0, 0, 0);
|
||||
#endif
|
||||
gximage_put (gdisp->canvas->window,
|
||||
j, i, dx, dy,
|
||||
gdisp->offset_x,
|
||||
|
|
|
@ -870,6 +870,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
int width;
|
||||
int tilex;
|
||||
int tiley;
|
||||
int srctilex, srctiley;
|
||||
int step;
|
||||
int bpp = info->src_bpp;
|
||||
int x, b;
|
||||
|
@ -877,7 +878,9 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles,
|
||||
srctilex=info->src_x, srctiley=info->src_y,
|
||||
TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -906,7 +909,8 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
|
||||
srctiley=info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
|
@ -39,24 +39,24 @@ typedef struct _edit_selection EditSelection;
|
|||
|
||||
struct _edit_selection
|
||||
{
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x2, y2;
|
||||
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
|
||||
DrawCore * core; /* selection core for drawing bounds */
|
||||
DrawCore * core; /* selection core for drawing bounds*/
|
||||
|
||||
ButtonReleaseFunc old_button_release; /* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
ButtonReleaseFunc old_button_release;/* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
||||
|
@ -234,7 +234,15 @@ edit_selection_button_release (Tool *tool,
|
|||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
{
|
||||
/* Temporarily shift back to the original
|
||||
position so that undo information is updated
|
||||
properly... bit of a hack. DISABLED */
|
||||
/*layer_temporarily_translate (layer,
|
||||
edit_select.origx - x,
|
||||
edit_select.origy - y);*/
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
|
@ -287,15 +295,55 @@ edit_selection_motion (Tool *tool,
|
|||
GDisplay * gdisp;
|
||||
gchar offset[STATUSBAR_SIZE];
|
||||
|
||||
/* g_warning("motion");*/
|
||||
|
||||
if (tool->state != ACTIVE)
|
||||
return;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
gdk_flush();
|
||||
|
||||
draw_core_pause (edit_select.core, tool);
|
||||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
|
||||
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
|
||||
|
@ -320,6 +368,9 @@ edit_selection_draw (Tool *tool)
|
|||
int x3, y3, x4, y4;
|
||||
int off_x, off_y;
|
||||
|
||||
/*static int ggg = 0;
|
||||
g_warning("draw %d", ggg++);*/
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
select = gdisp->select;
|
||||
|
||||
|
@ -429,6 +480,41 @@ edit_selection_draw (Tool *tool)
|
|||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
|
337
app/fileops.c
337
app/fileops.c
|
@ -118,6 +118,7 @@ static GtkWidget *save_options = NULL;
|
|||
static GtkPreview *open_options_preview = NULL;
|
||||
static GtkWidget *open_options_fixed = NULL;
|
||||
static GtkWidget *open_options_label = NULL;
|
||||
static GtkWidget *open_options_frame = NULL;
|
||||
|
||||
/* Load by extension.
|
||||
*/
|
||||
|
@ -535,7 +536,7 @@ file_open_callback (GtkWidget *w,
|
|||
{
|
||||
GtkWidget* frame;
|
||||
|
||||
open_options = gtk_hbox_new (FALSE, 1);
|
||||
open_options = gtk_hbox_new (TRUE, 1);
|
||||
|
||||
/* format-chooser frame */
|
||||
frame = gtk_frame_new (_("Open Options"));
|
||||
|
@ -572,11 +573,11 @@ file_open_callback (GtkWidget *w,
|
|||
gtk_widget_show (frame);
|
||||
|
||||
/* Preview frame */
|
||||
frame = gtk_frame_new (_("Preview"));
|
||||
frame = gtk_frame_new ("");
|
||||
open_options_frame = frame;
|
||||
{
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_widget_set_usize (frame, 130,100);
|
||||
gtk_box_pack_end (GTK_BOX (open_options), frame, FALSE, TRUE, 5);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 1);
|
||||
|
@ -607,11 +608,11 @@ file_open_callback (GtkWidget *w,
|
|||
}
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
open_options_label = gtk_label_new ("hmm.");
|
||||
open_options_label = gtk_label_new ("");
|
||||
{
|
||||
gtk_label_set_justify (GTK_LABEL (open_options_label),
|
||||
GTK_JUSTIFY_FILL);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (open_options_label), TRUE);
|
||||
/* gtk_label_set_justify (GTK_LABEL (open_options_label),
|
||||
GTK_JUSTIFY_LEFT);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (open_options_label), TRUE);*/
|
||||
gtk_box_pack_end (GTK_BOX (vbox), open_options_label,
|
||||
FALSE, TRUE, 0);
|
||||
}
|
||||
|
@ -626,6 +627,7 @@ file_open_callback (GtkWidget *w,
|
|||
open_options, FALSE, FALSE, 5);
|
||||
}
|
||||
|
||||
gtk_frame_set_label (GTK_FRAME(open_options_frame), _("Preview"));
|
||||
gtk_label_set_text (GTK_LABEL(open_options_label), "No selection.");
|
||||
gtk_widget_hide (open_options_fixed);
|
||||
gtk_widget_show (open_options);
|
||||
|
@ -893,6 +895,133 @@ file_open (char *filename, char *raw_filename)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
file_save_thumbnail (GimpImage* gimage,
|
||||
char *filename,
|
||||
char *raw_filename)
|
||||
{
|
||||
TempBuf* tempbuf;
|
||||
gint i,j;
|
||||
unsigned char* tbd;
|
||||
gchar* pname;
|
||||
gchar* xpname;
|
||||
gchar* fname;
|
||||
gint w,h;
|
||||
GimpImageBaseType basetype;
|
||||
FILE* fp;
|
||||
|
||||
if (gimp_image_preview_valid (gimage, Gray))
|
||||
{
|
||||
printf("(gimage already has valid preview - %dx%d)\n",
|
||||
gimage->comp_preview->width,
|
||||
gimage->comp_preview->height);
|
||||
}
|
||||
|
||||
pname = g_dirname(filename);
|
||||
xpname = g_strconcat(pname,G_DIR_SEPARATOR_S,".xvpics",
|
||||
NULL);
|
||||
|
||||
fname = g_strconcat (xpname,G_DIR_SEPARATOR_S,
|
||||
raw_filename,
|
||||
NULL);
|
||||
|
||||
if (gimage->width<=80 && gimage->height<=60)
|
||||
{
|
||||
w = gimage->width;
|
||||
h = gimage->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Ratio molesting to fit within .xvpic thumbnail size limits */
|
||||
if (60*gimage->width < 80*gimage->height)
|
||||
{
|
||||
h = 60;
|
||||
w = (60*gimage->width)/gimage->height;
|
||||
if (w==0)
|
||||
w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 80;
|
||||
h = (80*gimage->height)/gimage->width;
|
||||
if (h==0)
|
||||
h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("tn: %d x %d -> ", w, h);fflush(stdout);
|
||||
|
||||
tempbuf = gimp_image_composite_preview (gimage, Gray, w, h);
|
||||
tbd = temp_buf_data(tempbuf);
|
||||
|
||||
w = tempbuf->width;
|
||||
h = tempbuf->height;
|
||||
printf("tn: %d x %d\n", w, h);fflush(stdout);
|
||||
|
||||
mkdir (xpname, 0755);
|
||||
|
||||
fp = fopen(fname,"wb");
|
||||
g_free(pname);
|
||||
g_free(xpname);
|
||||
g_free(fname);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
basetype = gimp_image_base_type(gimage);
|
||||
|
||||
fprintf(fp,
|
||||
"P7 332\n#IMGINFO:%dx%d %s\n"
|
||||
"#END_OF_COMMENTS\n%d %d 255\n",
|
||||
gimage->width, gimage->height,
|
||||
(basetype == RGB) ? "RGB" :
|
||||
(basetype == GRAY) ? "Greyscale" :
|
||||
(basetype == INDEXED) ? "Indexed" :
|
||||
"(UNKNOWN COLOUR TYPE)",
|
||||
w, h);
|
||||
|
||||
switch (basetype)
|
||||
{
|
||||
case INDEXED:
|
||||
case RGB:
|
||||
for (i=0;i<w;i++)
|
||||
{
|
||||
for (j=0;j<h;j++)
|
||||
{
|
||||
guchar r,g,b;
|
||||
r = *(tbd++);
|
||||
g = *(tbd++);
|
||||
b = *(tbd++);
|
||||
tbd++;
|
||||
fputc(((r>>5)<<5) | ((g>>5)<<2) | (b>>6), fp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GRAY:
|
||||
for (i=0;i<w;i++)
|
||||
{
|
||||
for (j=0;j<h;j++)
|
||||
{
|
||||
guchar v;
|
||||
v = *(tbd++);
|
||||
tbd++;
|
||||
fputc(((v>>5)<<5) | ((v>>5)<<2) | (v>>6), fp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_warning("UNKNOWN GIMAGE TYPE IN THUMBNAIL SAVE");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else /* Error writing thumbnail */
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
file_save (GimpImage* gimage,
|
||||
char *filename,
|
||||
|
@ -951,129 +1080,7 @@ file_save (GimpImage* gimage,
|
|||
attention --Adam */
|
||||
/* gimage_set_save_proc(gimage, file_proc); */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning CRUFTY THUMBNAIL SAVING
|
||||
/* If you have problems, blame Adam... not quite finished.
|
||||
Will be moved somewhere more appropriate. */
|
||||
#endif
|
||||
{
|
||||
TempBuf* tempbuf;
|
||||
gint i,j;
|
||||
unsigned char* tbd;
|
||||
gchar* pname;
|
||||
gchar* xpname;
|
||||
gchar* fname;
|
||||
gint w,h;
|
||||
GimpImageBaseType basetype;
|
||||
FILE* fp;
|
||||
|
||||
if (gimp_image_preview_valid (gimage, Gray))
|
||||
{
|
||||
printf("(gimage already has valid preview - %dx%d)\n",
|
||||
gimage->comp_preview->width,
|
||||
gimage->comp_preview->height);
|
||||
}
|
||||
|
||||
pname = g_dirname(filename);
|
||||
xpname = g_strconcat(pname,G_DIR_SEPARATOR_S,".xvpics",
|
||||
NULL);
|
||||
|
||||
fname = g_strconcat (xpname,G_DIR_SEPARATOR_S,
|
||||
raw_filename,
|
||||
NULL);
|
||||
|
||||
unlink (fname);
|
||||
|
||||
if (gimage->width<=80 && gimage->height<=60)
|
||||
{
|
||||
w = gimage->width;
|
||||
h = gimage->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Ratio molesting to fit within .xvpic thumbnail size limits */
|
||||
if (60*gimage->width < 80*gimage->height)
|
||||
{
|
||||
h = 60;
|
||||
w = (60*gimage->width)/gimage->height;
|
||||
if (w==0)
|
||||
w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
w = 80;
|
||||
h = (80*gimage->height)/gimage->width;
|
||||
if (h==0)
|
||||
h = 1;
|
||||
}
|
||||
}
|
||||
|
||||
printf("tn: %d x %d -> ", w, h);fflush(stdout);
|
||||
|
||||
tempbuf = gimp_image_composite_preview (gimage, Gray, w, h);
|
||||
tbd = temp_buf_data(tempbuf);
|
||||
|
||||
w = tempbuf->width;
|
||||
h = tempbuf->height;
|
||||
printf("tn: %d x %d\n", w, h);fflush(stdout);
|
||||
|
||||
mkdir (xpname, 0755);
|
||||
|
||||
fp = fopen(fname,"wb");
|
||||
g_free(pname);
|
||||
g_free(xpname);
|
||||
g_free(fname);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
basetype = gimp_image_base_type(gimage);
|
||||
|
||||
fprintf(fp,
|
||||
"P7 332\n#IMGINFO:%dx%d %s\n"
|
||||
"#END_OF_COMMENTS\n%d %d 255\n",
|
||||
gimage->width, gimage->height,
|
||||
(basetype == RGB) ? "RGB" :
|
||||
(basetype == GRAY) ? "Greyscale" :
|
||||
(basetype == INDEXED) ? "Indexed" :
|
||||
"(UNKNOWN COLOUR TYPE)",
|
||||
w, h);
|
||||
|
||||
switch (basetype)
|
||||
{
|
||||
case INDEXED:
|
||||
case RGB:
|
||||
for (i=0;i<w;i++)
|
||||
{
|
||||
for (j=0;j<h;j++)
|
||||
{
|
||||
guchar r,g,b;
|
||||
r = *(tbd++);
|
||||
g = *(tbd++);
|
||||
b = *(tbd++);
|
||||
tbd++;
|
||||
fputc(((r>>5)<<5) | ((g>>5)<<2) | (b>>6), fp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GRAY:
|
||||
for (i=0;i<w;i++)
|
||||
{
|
||||
for (j=0;j<h;j++)
|
||||
{
|
||||
guchar v;
|
||||
v = *(tbd++);
|
||||
tbd++;
|
||||
fputc(((v>>5)<<5) | ((v>>5)<<2) | (v>>6), fp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_warning("UNKNOWN GIMAGE TYPE IN THUMBNAIL SAVE");
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
/* END OF THUMBNAIL SAVING */
|
||||
file_save_thumbnail (gimage, filename, raw_filename);
|
||||
}
|
||||
|
||||
g_free (return_vals);
|
||||
|
@ -1084,7 +1091,12 @@ file_save (GimpImage* gimage,
|
|||
}
|
||||
|
||||
|
||||
static guchar* readXVThumb(gchar *fnam, gint* w, gint* h)
|
||||
/* The readXVThumb function source may be re-used under
|
||||
the XFree86-style license. <adam@gimp.org> */
|
||||
static guchar*
|
||||
readXVThumb(const gchar *fnam,
|
||||
gint* w, gint* h,
|
||||
gchar** imginfo /* caller frees if != NULL */)
|
||||
{
|
||||
FILE *fp;
|
||||
const gchar *P7_332 = "P7 332";
|
||||
|
@ -1094,6 +1106,9 @@ static guchar* readXVThumb(gchar *fnam, gint* w, gint* h)
|
|||
gint twofivefive;
|
||||
void *ptr;
|
||||
|
||||
*w = *h = 0;
|
||||
*imginfo = NULL;
|
||||
|
||||
fp = fopen (fnam, "rb");
|
||||
if (!fp)
|
||||
return (NULL);
|
||||
|
@ -1113,9 +1128,30 @@ static guchar* readXVThumb(gchar *fnam, gint* w, gint* h)
|
|||
do
|
||||
{
|
||||
ptr = fgets(linebuf, 199, fp);
|
||||
if ((strncmp(linebuf, "#IMGINFO:", 9) == 0) &&
|
||||
(linebuf[9] != '\0') &&
|
||||
(linebuf[9] != '\n'))
|
||||
{
|
||||
if (linebuf[strlen(linebuf)-1] == '\n')
|
||||
linebuf[strlen(linebuf)-1] = '\0';
|
||||
|
||||
if (linebuf[9] != '\0')
|
||||
{
|
||||
if (*imginfo)
|
||||
g_free(*imginfo);
|
||||
*imginfo = g_strdup (&linebuf[9]);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (ptr && linebuf[0]=='#'); /* keep throwing away comment lines */
|
||||
|
||||
if (!ptr)
|
||||
{
|
||||
/* g_warning("Thumbnail ended - not an image?"); */
|
||||
fclose(fp);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
sscanf(linebuf, "%d %d %d\n", w, h, &twofivefive);
|
||||
|
||||
if (twofivefive!=255)
|
||||
|
@ -1146,14 +1182,18 @@ static void
|
|||
file_open_clistrow_callback (GtkWidget *w,
|
||||
int client_data)
|
||||
{
|
||||
gchar *rawfname = NULL;
|
||||
gchar *rawfname = NULL;
|
||||
guchar *thumb_rgb;
|
||||
guchar *raw_thumb;
|
||||
gint tnw,tnh;
|
||||
gchar *pname;
|
||||
gchar *fname;
|
||||
gchar *tname;
|
||||
|
||||
gint tnw,tnh;
|
||||
gchar *pname;
|
||||
gchar *fname;
|
||||
gchar *tname;
|
||||
gchar *imginfo;
|
||||
struct stat file_stat;
|
||||
struct stat thumb_stat;
|
||||
gboolean thumb_may_be_outdated = FALSE;
|
||||
|
||||
rawfname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileload));
|
||||
|
||||
pname = g_dirname (rawfname);
|
||||
|
@ -1168,10 +1208,23 @@ file_open_clistrow_callback (GtkWidget *w,
|
|||
/*gtk_clist_get_text(GTK_CLIST(w), client_data, 0, &txt);
|
||||
g_warning ("clique! %p %d %s [%s]", w, client_data, txt, fname);*/
|
||||
|
||||
raw_thumb = readXVThumb(tname, &tnw, &tnh);
|
||||
/* If the file is newer than its thumbnail, the thumbnail may
|
||||
be out of date. */
|
||||
if ((stat(tname, &thumb_stat)==0) &&
|
||||
(stat(rawfname, &file_stat )==0))
|
||||
{
|
||||
if ((thumb_stat.st_mtime) < (file_stat.st_mtime))
|
||||
{
|
||||
thumb_may_be_outdated = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
raw_thumb = readXVThumb(tname, &tnw, &tnh, &imginfo);
|
||||
g_free (tname);
|
||||
|
||||
gtk_frame_set_label (GTK_FRAME(open_options_frame),
|
||||
fname);
|
||||
|
||||
if (raw_thumb)
|
||||
{
|
||||
int i;
|
||||
|
@ -1193,8 +1246,11 @@ file_open_clistrow_callback (GtkWidget *w,
|
|||
gtk_preview_draw_row(open_options_preview, &thumb_rgb[3*i*tnw],
|
||||
0, i,
|
||||
tnw);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL(open_options_label),
|
||||
fname);
|
||||
thumb_may_be_outdated ?
|
||||
"(this thumbnail may be out of date)" :
|
||||
imginfo);
|
||||
gtk_widget_show (open_options_fixed);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(open_options_preview));
|
||||
}
|
||||
|
@ -1204,6 +1260,9 @@ file_open_clistrow_callback (GtkWidget *w,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (imginfo)
|
||||
g_free(imginfo);
|
||||
|
||||
gtk_widget_hide (open_options_fixed);
|
||||
gtk_label_set_text (GTK_LABEL(open_options_label),
|
||||
"no preview available");
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define OVERHEAD 25 /* in units of pixel area */
|
||||
#define EPSILON 5
|
||||
|
||||
|
@ -1210,6 +1211,14 @@ gdisplay_display_area (GDisplay *gdisp,
|
|||
dy = MIN (y2 - i, GXIMAGE_HEIGHT);
|
||||
render_image (gdisp, j - gdisp->disp_xoffset, i - gdisp->disp_yoffset,
|
||||
dx, dy);
|
||||
#if 0
|
||||
/* Invalidate the projection just after we render it! */
|
||||
gimage_invalidate_without_render (gdisp->gimage,
|
||||
j - gdisp->disp_xoffset,
|
||||
i - gdisp->disp_yoffset,
|
||||
dx, dy,
|
||||
0, 0, 0, 0);
|
||||
#endif
|
||||
gximage_put (gdisp->canvas->window,
|
||||
j, i, dx, dy,
|
||||
gdisp->offset_x,
|
||||
|
|
|
@ -99,6 +99,7 @@ gimage_foreach (GFunc func, gpointer user_data);
|
|||
#define gimage_add_channel gimp_image_add_channel
|
||||
#define gimage_remove_channel gimp_image_remove_channel
|
||||
#define gimage_construct gimp_image_construct
|
||||
#define gimage_invalidate_without_render gimp_image_invalidate_without_render
|
||||
#define gimage_invalidate gimp_image_invalidate
|
||||
#define gimage_validate gimp_image_validate
|
||||
#define gimage_is_empty gimp_image_is_empty
|
||||
|
|
|
@ -1332,8 +1332,6 @@ void
|
|||
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
||||
gboolean can_use_cowproject)
|
||||
{
|
||||
|
||||
gimage->construct_flag = 0;
|
||||
#if 0
|
||||
int xoff, yoff;
|
||||
|
||||
|
@ -1342,42 +1340,10 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
*/
|
||||
gimage->construct_flag = 0;
|
||||
|
||||
/*
|
||||
printf("************ [%d] ty:%d by:%d op:%d\n",
|
||||
gimage->construct_flag,
|
||||
gimage_projection_type(gimage),
|
||||
gimage_projection_bytes(gimage),
|
||||
gimage_projection_opacity(gimage)
|
||||
);fflush(stdout);*/
|
||||
|
||||
if (gimage->layers)
|
||||
{
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE((Layer*)(gimage->layers->data)),
|
||||
&xoff, &yoff);
|
||||
#if 0
|
||||
printf("-------\n%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
|
||||
(gimage->layers != NULL) , /* There's a layer. */
|
||||
(!g_slist_next(gimage->layers)) , /* It's the only layer. */
|
||||
(layer_has_alpha((Layer*)(gimage->layers->data))) , /* It's !flat. */
|
||||
/* It's visible. */
|
||||
(drawable_visible (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(drawable_width (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->width) ,
|
||||
(drawable_height (GIMP_DRAWABLE((Layer*)(gimage->layers->data))) ==
|
||||
gimage->height) , /* Covers all. */
|
||||
/* Not indexed. */
|
||||
(!drawable_indexed (GIMP_DRAWABLE((Layer*)(gimage->layers->data)))) ,
|
||||
(((Layer*)(gimage->layers->data))->opacity == OPAQUE_OPACITY) /*opaq */,
|
||||
((xoff==0) && (yoff==0))
|
||||
);fflush(stdout);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* printf("GIMAGE @%p HAS NO LAYERS?! %d\n",
|
||||
gimage,
|
||||
g_slist_length(gimage->layers));
|
||||
fflush(stdout);*/
|
||||
}
|
||||
|
||||
if (/*can_use_cowproject &&*/
|
||||
|
@ -1407,9 +1373,7 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
void * pr;
|
||||
|
||||
g_warning("Can use cow-projection hack. Yay!");
|
||||
/*
|
||||
// gimp_image_initialize_projection (gimage, x, y, w, h);
|
||||
*/
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data
|
||||
(GIMP_DRAWABLE
|
||||
((Layer*)(gimage->layers->data))),
|
||||
|
@ -1417,25 +1381,13 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
pixel_region_init (&destPR,
|
||||
gimp_image_projection (gimage),
|
||||
x, y, w,h, TRUE);
|
||||
/*
|
||||
// tile_manager_set_validate_proc(destPR.tiles, NULL);
|
||||
*/
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR);
|
||||
pr != NULL;
|
||||
pr = pixel_regions_process (pr))
|
||||
{
|
||||
/*if (!tile_is_valid(srcPR.curtile))
|
||||
tile_manager_validate (srcPR.tiles,
|
||||
srcPR.curtile);
|
||||
if (!tile_is_valid(destPR.curtile))
|
||||
tile_manager_validate (destPR.tiles,
|
||||
destPR.curtile);*/
|
||||
tile_lock (destPR.curtile);
|
||||
tile_lock (srcPR.curtile);
|
||||
tile_manager_map_over_tile (destPR.tiles,
|
||||
destPR.curtile, srcPR.curtile);
|
||||
tile_release(srcPR.curtile, FALSE);
|
||||
tile_release(destPR.curtile, TRUE);
|
||||
}
|
||||
|
||||
gimage->construct_flag = 1;
|
||||
|
@ -1443,12 +1395,8 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (gimage->layers)
|
||||
g_warning("Can NOT use cow-projection hack. Boo!");
|
||||
else
|
||||
g_warning("gimage has no layers! Boo!");
|
||||
*/
|
||||
#else
|
||||
gimage->construct_flag = 0;
|
||||
#endif
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
|
@ -1466,8 +1414,39 @@ gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, int y1,
|
||||
int x2, int y2)
|
||||
gimp_image_invalidate_without_render (GimpImage *gimage, int x, int y,
|
||||
int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
int i, j;
|
||||
|
||||
tm = gimp_image_projection (gimage);
|
||||
|
||||
/* invalidate all tiles which are located outside of the displayed area
|
||||
* all tiles inside the displayed area are constructed.
|
||||
*/
|
||||
for (i = y; i < (y + h); i += (TILE_HEIGHT - (i % TILE_HEIGHT)))
|
||||
for (j = x; j < (x + w); j += (TILE_WIDTH - (j % TILE_WIDTH)))
|
||||
{
|
||||
tile = tile_manager_get_tile (tm, j, i, FALSE, FALSE);
|
||||
|
||||
/* check if the tile is outside the bounds */
|
||||
if ((MIN ((j + tile_ewidth(tile)), x2) - MAX (j, x1)) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
|
||||
{
|
||||
tile_invalidate_tile (&tile, tm, j, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h,
|
||||
int x1, int y1, int x2, int y2)
|
||||
{
|
||||
Tile *tile;
|
||||
TileManager *tm;
|
||||
|
|
|
@ -194,6 +194,9 @@ Channel * gimp_image_lower_channel (GimpImage *, Channel *);
|
|||
Channel * gimp_image_add_channel (GimpImage *, Channel *, int);
|
||||
Channel * gimp_image_remove_channel (GimpImage *, Channel *);
|
||||
void gimp_image_construct (GimpImage *, int, int, int, int, gboolean);
|
||||
void gimp_image_invalidate_without_render (GimpImage *, int, int,
|
||||
int, int, int,
|
||||
int, int, int);
|
||||
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
|
||||
void gimp_image_validate (TileManager *, Tile *);
|
||||
|
||||
|
|
|
@ -600,19 +600,28 @@ layer_apply_mask (layer, mode)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
|
||||
static void
|
||||
layer_translate_lowlevel (layer, off_x, off_y, temporary)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
gboolean temporary;
|
||||
{
|
||||
/* the undo call goes here */
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* the undo call goes here */
|
||||
/*g_warning ("setting undo for layer translation");*/
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
}
|
||||
|
||||
/* update the affected region */
|
||||
drawable_update (GIMP_DRAWABLE(layer), 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
|
||||
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
}
|
||||
|
||||
/* update the layer offsets */
|
||||
GIMP_DRAWABLE(layer)->offset_x += off_x;
|
||||
|
@ -625,12 +634,34 @@ layer_translate (layer, off_x, off_y)
|
|||
{
|
||||
GIMP_DRAWABLE(layer->mask)->offset_x += off_x;
|
||||
GIMP_DRAWABLE(layer->mask)->offset_y += off_y;
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_temporarily_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, TRUE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -90,6 +90,7 @@ LayerMask * layer_create_mask (Layer *, AddMaskType);
|
|||
Layer * layer_get_ID (int);
|
||||
void layer_delete (Layer *);
|
||||
void layer_apply_mask (Layer *, int);
|
||||
void layer_temporarily_translate (Layer *, int, int);
|
||||
void layer_translate (Layer *, int, int);
|
||||
void layer_add_alpha (Layer *);
|
||||
void layer_scale (Layer *, int, int, int);
|
||||
|
|
|
@ -870,6 +870,7 @@ render_image_tile_fault (RenderInfo *info)
|
|||
int width;
|
||||
int tilex;
|
||||
int tiley;
|
||||
int srctilex, srctiley;
|
||||
int step;
|
||||
int bpp = info->src_bpp;
|
||||
int x, b;
|
||||
|
@ -877,7 +878,9 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tilex = info->src_x / TILE_WIDTH;
|
||||
tiley = info->src_y / TILE_HEIGHT;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, info->src_x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles,
|
||||
srctilex=info->src_x, srctiley=info->src_y,
|
||||
TRUE, FALSE);
|
||||
if (!tile)
|
||||
return NULL;
|
||||
|
||||
|
@ -906,7 +909,8 @@ render_image_tile_fault (RenderInfo *info)
|
|||
tile_release (tile, FALSE);
|
||||
tilex += 1;
|
||||
|
||||
tile = tile_manager_get_tile (info->src_tiles, x, info->src_y, TRUE, FALSE);
|
||||
tile = tile_manager_get_tile (info->src_tiles, srctilex=x,
|
||||
srctiley=info->src_y, TRUE, FALSE);
|
||||
if (!tile)
|
||||
return tile_buf;
|
||||
|
||||
|
|
47
app/layer.c
47
app/layer.c
|
@ -600,19 +600,28 @@ layer_apply_mask (layer, mode)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
|
||||
static void
|
||||
layer_translate_lowlevel (layer, off_x, off_y, temporary)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
gboolean temporary;
|
||||
{
|
||||
/* the undo call goes here */
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* the undo call goes here */
|
||||
/*g_warning ("setting undo for layer translation");*/
|
||||
undo_push_layer_displace (GIMP_DRAWABLE(layer)->gimage, layer);
|
||||
}
|
||||
|
||||
/* update the affected region */
|
||||
drawable_update (GIMP_DRAWABLE(layer), 0, 0, GIMP_DRAWABLE(layer)->width, GIMP_DRAWABLE(layer)->height);
|
||||
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the selection boundary because of a layer modification */
|
||||
layer_invalidate_boundary (layer);
|
||||
}
|
||||
|
||||
/* update the layer offsets */
|
||||
GIMP_DRAWABLE(layer)->offset_x += off_x;
|
||||
|
@ -625,12 +634,34 @@ layer_translate (layer, off_x, off_y)
|
|||
{
|
||||
GIMP_DRAWABLE(layer->mask)->offset_x += off_x;
|
||||
GIMP_DRAWABLE(layer->mask)->offset_y += off_y;
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
|
||||
if (!temporary)
|
||||
{
|
||||
/* invalidate the mask preview */
|
||||
drawable_invalidate_preview (GIMP_DRAWABLE(layer->mask));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_temporarily_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, TRUE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
layer_translate (layer, off_x, off_y)
|
||||
Layer * layer;
|
||||
int off_x, off_y;
|
||||
{
|
||||
layer_translate_lowlevel (layer, off_x, off_y, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
|
|
|
@ -90,6 +90,7 @@ LayerMask * layer_create_mask (Layer *, AddMaskType);
|
|||
Layer * layer_get_ID (int);
|
||||
void layer_delete (Layer *);
|
||||
void layer_apply_mask (Layer *, int);
|
||||
void layer_temporarily_translate (Layer *, int, int);
|
||||
void layer_translate (Layer *, int, int);
|
||||
void layer_add_alpha (Layer *);
|
||||
void layer_scale (Layer *, int, int, int);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static int tile_manager_get_tile_num (TileManager *tm,
|
||||
int xpixel,
|
||||
int ypixel);
|
||||
|
|
|
@ -39,24 +39,24 @@ typedef struct _edit_selection EditSelection;
|
|||
|
||||
struct _edit_selection
|
||||
{
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x2, y2;
|
||||
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
|
||||
DrawCore * core; /* selection core for drawing bounds */
|
||||
DrawCore * core; /* selection core for drawing bounds*/
|
||||
|
||||
ButtonReleaseFunc old_button_release; /* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
ButtonReleaseFunc old_button_release;/* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
||||
|
@ -234,7 +234,15 @@ edit_selection_button_release (Tool *tool,
|
|||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
{
|
||||
/* Temporarily shift back to the original
|
||||
position so that undo information is updated
|
||||
properly... bit of a hack. DISABLED */
|
||||
/*layer_temporarily_translate (layer,
|
||||
edit_select.origx - x,
|
||||
edit_select.origy - y);*/
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
|
@ -287,15 +295,55 @@ edit_selection_motion (Tool *tool,
|
|||
GDisplay * gdisp;
|
||||
gchar offset[STATUSBAR_SIZE];
|
||||
|
||||
/* g_warning("motion");*/
|
||||
|
||||
if (tool->state != ACTIVE)
|
||||
return;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
gdk_flush();
|
||||
|
||||
draw_core_pause (edit_select.core, tool);
|
||||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
|
||||
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
|
||||
|
@ -320,6 +368,9 @@ edit_selection_draw (Tool *tool)
|
|||
int x3, y3, x4, y4;
|
||||
int off_x, off_y;
|
||||
|
||||
/*static int ggg = 0;
|
||||
g_warning("draw %d", ggg++);*/
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
select = gdisp->select;
|
||||
|
||||
|
@ -429,6 +480,41 @@ edit_selection_draw (Tool *tool)
|
|||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
|
|
@ -39,24 +39,24 @@ typedef struct _edit_selection EditSelection;
|
|||
|
||||
struct _edit_selection
|
||||
{
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
int origx, origy; /* original x and y coords */
|
||||
int x, y; /* current x and y coords */
|
||||
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x1, y1; /* bounding box of selection mask */
|
||||
int x2, y2;
|
||||
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
EditType edit_type; /* translate the mask or layer? */
|
||||
|
||||
DrawCore * core; /* selection core for drawing bounds */
|
||||
DrawCore * core; /* selection core for drawing bounds*/
|
||||
|
||||
ButtonReleaseFunc old_button_release; /* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
ButtonReleaseFunc old_button_release;/* old button press member func */
|
||||
MotionFunc old_motion; /* old motion member function */
|
||||
ToolCtlFunc old_control; /* old control member function */
|
||||
CursorUpdateFunc old_cursor_update; /* old cursor update function */
|
||||
int old_scroll_lock; /* old value of scroll lock */
|
||||
int old_auto_snap_to; /* old value of auto snap to */
|
||||
|
||||
guint context_id; /* for the statusbar */
|
||||
guint context_id; /* for the statusbar */
|
||||
};
|
||||
|
||||
|
||||
|
@ -234,7 +234,15 @@ edit_selection_button_release (Tool *tool,
|
|||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
{
|
||||
/* Temporarily shift back to the original
|
||||
position so that undo information is updated
|
||||
properly... bit of a hack. DISABLED */
|
||||
/*layer_temporarily_translate (layer,
|
||||
edit_select.origx - x,
|
||||
edit_select.origy - y);*/
|
||||
layer_translate (layer, (x - edit_select.origx), (y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
|
@ -287,15 +295,55 @@ edit_selection_motion (Tool *tool,
|
|||
GDisplay * gdisp;
|
||||
gchar offset[STATUSBAR_SIZE];
|
||||
|
||||
/* g_warning("motion");*/
|
||||
|
||||
if (tool->state != ACTIVE)
|
||||
return;
|
||||
|
||||
gdisp = (GDisplay *) gdisp_ptr;
|
||||
|
||||
gdk_flush();
|
||||
|
||||
draw_core_pause (edit_select.core, tool);
|
||||
|
||||
edit_selection_snap (gdisp, mevent->x, mevent->y);
|
||||
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR(gdisp->statusbar), edit_select.context_id);
|
||||
g_snprintf (offset, STATUSBAR_SIZE, _("Move: %d, %d"),
|
||||
(edit_select.x - edit_select.origx), (edit_select.y - edit_select.origy));
|
||||
|
@ -320,6 +368,9 @@ edit_selection_draw (Tool *tool)
|
|||
int x3, y3, x4, y4;
|
||||
int off_x, off_y;
|
||||
|
||||
/*static int ggg = 0;
|
||||
g_warning("draw %d", ggg++);*/
|
||||
|
||||
gdisp = (GDisplay *) tool->gdisp_ptr;
|
||||
select = gdisp->select;
|
||||
|
||||
|
@ -429,6 +480,41 @@ edit_selection_draw (Tool *tool)
|
|||
edit_select.core->gc, 0,
|
||||
x1 + diff_x, y1 + diff_y,
|
||||
(x2 - x1) - 1, (y2 - y1) - 1);
|
||||
#if 0
|
||||
#warning ADAM MADNESS
|
||||
if (edit_select.edit_type == LayerTranslate)
|
||||
{
|
||||
int x = edit_select.x;
|
||||
int y = edit_select.y;
|
||||
Layer* floating_layer;
|
||||
Layer* layer;
|
||||
GSList* layer_list;
|
||||
|
||||
if ((floating_layer = gimage_floating_sel (gdisp->gimage)))
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
/* translate the layer--and any "linked" layers as well */
|
||||
layer_list = gdisp->gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
layer = (Layer *) layer_list->data;
|
||||
if (layer == gdisp->gimage->active_layer ||
|
||||
layer_linked (layer))
|
||||
{
|
||||
layer_temporarily_translate (layer,
|
||||
(x - edit_select.origx),
|
||||
(y - edit_select.origy));
|
||||
}
|
||||
layer_list = g_slist_next (layer_list);
|
||||
}
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
gdisplays_flush();
|
||||
}
|
||||
#warning END OF ADAM MADNESS
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FloatingSelTranslate:
|
||||
|
|
Loading…
Reference in New Issue