[gimp] app: move factored out compositing to common header
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move factored out compositing to common header
- Date: Fri, 13 Jan 2017 19:19:46 +0000 (UTC)
commit be8c2015a0a320cd1213519cfabcb288555f17a3
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Jan 13 18:02:06 2017 +0100
app: move factored out compositing to common header
.../layer-modes/gimpoperationlchchroma.c | 36 ------------------
.../layer-modes/gimpoperationpointlayermode.h | 38 ++++++++++++++++++++
2 files changed, 38 insertions(+), 36 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlchchroma.c
b/app/operations/layer-modes/gimpoperationlchchroma.c
index 2854e4c..b1bf8d7 100644
--- a/app/operations/layer-modes/gimpoperationlchchroma.c
+++ b/app/operations/layer-modes/gimpoperationlchchroma.c
@@ -122,42 +122,6 @@ chroma_pre_process (const Babl *from_fish,
babl_process (to_fish, out, out, samples);
}
-static void
-gimp_operation_layer_composite (const gfloat *in,
- const gfloat *layer,
- const gfloat *mask,
- gfloat *out,
- gfloat opacity,
- glong samples)
-{
- while (samples--)
- {
- gfloat comp_alpha = layer[ALPHA] * opacity;
- if (mask)
- comp_alpha *= *mask++;
- if (comp_alpha != 0.0f)
- {
- out[RED] = out[RED] * comp_alpha + in[RED] * (1.0f - comp_alpha);
- out[GREEN] = out[GREEN] * comp_alpha + in[GREEN] * (1.0f - comp_alpha);
- out[BLUE] = out[BLUE] * comp_alpha + in[BLUE] * (1.0f - comp_alpha);
- }
- else
- {
- gint b;
- for (b = RED; b < ALPHA; b++)
- {
- out[b] = in[b];
- }
- }
-
- out[ALPHA] = in[ALPHA];
-
- in += 4;
- layer += 4;
- out += 4;
- }
-}
-
gboolean
gimp_operation_lch_chroma_process_pixels_linear (gfloat *in,
gfloat *layer,
diff --git a/app/operations/layer-modes/gimpoperationpointlayermode.h
b/app/operations/layer-modes/gimpoperationpointlayermode.h
index 461fc25..af0a6e0 100644
--- a/app/operations/layer-modes/gimpoperationpointlayermode.h
+++ b/app/operations/layer-modes/gimpoperationpointlayermode.h
@@ -52,4 +52,42 @@ struct _GimpOperationPointLayerMode
GType gimp_operation_point_layer_mode_get_type (void) G_GNUC_CONST;
+static inline void
+gimp_operation_layer_composite (const gfloat *in,
+ const gfloat *layer,
+ const gfloat *mask,
+ gfloat *out,
+ gfloat opacity,
+ glong samples)
+{
+ while (samples--)
+ {
+ gfloat comp_alpha = layer[ALPHA] * opacity;
+ if (mask)
+ comp_alpha *= *mask++;
+ if (comp_alpha != 0.0f)
+ {
+ out[RED] = out[RED] * comp_alpha + in[RED] * (1.0f - comp_alpha);
+ out[GREEN] = out[GREEN] * comp_alpha + in[GREEN] * (1.0f - comp_alpha);
+ out[BLUE] = out[BLUE] * comp_alpha + in[BLUE] * (1.0f - comp_alpha);
+ }
+ else
+ {
+ gint b;
+ for (b = RED; b < ALPHA; b++)
+ {
+ out[b] = in[b];
+ }
+ }
+
+ out[ALPHA] = in[ALPHA];
+
+ in += 4;
+ layer += 4;
+ out += 4;
+ }
+}
+
+
+
#endif /* __GIMP_OPERATION_POINT_LAYER_MODE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]