reverted last change as the code in tile-pyramid does care about the pixel

2008-11-04  Sven Neumann  <sven@sven>

	* app/base/tile-pyramid.[ch] (tile_pyramid_new):
	* app/core/gimpprojection.c 
(gimp_projection_get_tiles_at_level):
	reverted last change as the code in tile-pyramid does care about
	the pixel format and it should continue to reject types that it
	cannot handle.


svn path=/trunk/; revision=27545
This commit is contained in:
Sven Neumann 2008-11-04 09:07:38 +00:00 committed by Sven Neumann
parent 6f300a579c
commit b5ff19f743
3 changed files with 42 additions and 17 deletions

View File

@ -32,11 +32,12 @@
struct _TilePyramid
{
guint width;
guint height;
gint bytes;
TileManager *tiles[PYRAMID_MAX_LEVELS];
gint top_level;
GimpImageType type;
guint width;
guint height;
gint bytes;
TileManager *tiles[PYRAMID_MAX_LEVELS];
gint top_level;
};
@ -60,9 +61,9 @@ static void tile_pyramid_write_upper_quarter (Tile *dest,
/**
* tile_pyramid_new:
* @type: type of pixel data stored in the pyramid
* @width: bottom level width
* @height: bottom level height
* @bytes: the bpp of the pixel data stored in the pyramid
*
* Creates a new #TilePyramid, managing a set of tile-managers where
* each level is a sized-down version of the level below.
@ -78,9 +79,9 @@ static void tile_pyramid_write_upper_quarter (Tile *dest,
* Return value: a newly allocate #TilePyramid
**/
TilePyramid *
tile_pyramid_new (gint width,
gint height,
gint bytes)
tile_pyramid_new (GimpImageType type,
gint width,
gint height)
{
TilePyramid *pyramid;
@ -89,11 +90,35 @@ tile_pyramid_new (gint width,
pyramid = g_slice_new0 (TilePyramid);
pyramid->type = type;
pyramid->width = width;
pyramid->height = height;
pyramid->bytes = bytes;
pyramid->tiles[0] = tile_manager_new (width, height, bytes);
switch (type)
{
case GIMP_GRAY_IMAGE:
pyramid->bytes = 1;
break;
case GIMP_GRAYA_IMAGE:
pyramid->bytes = 2;
break;
case GIMP_RGB_IMAGE:
pyramid->bytes = 3;
break;
case GIMP_RGBA_IMAGE:
pyramid->bytes = 4;
break;
case GIMP_INDEXED_IMAGE:
case GIMP_INDEXEDA_IMAGE:
g_assert_not_reached ();
break;
}
pyramid->tiles[0] = tile_manager_new (width, height, pyramid->bytes);
return pyramid;
}

View File

@ -29,9 +29,9 @@
* is "nlevels - 1". That level will be smaller than TILE_WIDTH x
* TILE_HEIGHT
*/
TilePyramid * tile_pyramid_new (gint width,
gint height,
gint bytes);
TilePyramid * tile_pyramid_new (GimpImageType type,
gint width,
gint height);
void tile_pyramid_destroy (TilePyramid *pyramid);
gint tile_pyramid_get_level (gint width,

View File

@ -372,9 +372,9 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
if (! proj->pyramid)
{
proj->pyramid = tile_pyramid_new (gimp_image_get_width (proj->image),
gimp_image_get_height (proj->image),
gimp_projection_get_bytes (proj));
proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
gimp_image_get_width (proj->image),
gimp_image_get_height (proj->image));
tile_pyramid_set_validate_proc (proj->pyramid,
(TileValidateProc) gimp_projection_validate_tile,