[gimp] app: add "gboolean new_has_alpha" to gimp_drawable_convert_type()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add "gboolean new_has_alpha" to gimp_drawable_convert_type()
- Date: Mon, 3 Oct 2016 23:42:45 +0000 (UTC)
commit ecf4af88b843953a28d32e9c33a1de62d32744c7
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 4 01:39:15 2016 +0200
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).
app/core/gimpchannel.c | 8 +++-----
app/core/gimpdrawable.c | 10 +++-------
app/core/gimpdrawable.h | 3 +--
app/core/gimpgrouplayer.c | 23 ++++++++++++-----------
app/core/gimpgrouplayerundo.c | 8 +++++++-
app/core/gimpgrouplayerundo.h | 1 +
app/core/gimpimage-convert-indexed.c | 7 +++++--
app/core/gimpimage-convert-precision.c | 1 +
app/core/gimpimage-convert-type.c | 4 +++-
app/core/gimplayer.c | 15 ++++++++-------
app/core/gimplayermask.c | 9 ++-------
app/core/gimpselection.c | 9 ++-------
app/text/gimptextlayer.c | 6 ------
app/text/gimptextundo.c | 1 +
14 files changed, 49 insertions(+), 56 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 92f589d..0b73e87 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -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,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 967906e..39c8293 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -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,
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index f457d22..eba82d9 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -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,
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index b6b13d0..73ff833 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -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);
}
}
diff --git a/app/core/gimpgrouplayerundo.c b/app/core/gimpgrouplayerundo.c
index ee46313..5141aef 100644
--- a/app/core/gimpgrouplayerundo.c
+++ b/app/core/gimpgrouplayerundo.c
@@ -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;
diff --git a/app/core/gimpgrouplayerundo.h b/app/core/gimpgrouplayerundo.h
index 3219b2a..61502b2 100644
--- a/app/core/gimpgrouplayerundo.h
+++ b/app/core/gimpgrouplayerundo.h
@@ -39,6 +39,7 @@ struct _GimpGroupLayerUndo
GimpImageBaseType prev_type;
GimpPrecision prev_precision;
+ gboolean prev_has_alpha;
};
struct _GimpGroupLayerUndoClass
diff --git a/app/core/gimpimage-convert-indexed.c b/app/core/gimpimage-convert-indexed.c
index 657a7cc..9edaae7 100644
--- a/app/core/gimpimage-convert-indexed.c
+++ b/app/core/gimpimage-convert-indexed.c
@@ -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);
}
}
diff --git a/app/core/gimpimage-convert-precision.c b/app/core/gimpimage-convert-precision.c
index eafb428..6b8777c 100644
--- a/app/core/gimpimage-convert-precision.c
+++ b/app/core/gimpimage-convert-precision.c
@@ -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,
diff --git a/app/core/gimpimage-convert-type.c b/app/core/gimpimage-convert-type.c
index cb5eb6d..0b65f66 100644
--- a/app/core/gimpimage-convert-type.c
+++ b/app/core/gimpimage-convert-type.c
@@ -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);
}
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 3f31780..1532b17 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -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);
diff --git a/app/core/gimplayermask.c b/app/core/gimplayermask.c
index 6141074..357897c 100644
--- a/app/core/gimplayermask.c
+++ b/app/core/gimplayermask.c
@@ -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,
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 1bbc47e..32734cb 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -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,
diff --git a/app/text/gimptextlayer.c b/app/text/gimptextlayer.c
index 0824c13..d06fa0f 100644
--- a/app/text/gimptextlayer.c
+++ b/app/text/gimptextlayer.c
@@ -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,
diff --git a/app/text/gimptextundo.c b/app/text/gimptextundo.c
index 7e78566..c2c7b74 100644
--- a/app/text/gimptextundo.c
+++ b/app/text/gimptextundo.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]