Commit f164069c authored by Michael Natterer's avatar Michael Natterer 😴

app: remove gimp_drawable_bytes() and ask its format instead

parent f851bf09
......@@ -122,7 +122,7 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *mask,
gint x2, y2;
g_return_if_fail (GIMP_IS_DRAWABLE (mask));
g_return_if_fail (gimp_drawable_bytes (mask) == 1);
g_return_if_fail (babl_format_get_bytes_per_pixel (gimp_drawable_get_format (mask)) == 1);
g_return_if_fail (state != NULL);
......
......@@ -687,7 +687,9 @@ gimp_drawable_real_estimate_memsize (const GimpDrawable *drawable,
gint width,
gint height)
{
return (gint64) gimp_drawable_bytes (drawable) * width * height;
const Babl *format = gimp_drawable_get_format (drawable);
return (gint64) babl_format_get_bytes_per_pixel (format) * width * height;
}
static void
......@@ -1681,18 +1683,6 @@ gimp_drawable_is_indexed (const GimpDrawable *drawable)
return (gimp_drawable_get_base_type (drawable) == GIMP_INDEXED);
}
gint
gimp_drawable_bytes (const GimpDrawable *drawable)
{
const Babl *format;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), -1);
format = gegl_buffer_get_format (drawable->private->buffer);
return babl_format_get_bytes_per_pixel (format);
}
const guchar *
gimp_drawable_get_colormap (const GimpDrawable *drawable)
{
......
......@@ -233,7 +233,6 @@ GimpPrecision gimp_drawable_get_precision (const GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (const GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (const GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (const GimpDrawable *drawable);
gint gimp_drawable_bytes (const GimpDrawable *drawable);
const guchar * gimp_drawable_get_colormap (const GimpDrawable *drawable);
......
......@@ -405,8 +405,9 @@ static CombinationMode
gimp_image_merge_layers_get_operation (GimpLayer *dest,
GimpLayer *src)
{
GimpImageType type = gimp_babl_format_get_image_type (gimp_drawable_get_format (GIMP_DRAWABLE (dest)));
gint bytes = gimp_drawable_bytes (GIMP_DRAWABLE (src));
const Babl *format = gimp_drawable_get_format (GIMP_DRAWABLE (dest));
GimpImageType type = gimp_babl_format_get_image_type (format);
gint bytes = babl_format_get_bytes_per_pixel (format);
return gimp_image_get_combination_mode (type, bytes);
}
......
......@@ -960,14 +960,15 @@ static void
gimp_layer_get_active_components (const GimpDrawable *drawable,
gboolean *active)
{
GimpLayer *layer = GIMP_LAYER (drawable);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpLayer *layer = GIMP_LAYER (drawable);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
const Babl *format = gimp_drawable_get_format (drawable);
/* first copy the image active channels */
gimp_image_get_active_array (image, active);
if (gimp_drawable_has_alpha (drawable) && layer->lock_alpha)
active[gimp_drawable_bytes (drawable) - 1] = FALSE;
active[babl_format_get_n_components (format) - 1] = FALSE;
}
static gdouble
......
......@@ -1796,7 +1796,7 @@ gimp_display_shell_set_mask (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (mask == NULL ||
(GIMP_IS_DRAWABLE (mask) &&
gimp_drawable_bytes (mask) == 1));
babl_format_get_bytes_per_pixel (gimp_drawable_get_format (mask)) == 1));
g_return_if_fail (mask == NULL || color != NULL);
if (mask)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment