ok, i modified *way* more files than CVS is telling me....

ok, i modified *way* more files than CVS is telling me....

- add canvas_init machinery (tile_manager_validate equivalent)
- fix bugs in compositing code
- layers/channels dialog, previews
- all color handling should be fairly precision independent now
- replaced gimage_type and gimage_base_type with Tags
- remove concept of flat vs. layered gimages

ray lehtiniemi <rayl@netrover.com>
This commit is contained in:
People doing a 16 bpc version of gimp 1998-08-20 00:35:40 +00:00
parent 2124379b6e
commit 8868daee7f
34 changed files with 586 additions and 1685 deletions

View file

@ -152,7 +152,7 @@ airbrush_paint_func (PaintCore *paint_core,
switch (state)
{
case INIT_PAINT :
// timer_state = OFF;
/* timer_state = OFF; */
if (timer_state == ON)
{
g_warning ("killing stray timer, please report to lewing@gimp.org");

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -55,17 +55,6 @@ GSList * display_list = NULL;
static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
static char *image_type_strs[] =
{
"RGB",
"RGB-alpha",
"grayscale",
"grayscale-alpha",
"indexed",
"indexed-alpha"
};
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_delete (GDisplay *);
@ -160,23 +149,20 @@ gdisplay_format_title (GimpImage *gimage,
empty = gimage_is_empty (gimage);
if (gimage_is_flat (gimage))
image_type_str = image_type_strs[drawable_type (gimage_active_drawable (gimage))];
else
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB-layered";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale-layered";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed-layered";
break;
default:
image_type_str = NULL;
}
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed";
break;
default:
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),

View file

@ -184,7 +184,6 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
int flat;
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
@ -198,21 +197,14 @@ info_window_update (InfoDialog *info_win,
SCALEDEST (gdisp), SCALESRC (gdisp));
type = gimage_base_type (gdisp->gimage);
flat = gimage_is_flat (gdisp->gimage);
/* color type */
if (type == RGB && flat)
if (type == RGB)
sprintf (iwd->color_type_str, "%s", "RGB Color");
else if (type == GRAY && flat)
else if (type == GRAY)
sprintf (iwd->color_type_str, "%s", "Grayscale");
else if (type == INDEXED && flat)
else if (type == INDEXED)
sprintf (iwd->color_type_str, "%s", "Indexed Color");
if (type == RGB && !flat)
sprintf (iwd->color_type_str, "%s", "RGB-alpha Color");
else if (type == GRAY && !flat)
sprintf (iwd->color_type_str, "%s", "Grayscale-alpha");
else if (type == INDEXED && !flat)
sprintf (iwd->color_type_str, "%s", "Indexed-alpha Color");
/* visual class */
if (type == RGB ||

View file

@ -2343,6 +2343,7 @@ render_image_init_info (RenderInfo *info,
int h)
{
info->gdisp = gdisp;
info->src_tiles = gimage_projection (gdisp->gimage);
info->x = x + gdisp->offset_x;
info->y = y + gdisp->offset_y;
info->w = w;
@ -2357,7 +2358,6 @@ render_image_init_info (RenderInfo *info,
info->dest_bpl = gximage_get_bpl ();
info->dest_width = info->w * info->dest_bpp;
info->byte_order = gximage_get_byte_order ();
info->src_tiles = gimage_projection (gdisp->gimage);
info->scale = render_image_accelerate_scaling (w, info->x, info->src_bpp, info->scalesrc, info->scaledest);
info->alpha = NULL;

View file

@ -55,17 +55,6 @@ GSList * display_list = NULL;
static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
static char *image_type_strs[] =
{
"RGB",
"RGB-alpha",
"grayscale",
"grayscale-alpha",
"indexed",
"indexed-alpha"
};
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_delete (GDisplay *);
@ -160,23 +149,20 @@ gdisplay_format_title (GimpImage *gimage,
empty = gimage_is_empty (gimage);
if (gimage_is_flat (gimage))
image_type_str = image_type_strs[drawable_type (gimage_active_drawable (gimage))];
else
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB-layered";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale-layered";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed-layered";
break;
default:
image_type_str = NULL;
}
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed";
break;
default:
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),

View file

@ -2343,6 +2343,7 @@ render_image_init_info (RenderInfo *info,
int h)
{
info->gdisp = gdisp;
info->src_tiles = gimage_projection (gdisp->gimage);
info->x = x + gdisp->offset_x;
info->y = y + gdisp->offset_y;
info->w = w;
@ -2357,7 +2358,6 @@ render_image_init_info (RenderInfo *info,
info->dest_bpl = gximage_get_bpl ();
info->dest_width = info->w * info->dest_bpp;
info->byte_order = gximage_get_byte_order ();
info->src_tiles = gimage_projection (gdisp->gimage);
info->scale = render_image_accelerate_scaling (w, info->x, info->src_bpp, info->scalesrc, info->scaledest);
info->alpha = NULL;

View file

@ -55,17 +55,6 @@ GSList * display_list = NULL;
static int display_num = 1;
static GdkCursorType default_gdisplay_cursor = GDK_TOP_LEFT_ARROW;
static char *image_type_strs[] =
{
"RGB",
"RGB-alpha",
"grayscale",
"grayscale-alpha",
"indexed",
"indexed-alpha"
};
/* Local functions */
static void gdisplay_format_title (GimpImage *, char *);
static void gdisplay_delete (GDisplay *);
@ -160,23 +149,20 @@ gdisplay_format_title (GimpImage *gimage,
empty = gimage_is_empty (gimage);
if (gimage_is_flat (gimage))
image_type_str = image_type_strs[drawable_type (gimage_active_drawable (gimage))];
else
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB-layered";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale-layered";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed-layered";
break;
default:
image_type_str = NULL;
}
switch (gimage_base_type (gimage))
{
case RGB:
image_type_str = (empty) ? "RGB-empty" : "RGB";
break;
case GRAY:
image_type_str = (empty) ? "grayscale-empty" : "grayscale";
break;
case INDEXED:
image_type_str = (empty) ? "indexed-empty" : "indexed";
break;
default:
image_type_str = NULL;
}
g_snprintf (title, MAX_TITLE_BUF, "%s-%d.%d (%s)",
prune_filename (gimage_filename (gimage)),

View file

@ -95,9 +95,6 @@ gimage_foreach (GFunc func, gpointer user_data);
#define gimage_construct gimp_image_construct
#define gimage_invalidate gimp_image_invalidate
#define gimage_validate gimp_image_validate
#define gimage_inflate gimp_image_inflate
#define gimage_deflate gimp_image_deflate
#define gimage_is_flat gimp_image_is_flat
#define gimage_is_empty gimp_image_is_empty
#define gimage_active_drawable gimp_image_active_drawable
#define gimage_base_type gimp_image_base_type

View file

@ -129,7 +129,6 @@ static void gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->dirty = 1;
gimage->undo_on = TRUE;
gimage->flat = TRUE;
gimage->construct_flag = -1;
gimage->projection = NULL;
gimage->guides = NULL;
@ -1177,27 +1176,23 @@ gimp_image_get_active_channels (GimpImage *gimage, GimpDrawable *drawable, int *
void
gimp_image_construct (GimpImage *gimage, int x, int y, int w, int h)
{
/* if the gimage is not flat, construction is necessary. */
if (! gimp_image_is_flat (gimage))
{
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
/* set the construct flag, used to determine if anything
* has been written to the gimage raw image yet.
*/
gimage->construct_flag = 0;
/* First, determine if the projection image needs to be
* initialized--this is the case when there are no visible
* layers that cover the entire canvas--either because layers
* are offset or only a floating selection is visible
*/
gimp_image_initialize_projection (gimage, x, y, w, h);
/* call functions which process the list of layers and
* the list of channels
*/
gimp_image_construct_layers (gimage, x, y, w, h);
gimp_image_construct_channels (gimage, x, y, w, h);
}
void
@ -1210,9 +1205,7 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
int startx, starty;
int endx, endy;
int tilex, tiley;
int flat;
flat = gimp_image_is_flat (gimage);
tm = gimp_image_projection (gimage);
startx = x;
@ -1231,47 +1224,44 @@ gimp_image_invalidate (GimpImage *gimage, int x, int y, int w, int h, int x1, in
/* invalidate all lower level tiles */
/*tile_manager_invalidate_tiles (gimp_image_projection (gimage), tile);*/
if (! flat)
{
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
/* 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);
if (j < x1)
startx = MAX (startx, (j + tile_ewidth(tile)));
else
endx = MIN (endx, j);
}
else if (MIN ((i + tile_eheight(tile)), y2) - MAX (i, y1) <= 0)
{
tile_invalidate_tile (&tile, tm, j, i);
if (i < y1)
starty = MAX (starty, (i + tile_eheight(tile)));
else
endy = MIN (endy, i);
}
else
{
/* If the tile is not valid, make sure we get the entire tile
* in the construction extents
*/
if (tile_is_valid(tile) == FALSE)
{
tilex = j - (j % TILE_WIDTH);
tiley = i - (i % TILE_HEIGHT);
startx = MIN (startx, tilex);
endx = MAX (endx, tilex + tile_ewidth(tile));
starty = MIN (starty, tiley);
endy = MAX (endy, tiley + tile_eheight(tile));
tile_mark_valid (tile); /* hmmmmmmm..... */
}
}
}
if (! flat && (endx - startx) > 0 && (endy - starty) > 0)
if ((endx - startx) > 0 && (endy - starty) > 0)
gimp_image_construct (gimage, startx, starty, (endx - startx), (endy - starty));
}
@ -2373,68 +2363,6 @@ gimp_image_remove_channel (GimpImage *gimage, Channel *channel)
/* Access functions */
/************************************************************/
int
gimp_image_is_flat (GimpImage *gimage)
{
Layer *layer;
int ac_visible = TRUE;
int flat = TRUE;
int off_x, off_y;
/* Are there no layers? */
if (gimp_image_is_empty (gimage))
flat = FALSE;
/* Is there more than one layer? */
else if (gimage->layers->next)
flat = FALSE;
else
{
/* determine if all channels are visible */
int a, b;
layer = gimage->layers->data;
a = layer_has_alpha (layer) ? drawable_bytes (GIMP_DRAWABLE(layer)) - 1 : drawable_bytes (GIMP_DRAWABLE(layer));
for (b = 0; b < a; b++)
if (gimage->visible[b] == FALSE)
ac_visible = FALSE;
/* What makes a flat image?
* 1) the solitary layer is exactly gimage-sized and placed
* 2) no layer mask
* 3) opacity == OPAQUE_OPACITY
* 4) all channels must be visible
*/
drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
if ((drawable_width (GIMP_DRAWABLE(layer)) != gimage->width) ||
(drawable_height (GIMP_DRAWABLE(layer)) != gimage->height) ||
(off_x != 0) ||
(off_y != 0) ||
(layer->mask != NULL) ||
(layer->opacity != OPAQUE_OPACITY) ||
(ac_visible == FALSE))
flat = FALSE;
}
/* Are there any channels? */
if (gimage->channels)
flat = FALSE;
/* AUGH! This is supposed to be a _predicate_ function */
if (gimage->flat != flat)
{
if (flat)
gimp_image_free_projection (gimage);
else
gimp_image_allocate_projection (gimage);
gimage->flat=flat;
gtk_signal_emit(GTK_OBJECT(gimage),
gimp_image_signals[RESTRUCTURE]);
}
return gimage->flat;
}
int
gimp_image_is_empty (GimpImage *gimage)
{
@ -2561,90 +2489,36 @@ gimp_image_cmap (GimpImage *gimage)
TileManager *
gimp_image_projection (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the data of the
* first layer...Otherwise, we'll pass back the projection
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = gimage->active_layer))
return drawable_data (GIMP_DRAWABLE(layer));
else
return NULL;
}
else
{
if ((tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
if ((gimage->projection == NULL) ||
(tile_manager_level_width (gimage->projection) != gimage->width) ||
(tile_manager_level_height (gimage->projection) != gimage->height))
gimp_image_allocate_projection (gimage);
return gimage->projection;
}
int
gimp_image_projection_type (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the type of the
* first layer...Otherwise, we'll pass back the proj_type
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_type (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_type;
return gimage->proj_type;
}
int
gimp_image_projection_bytes (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, we simply want the bytes in the
* first layer...Otherwise, we'll pass back the proj_bytes
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return drawable_bytes (GIMP_DRAWABLE(layer));
else
return -1;
}
else
return gimage->proj_bytes;
return gimage->proj_bytes;
}
int
gimp_image_projection_opacity (GimpImage *gimage)
{
Layer * layer;
/* If the gimage is flat, return the opacity of the active layer
* Otherwise, we'll pass back OPAQUE_OPACITY
*/
if (gimp_image_is_flat (gimage))
{
if ((layer = (gimage->active_layer)))
return layer->opacity;
else
return OPAQUE_OPACITY;
}
else
return OPAQUE_OPACITY;
return OPAQUE_OPACITY;
}
void
gimp_image_projection_realloc (GimpImage *gimage)
{
if (! gimp_image_is_flat (gimage))
gimp_image_allocate_projection (gimage);
gimp_image_allocate_projection (gimage);
}
/************************************************************/

View file

@ -158,13 +158,10 @@ Channel * gimp_image_remove_channel (GimpImage *, Channel *);
void gimp_image_construct (GimpImage *, int, int, int, int);
void gimp_image_invalidate (GimpImage *, int, int, int, int, int, int, int, int);
void gimp_image_validate (TileManager *, Tile *);
void gimp_image_inflate (GimpImage *);
void gimp_image_deflate (GimpImage *);
/* Access functions */
int gimp_image_is_flat (GimpImage *);
int gimp_image_is_empty (GimpImage *);
GimpDrawable * gimp_image_active_drawable (GimpImage *);
int gimp_image_base_type (GimpImage *);

View file

@ -33,7 +33,6 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
int flat; /* Is the gimp_image flat? */
int construct_flag; /* flag for construction */
int proj_type; /* type of the projection image */
int proj_bytes; /* bpp in projection image */

View file

@ -184,7 +184,6 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
int flat;
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
@ -198,21 +197,14 @@ info_window_update (InfoDialog *info_win,
SCALEDEST (gdisp), SCALESRC (gdisp));
type = gimage_base_type (gdisp->gimage);
flat = gimage_is_flat (gdisp->gimage);
/* color type */
if (type == RGB && flat)
if (type == RGB)
sprintf (iwd->color_type_str, "%s", "RGB Color");
else if (type == GRAY && flat)
else if (type == GRAY)
sprintf (iwd->color_type_str, "%s", "Grayscale");
else if (type == INDEXED && flat)
else if (type == INDEXED)
sprintf (iwd->color_type_str, "%s", "Indexed Color");
if (type == RGB && !flat)
sprintf (iwd->color_type_str, "%s", "RGB-alpha Color");
else if (type == GRAY && !flat)
sprintf (iwd->color_type_str, "%s", "Grayscale-alpha");
else if (type == INDEXED && !flat)
sprintf (iwd->color_type_str, "%s", "Indexed-alpha Color");
/* visual class */
if (type == RGB ||

View file

@ -799,13 +799,14 @@ create_image_menu (GimpImage** def,
int *default_index,
MenuItemCallback callback)
{
IMCBData data = {
def,
default_index,
callback,
gtk_menu_new (),
0,
NULL};
IMCBData data;
data.def = def;
data.default_index = default_index;
data.callback = callback;
data.menu = gtk_menu_new ();
data.num_items = 0;
data.id = NULL;
*default_index = -1;

View file

@ -2343,6 +2343,7 @@ render_image_init_info (RenderInfo *info,
int h)
{
info->gdisp = gdisp;
info->src_tiles = gimage_projection (gdisp->gimage);
info->x = x + gdisp->offset_x;
info->y = y + gdisp->offset_y;
info->w = w;
@ -2357,7 +2358,6 @@ render_image_init_info (RenderInfo *info,
info->dest_bpl = gximage_get_bpl ();
info->dest_width = info->w * info->dest_bpp;
info->byte_order = gximage_get_byte_order ();
info->src_tiles = gimage_projection (gdisp->gimage);
info->scale = render_image_accelerate_scaling (w, info->x, info->src_bpp, info->scalesrc, info->scaledest);
info->alpha = NULL;

View file

@ -503,13 +503,14 @@ create_image_menu (GimpImage** def,
int *default_index,
MenuItemCallback callback)
{
IMCBData data = {
def,
default_index,
callback,
gtk_menu_new (),
0,
NULL};
IMCBData data;
data.def = def;
data.default_index = default_index;
data.callback = callback;
data.menu = gtk_menu_new ();
data.num_items = 0;
data.id = NULL;
*default_index = -1;

View file

@ -184,7 +184,6 @@ info_window_update (InfoDialog *info_win,
GDisplay *gdisp;
InfoWinData *iwd;
int type;
int flat;
gdisp = (GDisplay *) gdisp_ptr;
iwd = (InfoWinData *) info_win->user_data;
@ -198,21 +197,14 @@ info_window_update (InfoDialog *info_win,
SCALEDEST (gdisp), SCALESRC (gdisp));
type = gimage_base_type (gdisp->gimage);
flat = gimage_is_flat (gdisp->gimage);
/* color type */
if (type == RGB && flat)
if (type == RGB)
sprintf (iwd->color_type_str, "%s", "RGB Color");
else if (type == GRAY && flat)
else if (type == GRAY)
sprintf (iwd->color_type_str, "%s", "Grayscale");
else if (type == INDEXED && flat)
else if (type == INDEXED)
sprintf (iwd->color_type_str, "%s", "Indexed Color");
if (type == RGB && !flat)
sprintf (iwd->color_type_str, "%s", "RGB-alpha Color");
else if (type == GRAY && !flat)
sprintf (iwd->color_type_str, "%s", "Grayscale-alpha");
else if (type == INDEXED && !flat)
sprintf (iwd->color_type_str, "%s", "Indexed-alpha Color");
/* visual class */
if (type == RGB ||

View file

@ -799,13 +799,14 @@ create_image_menu (GimpImage** def,
int *default_index,
MenuItemCallback callback)
{
IMCBData data = {
def,
default_index,
callback,
gtk_menu_new (),
0,
NULL};
IMCBData data;
data.def = def;
data.default_index = default_index;
data.callback = callback;
data.menu = gtk_menu_new ();
data.num_items = 0;
data.id = NULL;
*default_index = -1;

View file

@ -152,7 +152,7 @@ airbrush_paint_func (PaintCore *paint_core,
switch (state)
{
case INIT_PAINT :
// timer_state = OFF;
/* timer_state = OFF; */
if (timer_state == ON)
{
g_warning ("killing stray timer, please report to lewing@gimp.org");

View file

@ -152,7 +152,7 @@ airbrush_paint_func (PaintCore *paint_core,
switch (state)
{
case INIT_PAINT :
// timer_state = OFF;
/* timer_state = OFF; */
if (timer_state == ON)
{
g_warning ("killing stray timer, please report to lewing@gimp.org");

View file

@ -152,7 +152,7 @@ airbrush_paint_func (PaintCore *paint_core,
switch (state)
{
case INIT_PAINT :
// timer_state = OFF;
/* timer_state = OFF; */
if (timer_state == ON)
{
g_warning ("killing stray timer, please report to lewing@gimp.org");