[gimp/goat-invasion: 584/608] app: allow indexed images only at u8 precision
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 584/608] app: allow indexed images only at u8 precision
- Date: Fri, 27 Apr 2012 21:14:27 +0000 (UTC)
commit 3a109010d1cd1640e69c661963274999708bfaab
Author: Michael Natterer <mitch gimp org>
Date: Wed Apr 25 15:24:32 2012 +0200
app: allow indexed images only at u8 precision
app/actions/image-actions.c | 20 +++++++++++---------
app/core/gimpimage.c | 2 ++
2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 02f287f..94e1298 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -228,11 +228,12 @@ void
image_actions_update (GimpActionGroup *group,
gpointer data)
{
- GimpImage *image = action_data_get_image (data);
- gboolean aux = FALSE;
- gboolean lp = FALSE;
- gboolean sel = FALSE;
- gboolean groups = FALSE;
+ GimpImage *image = action_data_get_image (data);
+ gboolean is_u8 = FALSE;
+ gboolean aux = FALSE;
+ gboolean lp = FALSE;
+ gboolean sel = FALSE;
+ gboolean groups = FALSE;
if (image)
{
@@ -256,9 +257,10 @@ image_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE);
- aux = (gimp_image_get_active_channel (image) != NULL);
- lp = ! gimp_image_is_empty (image);
- sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
+ is_u8 = (gimp_image_get_precision (image) == GIMP_PRECISION_U8);
+ aux = (gimp_image_get_active_channel (image) != NULL);
+ lp = ! gimp_image_is_empty (image);
+ sel = ! gimp_channel_is_empty (gimp_image_get_mask (image));
layers = gimp_image_get_layers (image);
@@ -270,7 +272,7 @@ image_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("image-convert-rgb", image);
SET_SENSITIVE ("image-convert-grayscale", image);
- SET_SENSITIVE ("image-convert-indexed", image && !groups);
+ SET_SENSITIVE ("image-convert-indexed", image && !groups && is_u8);
SET_SENSITIVE ("image-flip-horizontal", image);
SET_SENSITIVE ("image-flip-vertical", image);
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index ee2c353..20efde0 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1479,6 +1479,8 @@ gimp_image_new (Gimp *gimp,
GimpPrecision precision)
{
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+ g_return_val_if_fail (base_type != GIMP_INDEXED ||
+ precision != GIMP_PRECISION_U8, NULL);
return g_object_new (GIMP_TYPE_IMAGE,
"gimp", gimp,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]