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

app: add "gboolean new_has_alpha" to gimp_drawable_convert_type()

making its external API "complete". Remove the redundant
"new_base_type" and "new_precision" from the internal (vfunc) API (the
Babl format has the same information).
parent 3f8d55fe
......@@ -145,8 +145,6 @@ static void gimp_channel_to_selection (GimpItem *item,
static void gimp_channel_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -567,8 +565,10 @@ gimp_channel_convert (GimpItem *item,
if (! gimp_drawable_is_gray (drawable))
{
gimp_drawable_convert_type (drawable, dest_image, GIMP_GRAY,
gimp_drawable_convert_type (drawable, dest_image,
GIMP_GRAY,
gimp_image_get_precision (dest_image),
gimp_drawable_has_alpha (drawable),
NULL, 0, 0,
FALSE, NULL);
}
......@@ -943,8 +943,6 @@ static void
gimp_channel_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......
......@@ -154,8 +154,6 @@ static gint64 gimp_drawable_real_estimate_memsize (GimpDrawable *drawable,
static void gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -799,8 +797,6 @@ static void
gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -1046,6 +1042,7 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
gboolean new_has_alpha,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -1058,6 +1055,7 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
g_return_if_fail (GIMP_IS_IMAGE (dest_image));
g_return_if_fail (new_base_type != gimp_drawable_get_base_type (drawable) ||
new_precision != gimp_drawable_get_precision (drawable) ||
new_has_alpha != gimp_drawable_has_alpha (drawable) ||
dest_profile);
g_return_if_fail (dest_profile == NULL || GIMP_IS_COLOR_PROFILE (dest_profile));
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
......@@ -1068,12 +1066,10 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
new_format = gimp_image_get_format (dest_image,
new_base_type,
new_precision,
gimp_drawable_has_alpha (drawable));
new_has_alpha);
GIMP_DRAWABLE_GET_CLASS (drawable)->convert_type (drawable, dest_image,
new_format,
new_base_type,
new_precision,
dest_profile,
layer_dither_type,
mask_dither_type,
......
......@@ -64,8 +64,6 @@ struct _GimpDrawableClass
void (* convert_type) (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -144,6 +142,7 @@ void gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
gboolean new_has_alpha,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......
......@@ -139,8 +139,6 @@ static gint64 gimp_group_layer_estimate_memsize (GimpDrawable *drawabl
static void gimp_group_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -878,9 +876,7 @@ get_projection_format (GimpProjectable *projectable,
static void
gimp_group_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format /* unused */,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
const Babl *new_format,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -903,9 +899,10 @@ gimp_group_layer_convert_type (GimpDrawable *drawable,
* values so the projection will create its tiles with the right
* depth
*/
private->convert_format = get_projection_format (GIMP_PROJECTABLE (drawable),
new_base_type,
new_precision);
private->convert_format =
get_projection_format (GIMP_PROJECTABLE (drawable),
gimp_babl_format_get_base_type (new_format),
gimp_babl_format_get_precision (new_format));
gimp_projectable_structure_changed (GIMP_PROJECTABLE (drawable));
gimp_pickable_flush (GIMP_PICKABLE (private->projection));
......@@ -923,11 +920,15 @@ gimp_group_layer_convert_type (GimpDrawable *drawable,
mask = gimp_layer_get_mask (GIMP_LAYER (group));
if (mask &&
new_precision != gimp_drawable_get_precision (GIMP_DRAWABLE (mask)))
gimp_babl_format_get_precision (new_format) !=
gimp_drawable_get_precision (GIMP_DRAWABLE (mask)))
{
gimp_drawable_convert_type (GIMP_DRAWABLE (mask), dest_image,
GIMP_GRAY, new_precision,
NULL, layer_dither_type, mask_dither_type,
GIMP_GRAY,
gimp_babl_format_get_precision (new_format),
gimp_drawable_has_alpha (GIMP_DRAWABLE (mask)),
NULL,
layer_dither_type, mask_dither_type,
push_undo, progress);
}
}
......
......@@ -76,6 +76,7 @@ gimp_group_layer_undo_constructed (GObject *object)
case GIMP_UNDO_GROUP_LAYER_CONVERT:
group_layer_undo->prev_type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
group_layer_undo->prev_precision = gimp_drawable_get_precision (GIMP_DRAWABLE (group));
group_layer_undo->prev_has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (group));
break;
default:
......@@ -120,19 +121,24 @@ gimp_group_layer_undo_pop (GimpUndo *undo,
{
GimpImageBaseType type;
GimpPrecision precision;
gboolean has_alpha;
type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
precision = gimp_drawable_get_precision (GIMP_DRAWABLE (group));
has_alpha = gimp_drawable_has_alpha (GIMP_DRAWABLE (group));
gimp_drawable_convert_type (GIMP_DRAWABLE (group),
gimp_item_get_image (GIMP_ITEM (group)),
group_layer_undo->prev_type,
group_layer_undo->prev_precision,
0, 0, FALSE,
group_layer_undo->prev_has_alpha,
NULL,
0, 0,
FALSE, NULL);
group_layer_undo->prev_type = type;
group_layer_undo->prev_precision = precision;
group_layer_undo->prev_has_alpha = has_alpha;
}
break;
......
......@@ -39,6 +39,7 @@ struct _GimpGroupLayerUndo
GimpImageBaseType prev_type;
GimpPrecision prev_precision;
gboolean prev_has_alpha;
};
struct _GimpGroupLayerUndoClass
......
......@@ -993,9 +993,12 @@ gimp_image_convert_indexed (GimpImage *image,
}
else
{
gimp_drawable_convert_type (GIMP_DRAWABLE (layer), image, GIMP_INDEXED,
gimp_drawable_convert_type (GIMP_DRAWABLE (layer), image,
GIMP_INDEXED,
gimp_drawable_get_precision (GIMP_DRAWABLE (layer)),
dest_profile, 0, 0,
gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)),
dest_profile,
0, 0,
TRUE, NULL);
}
}
......
......@@ -190,6 +190,7 @@ gimp_image_convert_precision (GimpImage *image,
gimp_drawable_convert_type (drawable, image,
gimp_drawable_get_base_type (drawable),
precision,
gimp_drawable_has_alpha (drawable),
new_profile,
dither_type,
mask_dither_type,
......
......@@ -133,8 +133,10 @@ gimp_image_convert_type (GimpImage *image,
gimp_sub_progress_set_step (GIMP_SUB_PROGRESS (sub_progress),
nth_layer, n_layers);
gimp_drawable_convert_type (drawable, image, new_type,
gimp_drawable_convert_type (drawable, image,
new_type,
gimp_drawable_get_precision (drawable),
gimp_drawable_has_alpha (drawable),
dest_profile, 0, 0,
TRUE, sub_progress);
}
......
......@@ -167,8 +167,6 @@ static gint64 gimp_layer_estimate_memsize (GimpDrawable *drawable,
static void gimp_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -811,7 +809,9 @@ gimp_layer_convert (GimpItem *item,
dest_profile)
{
gimp_drawable_convert_type (drawable, dest_image,
new_base_type, new_precision,
new_base_type,
new_precision,
gimp_drawable_has_alpha (drawable),
dest_profile,
0, 0,
FALSE, NULL);
......@@ -1064,8 +1064,6 @@ static void
gimp_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -1125,10 +1123,13 @@ gimp_layer_convert_type (GimpDrawable *drawable,
g_object_unref (dest_buffer);
if (layer->mask &&
new_precision != gimp_drawable_get_precision (GIMP_DRAWABLE (layer->mask)))
gimp_babl_format_get_precision (new_format) !=
gimp_drawable_get_precision (GIMP_DRAWABLE (layer->mask)))
{
gimp_drawable_convert_type (GIMP_DRAWABLE (layer->mask), dest_image,
GIMP_GRAY, new_precision,
GIMP_GRAY,
gimp_babl_format_get_precision (new_format),
gimp_drawable_has_alpha (GIMP_DRAWABLE (layer->mask)),
NULL,
layer_dither_type, mask_dither_type,
push_undo, NULL);
......
......@@ -52,8 +52,6 @@ static gboolean gimp_layer_mask_rename (GimpItem *it
static void gimp_layer_mask_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -166,20 +164,17 @@ static void
gimp_layer_mask_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
gboolean push_undo,
GimpProgress *progress)
{
new_format = gimp_babl_mask_format (new_precision);
new_format =
gimp_babl_mask_format (gimp_babl_format_get_precision (new_format));
GIMP_DRAWABLE_CLASS (parent_class)->convert_type (drawable, dest_image,
new_format,
new_base_type,
new_precision,
dest_profile,
layer_dither_type,
mask_dither_type,
......
......@@ -91,8 +91,6 @@ static gboolean gimp_selection_stroke (GimpItem *item,
static void gimp_selection_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -355,20 +353,17 @@ static void
gimp_selection_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
gboolean push_undo,
GimpProgress *progress)
{
new_format = gimp_babl_mask_format (new_precision);
new_format =
gimp_babl_mask_format (gimp_babl_format_get_precision (new_format));
GIMP_DRAWABLE_CLASS (parent_class)->convert_type (drawable, dest_image,
new_format,
new_base_type,
new_precision,
dest_profile,
layer_dither_type,
mask_dither_type,
......
......@@ -88,8 +88,6 @@ static gboolean gimp_text_layer_rename (GimpItem *item,
static void gimp_text_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -320,8 +318,6 @@ static void
gimp_text_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
const Babl *new_format,
GimpImageBaseType new_base_type,
GimpPrecision new_precision,
GimpColorProfile *dest_profile,
gint layer_dither_type,
gint mask_dither_type,
......@@ -335,8 +331,6 @@ gimp_text_layer_convert_type (GimpDrawable *drawable,
{
GIMP_DRAWABLE_CLASS (parent_class)->convert_type (drawable, dest_image,
new_format,
new_base_type,
new_precision,
dest_profile,
layer_dither_type,
mask_dither_type,
......
......@@ -273,6 +273,7 @@ gimp_text_undo_pop (GimpUndo *undo,
gimp_item_get_image (GIMP_ITEM (layer)),
gimp_babl_format_get_base_type (text_undo->format),
gimp_babl_format_get_precision (text_undo->format),
babl_format_has_alpha (text_undo->format),
NULL, 0, 0,
FALSE, NULL);
text_undo->format = format;
......
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