mirror of https://github.com/GNOME/gimp.git
determine the src_base_type from the passed drawable, not from the image
2002-05-28 Sven Neumann <sven@gimp.org> * app/core/gimplayer.c (gimp_layer_new_from_drawable): determine the src_base_type from the passed drawable, not from the image it is attached to. * app/core/gimpimage-convert.c (gimp_drawable_convert_rgb) (gimp_drawable_convert_grayscale): added a check for the expected bpp of the passed tile_manager.
This commit is contained in:
parent
d453d02362
commit
bb32c3c267
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2002-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimplayer.c (gimp_layer_new_from_drawable): determine
|
||||
the src_base_type from the passed drawable, not from the image it
|
||||
is attached to.
|
||||
|
||||
* app/core/gimpimage-convert.c (gimp_drawable_convert_rgb)
|
||||
(gimp_drawable_convert_grayscale): added a check for the expected
|
||||
bpp of the passed tile_manager.
|
||||
|
||||
2002-05-28 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/base/base-config.[ch]
|
||||
|
|
|
@ -763,7 +763,7 @@ gimp_image_convert (GimpImage *gimage,
|
|||
/* Convert to indexed? Build histogram if necessary. */
|
||||
if (new_type == GIMP_INDEXED)
|
||||
{
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
/* fprintf(stderr, " TO INDEXED(%d) ", num_cols); */
|
||||
|
||||
|
@ -1048,6 +1048,8 @@ gimp_drawable_convert_rgb (GimpDrawable *drawable,
|
|||
|
||||
has_alpha = gimp_drawable_has_alpha (drawable);
|
||||
|
||||
g_return_if_fail (tile_manager_bpp (new_tiles) == (has_alpha ? 4 : 3));
|
||||
|
||||
pixel_region_init (&srcPR, drawable->tiles,
|
||||
0, 0,
|
||||
drawable->width,
|
||||
|
@ -1139,6 +1141,8 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
|
|||
|
||||
has_alpha = gimp_drawable_has_alpha (drawable);
|
||||
|
||||
g_return_if_fail (tile_manager_bpp (new_tiles) == (has_alpha ? 2 : 1));
|
||||
|
||||
pixel_region_init (&srcPR, drawable->tiles,
|
||||
0, 0,
|
||||
drawable->width,
|
||||
|
|
|
@ -449,17 +449,14 @@ GimpLayer *
|
|||
gimp_layer_new_from_drawable (GimpDrawable *drawable,
|
||||
GimpImage *dest_image)
|
||||
{
|
||||
GimpImage *src_image;
|
||||
GimpImageBaseType old_base_type;
|
||||
GimpImageBaseType src_base_type;
|
||||
GimpDrawable *new_drawable;
|
||||
GimpImageBaseType new_base_type;
|
||||
|
||||
g_return_val_if_fail (GIMP_DRAWABLE (drawable), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (dest_image), NULL);
|
||||
|
||||
src_image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
old_base_type = gimp_image_base_type (src_image);
|
||||
src_base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
|
||||
new_base_type = gimp_image_base_type (dest_image);
|
||||
|
||||
if (GIMP_IS_LAYER (drawable))
|
||||
|
@ -475,7 +472,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
|
|||
TRUE);
|
||||
}
|
||||
|
||||
if (old_base_type != new_base_type)
|
||||
if (src_base_type != new_base_type)
|
||||
{
|
||||
TileManager *new_tiles;
|
||||
GimpImageType new_type;
|
||||
|
@ -494,13 +491,13 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
|
|||
case GIMP_RGB:
|
||||
gimp_drawable_convert_rgb (new_drawable,
|
||||
new_tiles,
|
||||
old_base_type);
|
||||
src_base_type);
|
||||
break;
|
||||
|
||||
case GIMP_GRAY:
|
||||
gimp_drawable_convert_grayscale (new_drawable,
|
||||
new_tiles,
|
||||
old_base_type);
|
||||
src_base_type);
|
||||
break;
|
||||
|
||||
case GIMP_INDEXED:
|
||||
|
@ -522,7 +519,7 @@ gimp_layer_new_from_drawable (GimpDrawable *drawable,
|
|||
gimp_layer_transform_color (dest_image,
|
||||
&newPR, &layerPR,
|
||||
NULL,
|
||||
old_base_type);
|
||||
src_base_type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue