[gimp] app: improve gimp_layer_mode_get_format()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: improve gimp_layer_mode_get_format()
- Date: Mon, 12 Feb 2018 18:50:18 +0000 (UTC)
commit 8d3b28727318b1e61143da46f41734f9bb17b255
Author: Ell <ell_se yahoo com>
Date: Mon Feb 12 13:32:59 2018 -0500
app: improve gimp_layer_mode_get_format()
When the layer mode is composite-space agnostic, return a fast
format based on the preferred format's model, not the exact format.
app/operations/layer-modes/gimp-layer-modes.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/app/operations/layer-modes/gimp-layer-modes.c b/app/operations/layer-modes/gimp-layer-modes.c
index a42311d..8209580 100644
--- a/app/operations/layer-modes/gimp-layer-modes.c
+++ b/app/operations/layer-modes/gimp-layer-modes.c
@@ -22,9 +22,12 @@
#include "config.h"
#include <glib-object.h>
+#include <gegl.h>
#include "../operations-types.h"
+#include "gegl/gimp-babl.h"
+
#include "gimpoperationlayermode.h"
#include "gimpoperationlayermode-blend.h"
@@ -1410,18 +1413,13 @@ gimp_layer_mode_get_format (GimpLayerMode mode,
switch (composite_space)
{
case GIMP_LAYER_COLOR_SPACE_AUTO:
- /* compositing is color-space agnostic. try to return the preferred
- * format, and fall back to linear.
+ /* compositing is color-space agnostic. return a format that has a fast
+ * conversion path to/from the preferred format.
*/
- if (preferred_format == babl_format ("RGBA float") ||
- preferred_format == babl_format ("R'G'B'A float"))
- {
- return preferred_format;
- }
+ if (gimp_babl_format_get_linear (preferred_format))
+ return babl_format ("RGBA float");
else
- {
- return babl_format ("RGBA float");
- }
+ return babl_format ("R'G'B'A float");
case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
return babl_format ("RGBA float");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]