app: add precision argument to gimp_image_get_format()

and use it instead of gimp_babl_format() in some places where indexed
formats can occur. Also fix some places using gimp_babl_format() to
special case indexed formats correctly.
This commit is contained in:
Michael Natterer
2012-05-07 21:46:47 +02:00
parent 047ca612f5
commit 94da46c373
8 changed files with 45 additions and 22 deletions

View File

@ -201,9 +201,13 @@ gimp_buffer_get_new_preview (GimpViewable *viewable,
const Babl *format = gimp_buffer_get_format (buffer);
GimpTempBuf *preview;
format = gimp_babl_format (gimp_babl_format_get_base_type (format),
GIMP_PRECISION_U8,
babl_format_has_alpha (format));
if (babl_format_is_palette (format))
format = gimp_babl_format (GIMP_RGB, GIMP_PRECISION_U8,
babl_format_has_alpha (format));
else
format = gimp_babl_format (gimp_babl_format_get_base_type (format),
GIMP_PRECISION_U8,
babl_format_has_alpha (format));
preview = gimp_temp_buf_new (width, height, format);