Bug 734705 - v2.9.1 crashes when scaling an image in indexed colors mode

Use gimp_image_get_format() instead of gimp_babl_format() in
gimp_drawable_real_estimate_memsize() because the latter can't handle
indexed formats and returns NULL.
This commit is contained in:
Michael Natterer 2014-08-15 09:23:02 +02:00
parent b3d5985c72
commit b663b8058f
1 changed files with 6 additions and 3 deletions

View File

@ -765,11 +765,14 @@ gimp_drawable_real_estimate_memsize (const GimpDrawable *drawable,
gint width,
gint height)
{
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gboolean linear = gimp_drawable_get_linear (drawable);
const Babl *format;
format = gimp_babl_format (gimp_drawable_get_base_type (drawable),
gimp_babl_precision (component_type, FALSE),
gimp_drawable_has_alpha (drawable));
format = gimp_image_get_format (image,
gimp_drawable_get_base_type (drawable),
gimp_babl_precision (component_type, linear),
gimp_drawable_has_alpha (drawable));
return (gint64) babl_format_get_bytes_per_pixel (format) * width * height;
}