[gimp/goat-invasion: 580/608] app: add "new_precision" argument to gimp_drawable_convert_type()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 580/608] app: add "new_precision" argument to gimp_drawable_convert_type()
- Date: Fri, 27 Apr 2012 21:14:07 +0000 (UTC)
commit 8dd5ee0cadb8a4ff608109e54dbfba136ed769e9
Author: Michael Natterer <mitch gimp org>
Date: Wed Apr 25 12:09:45 2012 +0200
app: add "new_precision" argument to gimp_drawable_convert_type()
for clarity and consistency with the "new_base_type" argument.
app/core/gimpchannel.c | 4 +++-
app/core/gimpdrawable.c | 18 +++++++++++-------
app/core/gimpdrawable.h | 2 ++
app/core/gimpgrouplayer.c | 2 ++
app/core/gimpgrouplayerundo.c | 14 +++++++++++---
app/core/gimpgrouplayerundo.h | 1 +
app/core/gimpimage-convert.c | 1 +
app/core/gimplayer.c | 6 +++++-
8 files changed, 36 insertions(+), 12 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index f92c8dd..9d39520 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -447,7 +447,9 @@ gimp_channel_convert (GimpItem *item,
if (! gimp_drawable_is_gray (drawable))
{
- gimp_drawable_convert_type (drawable, dest_image, GIMP_GRAY, FALSE);
+ gimp_drawable_convert_type (drawable, dest_image, GIMP_GRAY,
+ gimp_image_get_precision (dest_image),
+ FALSE);
}
if (gimp_drawable_has_alpha (drawable))
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index a1d7269..8e5e76c 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -134,6 +134,7 @@ static gint64 gimp_drawable_real_estimate_memsize (const GimpDrawable *drawable
static void gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo);
static GeglBuffer * gimp_drawable_real_get_buffer (GimpDrawable *drawable);
@@ -693,13 +694,15 @@ static void
gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo)
{
GeglBuffer *dest_buffer;
const Babl *format;
- format = gimp_image_get_format (dest_image, new_base_type,
- gimp_drawable_has_alpha (drawable));
+ format = gimp_babl_format (new_base_type,
+ new_precision,
+ gimp_drawable_has_alpha (drawable));
dest_buffer =
gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
@@ -1155,20 +1158,21 @@ void
gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GIMP_IS_IMAGE (dest_image));
- g_return_if_fail (new_base_type !=
- gimp_drawable_get_base_type (drawable) ||
- gimp_image_get_precision (dest_image) !=
- gimp_drawable_get_precision (drawable));
+ g_return_if_fail (new_base_type != gimp_drawable_get_base_type (drawable) ||
+ new_precision != gimp_drawable_get_precision (drawable));
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
GIMP_DRAWABLE_GET_CLASS (drawable)->convert_type (drawable, dest_image,
- new_base_type, push_undo);
+ new_base_type,
+ new_precision,
+ push_undo);
}
void
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index 46d2fda..a30c2a6 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -62,6 +62,7 @@ struct _GimpDrawableClass
void (* convert_type) (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo);
void (* apply_buffer) (GimpDrawable *drawable,
GeglBuffer *buffer,
@@ -143,6 +144,7 @@ void gimp_drawable_get_active_components (const GimpDrawable *drawable,
void gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo);
void gimp_drawable_apply_buffer (GimpDrawable *drawable,
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index 3769754..514f4bc 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -136,6 +136,7 @@ static gint64 gimp_group_layer_estimate_memsize (const GimpDrawable *drawab
static void gimp_group_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo);
static const Babl * gimp_group_layer_get_format (GimpProjectable *projectable);
@@ -847,6 +848,7 @@ static void
gimp_group_layer_convert_type (GimpDrawable *drawable,
GimpImage *dest_image,
GimpImageBaseType new_base_type,
+ GimpPrecision new_precision,
gboolean push_undo)
{
GimpGroupLayer *group = GIMP_GROUP_LAYER (drawable);
diff --git a/app/core/gimpgrouplayerundo.c b/app/core/gimpgrouplayerundo.c
index 5621026..728ecfb 100644
--- a/app/core/gimpgrouplayerundo.c
+++ b/app/core/gimpgrouplayerundo.c
@@ -75,6 +75,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));
break;
default:
@@ -118,12 +119,19 @@ gimp_group_layer_undo_pop (GimpUndo *undo,
case GIMP_UNDO_GROUP_LAYER_CONVERT:
{
GimpImageBaseType type;
+ GimpPrecision precision;
+
+ type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
+ precision = gimp_drawable_get_precision (GIMP_DRAWABLE (group));
- type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
gimp_drawable_convert_type (GIMP_DRAWABLE (group),
gimp_item_get_image (GIMP_ITEM (group)),
- group_layer_undo->prev_type, FALSE);
- group_layer_undo->prev_type = type;
+ group_layer_undo->prev_type,
+ group_layer_undo->prev_precision,
+ FALSE);
+
+ group_layer_undo->prev_type = type;
+ group_layer_undo->prev_precision = precision;
}
break;
diff --git a/app/core/gimpgrouplayerundo.h b/app/core/gimpgrouplayerundo.h
index a6a271d..05120be 100644
--- a/app/core/gimpgrouplayerundo.h
+++ b/app/core/gimpgrouplayerundo.h
@@ -37,6 +37,7 @@ struct _GimpGroupLayerUndo
GimpItemUndo parent_instance;
GimpImageBaseType prev_type;
+ GimpPrecision prev_precision;
};
struct _GimpGroupLayerUndoClass
diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c
index 2411346..fe4130a 100644
--- a/app/core/gimpimage-convert.c
+++ b/app/core/gimpimage-convert.c
@@ -971,6 +971,7 @@ gimp_image_convert (GimpImage *image,
case GIMP_RGB:
case GIMP_GRAY:
gimp_drawable_convert_type (GIMP_DRAWABLE (layer), image, new_type,
+ gimp_drawable_get_precision (GIMP_DRAWABLE (layer)),
TRUE);
break;
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 45e70bc..0bc6135 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -620,7 +620,11 @@ gimp_layer_convert (GimpItem *item,
if (old_base_type != new_base_type ||
old_precision != new_precision)
- gimp_drawable_convert_type (drawable, dest_image, new_base_type, FALSE);
+ {
+ gimp_drawable_convert_type (drawable, dest_image,
+ new_base_type, new_precision,
+ FALSE);
+ }
if (layer->mask)
gimp_item_set_image (GIMP_ITEM (layer->mask), dest_image);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]