[gimp/goat-invasion] app: honor precision when copying drawables between images



commit 5d6654098adef99d51b1398138675160e4f704b4
Author: Michael Natterer <mitch gimp org>
Date:   Wed Apr 25 11:44:40 2012 +0200

    app: honor precision when copying drawables between images

 app/core/gimpdrawable.c |    5 ++++-
 app/core/gimplayer.c    |    8 +++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 68efb20..a1d7269 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1159,7 +1159,10 @@ gimp_drawable_convert_type (GimpDrawable      *drawable,
 {
   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));
+  g_return_if_fail (new_base_type !=
+                    gimp_drawable_get_base_type (drawable) ||
+                    gimp_image_get_precision (dest_image) !=
+                    gimp_drawable_get_precision (drawable));
 
   if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
     push_undo = FALSE;
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index f4ffefa..45e70bc 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -609,11 +609,17 @@ gimp_layer_convert (GimpItem  *item,
   GimpDrawable      *drawable = GIMP_DRAWABLE (item);
   GimpImageBaseType  old_base_type;
   GimpImageBaseType  new_base_type;
+  GimpPrecision      old_precision;
+  GimpPrecision      new_precision;
 
   old_base_type = gimp_drawable_get_base_type (drawable);
   new_base_type = gimp_image_base_type (dest_image);
 
-  if (old_base_type != new_base_type)
+  old_precision = gimp_drawable_get_precision (drawable);
+  new_precision = gimp_image_get_precision (dest_image);
+
+  if (old_base_type != new_base_type ||
+      old_precision != new_precision)
     gimp_drawable_convert_type (drawable, dest_image, new_base_type, FALSE);
 
   if (layer->mask)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]