[gimp/goat-invasion: 440/608] app: use gimp_drawable_get_base_type() instead of GIMP_IMAGE_TYPE_BASE_TYPE()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 440/608] app: use gimp_drawable_get_base_type() instead of GIMP_IMAGE_TYPE_BASE_TYPE()
- Date: Fri, 27 Apr 2012 21:02:22 +0000 (UTC)
commit 2daac93437fce61fe022a0685d5e18e62d1178ca
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 7 01:51:08 2012 +0200
app: use gimp_drawable_get_base_type() instead of GIMP_IMAGE_TYPE_BASE_TYPE()
app/core/gimpdrawable-preview.c | 9 +++------
app/core/gimpdrawable.c | 8 ++------
app/core/gimpdrawable.h | 2 +-
app/core/gimpgrouplayer.c | 4 ++--
app/core/gimpgrouplayerundo.c | 4 ++--
app/core/gimpimage-new.c | 26 ++++++++++++++------------
app/core/gimplayer.c | 2 +-
app/pdb/image-cmds.c | 4 ++--
tools/pdbgen/pdb/image.pdb | 4 ++--
9 files changed, 29 insertions(+), 34 deletions(-)
---
diff --git a/app/core/gimpdrawable-preview.c b/app/core/gimpdrawable-preview.c
index 6546da1..166eb7e 100644
--- a/app/core/gimpdrawable-preview.c
+++ b/app/core/gimpdrawable-preview.c
@@ -99,14 +99,11 @@ gimp_drawable_get_preview (GimpViewable *viewable,
gint
gimp_drawable_preview_bytes (GimpDrawable *drawable)
{
- GimpImageBaseType base_type;
- gint bytes = 0;
+ gint bytes = 0;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), 0);
- base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
-
- switch (base_type)
+ switch (gimp_drawable_get_base_type (drawable))
{
case GIMP_RGB:
case GIMP_GRAY:
@@ -151,7 +148,7 @@ gimp_drawable_get_sub_preview (GimpDrawable *drawable,
if (! image->gimp->config->layer_previews)
return NULL;
- if (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)) == GIMP_INDEXED)
+ if (gimp_drawable_is_indexed (drawable))
return gimp_drawable_indexed_preview (drawable,
gimp_drawable_get_colormap (drawable),
src_x, src_y, src_width, src_height,
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 7b47a01..aa78364 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1156,8 +1156,6 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
GimpImageBaseType new_base_type,
gboolean push_undo)
{
- GimpImageType type;
-
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));
@@ -1165,9 +1163,7 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
if (! gimp_item_is_attached (GIMP_ITEM (drawable)))
push_undo = FALSE;
- type = gimp_drawable_type (drawable);
-
- g_return_if_fail (new_base_type != GIMP_IMAGE_TYPE_BASE_TYPE (type));
+ 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);
@@ -1665,7 +1661,7 @@ gimp_drawable_type_with_alpha (const GimpDrawable *drawable)
return GIMP_IMAGE_TYPE_WITH_ALPHA (gimp_drawable_type (drawable));
}
-GimpImageType
+GimpImageBaseType
gimp_drawable_get_base_type (const GimpDrawable *drawable)
{
const Babl *format;
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index f79e5e0..00acb7f 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -226,7 +226,7 @@ const Babl * gimp_drawable_get_format_without_alpha
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type (const GimpDrawable *drawable);
GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable);
-GimpImageType gimp_drawable_get_base_type (const GimpDrawable *drawable);
+GimpImageBaseType gimp_drawable_get_base_type (const GimpDrawable *drawable);
gboolean gimp_drawable_is_rgb (const GimpDrawable *drawable);
gboolean gimp_drawable_is_gray (const GimpDrawable *drawable);
gboolean gimp_drawable_is_indexed (const GimpDrawable *drawable);
diff --git a/app/core/gimpgrouplayer.c b/app/core/gimpgrouplayer.c
index ae700dc..9049c84 100644
--- a/app/core/gimpgrouplayer.c
+++ b/app/core/gimpgrouplayer.c
@@ -814,7 +814,7 @@ gimp_group_layer_estimate_memsize (const GimpDrawable *drawable,
child_height);
}
- base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
+ base_type = gimp_drawable_get_base_type (drawable);
memsize += gimp_projection_estimate_memsize (base_type, width, height);
@@ -888,7 +888,7 @@ gimp_group_layer_get_format (GimpProjectable *projectable)
if (private->convert_format)
return private->convert_format;
- base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (projectable)));
+ base_type = gimp_drawable_get_base_type (GIMP_DRAWABLE (projectable));
return get_projection_format (projectable, base_type);
}
diff --git a/app/core/gimpgrouplayerundo.c b/app/core/gimpgrouplayerundo.c
index 6256e06..f5264e0 100644
--- a/app/core/gimpgrouplayerundo.c
+++ b/app/core/gimpgrouplayerundo.c
@@ -74,7 +74,7 @@ gimp_group_layer_undo_constructed (GObject *object)
break;
case GIMP_UNDO_GROUP_LAYER_CONVERT:
- group_layer_undo->prev_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (group)));
+ group_layer_undo->prev_type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
break;
default:
@@ -119,7 +119,7 @@ gimp_group_layer_undo_pop (GimpUndo *undo,
{
GimpImageBaseType type;
- type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (group)));
+ type = gimp_drawable_get_base_type (GIMP_DRAWABLE (group));
gimp_drawable_convert_type (GIMP_DRAWABLE (group), NULL,
group_layer_undo->prev_type, FALSE);
group_layer_undo->prev_type = type;
diff --git a/app/core/gimpimage-new.c b/app/core/gimpimage-new.c
index 89b34d7..445e1fb 100644
--- a/app/core/gimpimage-new.c
+++ b/app/core/gimpimage-new.c
@@ -174,7 +174,7 @@ gimp_image_new_from_drawable (Gimp *gimp,
item = GIMP_ITEM (drawable);
image = gimp_item_get_image (item);
- type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
+ type = gimp_drawable_get_base_type (drawable);
new_image = gimp_create_image (gimp,
gimp_item_get_width (item),
@@ -313,37 +313,39 @@ gimp_image_new_from_pixbuf (Gimp *gimp,
GdkPixbuf *pixbuf,
const gchar *layer_name)
{
- GimpImageType image_type;
- GimpImage *new_image;
- GimpLayer *layer;
+ GimpImage *new_image;
+ GimpLayer *layer;
+ GimpImageBaseType base_type;
+ gboolean has_alpha = FALSE;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
switch (gdk_pixbuf_get_n_channels (pixbuf))
{
- case 1: image_type = GIMP_GRAY_IMAGE; break;
- case 2: image_type = GIMP_GRAYA_IMAGE; break;
- case 3: image_type = GIMP_RGB_IMAGE; break;
- case 4: image_type = GIMP_RGBA_IMAGE; break;
+ case 2: has_alpha = TRUE;
+ case 1: base_type = GIMP_GRAY;
+ break;
+
+ case 4: has_alpha = TRUE;
+ case 3: base_type = GIMP_RGB;
break;
default:
g_return_val_if_reached (NULL);
- break;
}
new_image = gimp_create_image (gimp,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
- GIMP_IMAGE_TYPE_BASE_TYPE (image_type),
+ base_type,
FALSE);
gimp_image_undo_disable (new_image);
layer = gimp_layer_new_from_pixbuf (pixbuf, new_image,
- gimp_image_get_format (new_image,
- image_type),
+ gimp_image_get_layer_format (new_image,
+ has_alpha),
layer_name,
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 921256c..60caf49 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -611,7 +611,7 @@ gimp_layer_convert (GimpItem *item,
GimpImageBaseType old_base_type;
GimpImageBaseType new_base_type;
- old_base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
+ 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)
diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c
index 466d150..bc870be 100644
--- a/app/pdb/image-cmds.c
+++ b/app/pdb/image-cmds.c
@@ -912,7 +912,7 @@ image_add_layer_invoker (GimpProcedure *procedure,
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
gimp_pdb_image_is_base_type (image,
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
error))
{
success = gimp_image_add_layer (image, layer,
@@ -951,7 +951,7 @@ image_insert_layer_invoker (GimpProcedure *procedure,
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
gimp_pdb_image_is_base_type (image,
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
error) &&
(parent == NULL ||
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, FALSE, error) &&
diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb
index 3da6601..6d10240 100644
--- a/tools/pdbgen/pdb/image.pdb
+++ b/tools/pdbgen/pdb/image.pdb
@@ -1053,7 +1053,7 @@ sub image_add_layer {
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
gimp_pdb_image_is_base_type (image,
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
error))
{
success = gimp_image_add_layer (image, layer,
@@ -1100,7 +1100,7 @@ HELP
{
if (gimp_pdb_item_is_floating (GIMP_ITEM (layer), image, error) &&
gimp_pdb_image_is_base_type (image,
- GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))),
+ gimp_drawable_get_base_type (GIMP_DRAWABLE (layer)),
error) &&
(parent == NULL ||
(gimp_pdb_item_is_in_tree (GIMP_ITEM (parent), image, FALSE, error) &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]