[gegl] gegl/operation: make gegl_operation_get_format always return a format
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl/operation: make gegl_operation_get_format always return a format
- Date: Wed, 13 Jul 2022 17:51:44 +0000 (UTC)
commit fcb978e4d8a9df62a103c5a69e8602f4b29c87c3
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Jul 13 19:22:27 2022 +0200
gegl/operation: make gegl_operation_get_format always return a format
Instead of NULL we return "RGBA float", this effectively makes it a
default fallback format - and simplifies other parts of the code
which can now presume a valid format to exist. This fixes issue #308.
gegl/operation/gegl-operation-context.c | 7 -------
gegl/operation/gegl-operation.c | 8 +++++---
2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 939dcfe21..c3d9af502 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -323,13 +323,6 @@ gegl_operation_context_get_target (GeglOperationContext *context,
node = operation->node; /* <ick */
format = gegl_operation_get_format (operation, padname);
- if (format == NULL)
- {
- g_warning ("no format for %s presuming RGBA float\n",
- gegl_node_get_debug_name (node));
- format = gegl_babl_rgba_linear_float ();
- }
- g_assert (format != NULL);
result = &context->result_rect;
diff --git a/gegl/operation/gegl-operation.c b/gegl/operation/gegl-operation.c
index 3de589e5a..c271aee00 100644
--- a/gegl/operation/gegl-operation.c
+++ b/gegl/operation/gegl-operation.c
@@ -560,12 +560,14 @@ gegl_operation_get_format (GeglOperation *self,
{
GeglPad *pad;
- g_return_val_if_fail (GEGL_IS_OPERATION (self), NULL);
- g_return_val_if_fail (pad_name != NULL, NULL);
+ g_return_val_if_fail (GEGL_IS_OPERATION (self) && pad_name != NULL,
+ gegl_babl_rgba_linear_float ());
pad = gegl_node_get_pad (self->node, pad_name);
- g_return_val_if_fail (pad != NULL, NULL);
+ if (pad == NULL ||
+ pad->format == NULL)
+ return gegl_babl_rgba_linear_float ();
return pad->format;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]