[gimp/metadata-browser] app: remove gimpdrawable-convert.[ch]
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] app: remove gimpdrawable-convert.[ch]
- Date: Wed, 12 Sep 2012 23:49:20 +0000 (UTC)
commit 41ec64b15ac7d6b373f6184e255c4ad184655ff3
Author: Michael Natterer <mitch gimp org>
Date: Wed Apr 11 18:50:57 2012 +0200
app: remove gimpdrawable-convert.[ch]
This can now be done in gimp_drawable_real_convert_type() with a few
lines of GEGL buffer copying.
app/core/Makefile.am | 2 -
app/core/gimpchannel.c | 2 +-
app/core/gimpdrawable-convert.c | 115 ---------------------------------------
app/core/gimpdrawable-convert.h | 33 -----------
app/core/gimpdrawable.c | 35 ++++++-------
app/core/gimpgrouplayerundo.c | 3 +-
app/core/gimplayer.c | 1 -
7 files changed, 19 insertions(+), 172 deletions(-)
---
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index d769be5..2f02623 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -128,8 +128,6 @@ libappcore_a_sources = \
gimpdrawable-bucket-fill.h \
gimpdrawable-combine.c \
gimpdrawable-combine.h \
- gimpdrawable-convert.c \
- gimpdrawable-convert.h \
gimpdrawable-equalize.c \
gimpdrawable-equalize.h \
gimpdrawable-foreground-extract.c \
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 4d92a16..435d746 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -446,7 +446,7 @@ gimp_channel_convert (GimpItem *item,
if (! gimp_drawable_is_gray (drawable))
{
- gimp_drawable_convert_type (drawable, NULL, GIMP_GRAY, FALSE);
+ gimp_drawable_convert_type (drawable, dest_image, GIMP_GRAY, FALSE);
}
if (gimp_drawable_has_alpha (drawable))
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index ea5a056..37e5dea 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -35,7 +35,6 @@
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpdrawable-combine.h"
-#include "gimpdrawable-convert.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-preview.h"
#include "gimpdrawable-private.h"
@@ -694,23 +693,23 @@ gimp_drawable_real_convert_type (GimpDrawable *drawable,
GimpImageBaseType new_base_type,
gboolean push_undo)
{
- switch (new_base_type)
- {
- case GIMP_RGB:
- gimp_drawable_convert_rgb (drawable, dest_image, push_undo);
- break;
+ GeglBuffer *dest_buffer;
+ const Babl *format;
- case GIMP_GRAY:
- gimp_drawable_convert_grayscale (drawable, dest_image, push_undo);
- break;
+ format = gimp_image_get_format (dest_image, new_base_type,
+ gimp_drawable_has_alpha (drawable));
- case GIMP_INDEXED:
- gimp_drawable_convert_indexed (drawable, dest_image, push_undo);
- break;
+ dest_buffer =
+ gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable))),
+ format);
- default:
- break;
- }
+ gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
+ dest_buffer, NULL);
+
+ gimp_drawable_set_buffer (drawable, push_undo, NULL, dest_buffer);
+ g_object_unref (dest_buffer);
}
static GeglBuffer *
@@ -1157,14 +1156,12 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
gboolean push_undo)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (dest_image == NULL || GIMP_IS_IMAGE (dest_image));
- g_return_if_fail (new_base_type != GIMP_INDEXED || GIMP_IS_IMAGE (dest_image));
+ g_return_if_fail (GIMP_IS_IMAGE (dest_image));
+ g_return_if_fail (new_base_type != gimp_drawable_get_base_type (drawable));
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
- g_return_if_fail (new_base_type != gimp_drawable_get_base_type (drawable));
-
GIMP_DRAWABLE_GET_CLASS (drawable)->convert_type (drawable, dest_image,
new_base_type, push_undo);
}
diff --git a/app/core/gimpgrouplayerundo.c b/app/core/gimpgrouplayerundo.c
index f5264e0..5621026 100644
--- a/app/core/gimpgrouplayerundo.c
+++ b/app/core/gimpgrouplayerundo.c
@@ -120,7 +120,8 @@ gimp_group_layer_undo_pop (GimpUndo *undo,
GimpImageBaseType type;
type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
- gimp_drawable_convert_type (GIMP_DRAWABLE (group), NULL,
+ 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;
}
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 9d2b60e..453cd4f 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -37,7 +37,6 @@
#include "gimpchannel-select.h"
#include "gimpcontext.h"
#include "gimpcontainer.h"
-#include "gimpdrawable-convert.h"
#include "gimpdrawable-operation.h"
#include "gimperror.h"
#include "gimpimage-undo-push.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]