[gimp/goat-invasion: 196/401] app: completely port gimpdrawable-convert.c to GeglBuffer
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 196/401] app: completely port gimpdrawable-convert.c to GeglBuffer
- Date: Mon, 2 Apr 2012 12:04:35 +0000 (UTC)
commit 22f200e08d5f56bb5ebdb2a3130f50e8899e0bb6
Author: Michael Natterer <mitch gimp org>
Date: Wed Mar 21 22:35:09 2012 +0100
app: completely port gimpdrawable-convert.c to GeglBuffer
app/core/gimpdrawable-convert.c | 67 +++++++++++++++-----------------------
app/core/gimpdrawable-convert.h | 2 +
app/core/gimpdrawable.c | 4 +-
app/core/gimpimage-convert.c | 2 +-
4 files changed, 32 insertions(+), 43 deletions(-)
---
diff --git a/app/core/gimpdrawable-convert.c b/app/core/gimpdrawable-convert.c
index 45708d1..2f0fa82 100644
--- a/app/core/gimpdrawable-convert.c
+++ b/app/core/gimpdrawable-convert.c
@@ -25,8 +25,6 @@
#include "core-types.h"
-#include "base/tile-manager.h"
-
#include "gegl/gimp-gegl-utils.h"
#include "gimpdrawable.h"
@@ -37,13 +35,14 @@
void
gimp_drawable_convert_rgb (GimpDrawable *drawable,
+ GimpImage *dest_image,
gboolean push_undo)
{
GimpImageType type;
- TileManager *tiles;
GeglBuffer *dest_buffer;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (GIMP_IS_IMAGE (dest_image));
g_return_if_fail (! gimp_drawable_is_rgb (drawable));
type = GIMP_RGB_IMAGE;
@@ -51,31 +50,30 @@ gimp_drawable_convert_rgb (GimpDrawable *drawable,
if (gimp_drawable_has_alpha (drawable))
type = GIMP_IMAGE_TYPE_WITH_ALPHA (type);
- tiles = tile_manager_new (gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)),
- GIMP_IMAGE_TYPE_BYTES (type));
-
- dest_buffer = gimp_tile_manager_create_buffer (tiles, NULL);
+ dest_buffer =
+ gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable))),
+ gimp_image_get_format (dest_image, type));
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
+ gimp_drawable_set_buffer (drawable, push_undo, NULL,
+ dest_buffer, type);
g_object_unref (dest_buffer);
-
- gimp_drawable_set_tiles (drawable, push_undo, NULL,
- tiles, type);
- tile_manager_unref (tiles);
}
void
gimp_drawable_convert_grayscale (GimpDrawable *drawable,
+ GimpImage *dest_image,
gboolean push_undo)
{
GimpImageType type;
- TileManager *tiles;
GeglBuffer *dest_buffer;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (GIMP_IS_IMAGE (dest_image));
g_return_if_fail (! gimp_drawable_is_gray (drawable));
type = GIMP_GRAY_IMAGE;
@@ -83,20 +81,18 @@ gimp_drawable_convert_grayscale (GimpDrawable *drawable,
if (gimp_drawable_has_alpha (drawable))
type = GIMP_IMAGE_TYPE_WITH_ALPHA (type);
- tiles = tile_manager_new (gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)),
- GIMP_IMAGE_TYPE_BYTES (type));
-
- dest_buffer = gimp_tile_manager_create_buffer (tiles, NULL);
+ dest_buffer =
+ gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable))),
+ gimp_image_get_format (dest_image, type));
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
+ gimp_drawable_set_buffer (drawable, push_undo, NULL,
+ dest_buffer, type);
g_object_unref (dest_buffer);
-
- gimp_drawable_set_tiles (drawable, push_undo, NULL,
- tiles, type);
- tile_manager_unref (tiles);
}
void
@@ -105,7 +101,6 @@ gimp_drawable_convert_indexed (GimpDrawable *drawable,
gboolean push_undo)
{
GimpImageType type;
- TileManager *tiles;
GeglBuffer *dest_buffer;
const Babl *format;
@@ -116,28 +111,20 @@ gimp_drawable_convert_indexed (GimpDrawable *drawable,
type = GIMP_INDEXED_IMAGE;
if (gimp_drawable_has_alpha (drawable))
- {
- type = GIMP_IMAGE_TYPE_WITH_ALPHA (type);
-
- format = gimp_image_colormap_get_rgba_format (dest_image);
- }
+ format = gimp_image_colormap_get_rgba_format (dest_image);
else
- {
- format = gimp_image_colormap_get_rgb_format (dest_image);
- }
+ format = gimp_image_colormap_get_rgb_format (dest_image);
- tiles = tile_manager_new (gimp_item_get_width (GIMP_ITEM (drawable)),
- gimp_item_get_height (GIMP_ITEM (drawable)),
- GIMP_IMAGE_TYPE_BYTES (type));
-
- dest_buffer = gimp_tile_manager_create_buffer (tiles, format);
+ dest_buffer =
+ gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0,
+ gimp_item_get_width (GIMP_ITEM (drawable)),
+ gimp_item_get_height (GIMP_ITEM (drawable))),
+ format);
gegl_buffer_copy (gimp_drawable_get_buffer (drawable), NULL,
dest_buffer, NULL);
+ gimp_drawable_set_buffer (drawable, push_undo, NULL,
+ dest_buffer, type);
g_object_unref (dest_buffer);
-
- gimp_drawable_set_tiles (drawable, push_undo, NULL,
- tiles, type);
- tile_manager_unref (tiles);
}
diff --git a/app/core/gimpdrawable-convert.h b/app/core/gimpdrawable-convert.h
index d640f70..3a08d9e 100644
--- a/app/core/gimpdrawable-convert.h
+++ b/app/core/gimpdrawable-convert.h
@@ -20,8 +20,10 @@
void gimp_drawable_convert_rgb (GimpDrawable *drawable,
+ GimpImage *dest_image,
gboolean push_undo);
void gimp_drawable_convert_grayscale (GimpDrawable *drawable,
+ GimpImage *dest_image,
gboolean push_undo);
void gimp_drawable_convert_indexed (GimpDrawable *drawable,
GimpImage *dest_image,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 27221ec..bd4682d 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -759,11 +759,11 @@ gimp_drawable_real_convert_type (GimpDrawable *drawable,
switch (new_base_type)
{
case GIMP_RGB:
- gimp_drawable_convert_rgb (drawable, push_undo);
+ gimp_drawable_convert_rgb (drawable, dest_image, push_undo);
break;
case GIMP_GRAY:
- gimp_drawable_convert_grayscale (drawable, push_undo);
+ gimp_drawable_convert_grayscale (drawable, dest_image, push_undo);
break;
case GIMP_INDEXED:
diff --git a/app/core/gimpimage-convert.c b/app/core/gimpimage-convert.c
index 85b2790..0193769 100644
--- a/app/core/gimpimage-convert.c
+++ b/app/core/gimpimage-convert.c
@@ -965,7 +965,7 @@ gimp_image_convert (GimpImage *image,
{
case GIMP_RGB:
case GIMP_GRAY:
- gimp_drawable_convert_type (GIMP_DRAWABLE (layer), NULL, new_type,
+ gimp_drawable_convert_type (GIMP_DRAWABLE (layer), image, new_type,
TRUE);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]