[gimp] app, libgimpcolor: never return NULL in GimpColorManaged::get_color_profile()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimpcolor: never return NULL in GimpColorManaged::get_color_profile()
- Date: Sat, 30 May 2015 20:23:36 +0000 (UTC)
commit 2e07e938f4ff7e0dd83d7c1e2a7b480efa966a86
Author: Michael Natterer <mitch gimp org>
Date: Sat May 30 22:19:36 2015 +0200
app, libgimpcolor: never return NULL in GimpColorManaged::get_color_profile()
app/display/gimpdisplayshell.c | 3 ++-
libgimpcolor/gimpcolormanaged.c | 10 +++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 23af1f8..69c0113 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1145,7 +1145,8 @@ gimp_display_shell_get_color_profile (GimpColorManaged *managed)
if (image)
return gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
- return NULL;
+ /* never return a NULL profile */
+ return gimp_lcms_create_srgb_profile ();;
}
static void
diff --git a/libgimpcolor/gimpcolormanaged.c b/libgimpcolor/gimpcolormanaged.c
index 9678104..f73efa0 100644
--- a/libgimpcolor/gimpcolormanaged.c
+++ b/libgimpcolor/gimpcolormanaged.c
@@ -21,11 +21,13 @@
#include "config.h"
-#include <glib-object.h>
+#include <gio/gio.h>
+#include <gegl.h>
#include "gimpcolortypes.h"
#include "gimpcolormanaged.h"
+#include "gimplcms.h"
/**
@@ -132,7 +134,8 @@ gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
* gimp_color_managed_get_color_profile:
* @managed: an object the implements the #GimpColorManaged interface
*
- * This function, if implemented, always returns a #GimpColorProfile.
+ * This function always returns a #GimpColorProfile and falls back to
+ * gimp_lcms_create_srgb_profile() if the method is not implemented.
*
* Return value: The @managed's #GimpColorProfile.
*
@@ -150,7 +153,8 @@ gimp_color_managed_get_color_profile (GimpColorManaged *managed)
if (iface->get_color_profile)
return iface->get_color_profile (managed);
- return NULL;
+ /* never return a NULL profile */
+ return gimp_lcms_create_srgb_profile ();
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]