[gimp] app: fix painting with the new layer mode code
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix painting with the new layer mode code
- Date: Fri, 20 Jan 2017 23:29:10 +0000 (UTC)
commit 485094b9dae1bc08a687b7064ce7092e3c5db845
Author: Michael Natterer <mitch gimp org>
Date: Sat Jan 21 00:27:48 2017 +0100
app: fix painting with the new layer mode code
by creating temp buffers matching the format needed by the
GimpLayerMode's process_pixels() function.
app/paint/gimpbrushcore.c | 5 ++++-
app/paint/gimpconvolve.c | 4 +++-
app/paint/gimpdodgeburn.c | 4 +++-
app/paint/gimperaser.c | 4 +++-
app/paint/gimpink.c | 28 ++++++++++++++++++----------
app/paint/gimppaintbrush.c | 9 +++++++--
app/paint/gimppaintcore-loops.c | 3 +--
app/paint/gimppaintcore-loops.h | 1 -
app/paint/gimppaintcore.c | 11 ++++++-----
app/paint/gimppaintcore.h | 4 ++--
app/paint/gimpsmudge.c | 8 ++++++--
app/paint/gimpsourcecore.c | 7 ++++++-
12 files changed, 59 insertions(+), 29 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index bc2950e..f0ae9f2 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -28,6 +28,7 @@
#include "gegl/gimp-babl.h"
+#include "core/gimp-layer-modes.h"
#include "core/gimpbrush.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpdrawable.h"
@@ -83,6 +84,7 @@ static void gimp_brush_core_interpolate (GimpPaintCore *core,
static GeglBuffer * gimp_brush_core_get_paint_buffer(GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -819,6 +821,7 @@ static GeglBuffer *
gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -858,7 +861,7 @@ gimp_brush_core_get_paint_buffer (GimpPaintCore *paint_core,
GimpTempBuf *temp_buf;
const Babl *format;
- if (gimp_drawable_get_linear (drawable))
+ if (gimp_layer_mode_is_linear (paint_mode))
format = babl_format ("RGBA float");
else
format = babl_format ("R'G'B'A float");
diff --git a/app/paint/gimpconvolve.c b/app/paint/gimpconvolve.c
index 15e4112..91ca86e 100644
--- a/app/paint/gimpconvolve.c
+++ b/app/paint/gimpconvolve.c
@@ -166,7 +166,9 @@ gimp_convolve_motion (GimpPaintCore *paint_core,
coords = gimp_symmetry_get_coords (sym, i);
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ GIMP_LAYER_MODE_NORMAL,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
&paint_width,
diff --git a/app/paint/gimpdodgeburn.c b/app/paint/gimpdodgeburn.c
index 05fc9e0..ae87d06 100644
--- a/app/paint/gimpdodgeburn.c
+++ b/app/paint/gimpdodgeburn.c
@@ -150,7 +150,9 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
coords = gimp_symmetry_get_coords (sym, i);
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ GIMP_LAYER_MODE_NORMAL,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
&paint_width,
diff --git a/app/paint/gimperaser.c b/app/paint/gimperaser.c
index 320c1ad..4bec328 100644
--- a/app/paint/gimperaser.c
+++ b/app/paint/gimperaser.c
@@ -187,7 +187,9 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ paint_mode,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
&paint_width,
diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c
index fe694a2..dd0201e 100644
--- a/app/paint/gimpink.c
+++ b/app/paint/gimpink.c
@@ -28,6 +28,7 @@
#include "gegl/gimp-gegl-utils.h"
+#include "core/gimp-layer-modes.h"
#include "core/gimp-palettes.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@@ -60,6 +61,7 @@ static void gimp_ink_paint (GimpPaintCore *paint_core,
static GeglBuffer * gimp_ink_get_paint_buffer (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -222,6 +224,7 @@ static GeglBuffer *
gimp_ink_get_paint_buffer (GimpPaintCore *paint_core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -255,7 +258,7 @@ gimp_ink_get_paint_buffer (GimpPaintCore *paint_core,
GimpTempBuf *temp_buf;
const Babl *format;
- if (gimp_drawable_get_linear (drawable))
+ if (gimp_layer_mode_is_linear (paint_mode))
format = babl_format ("RGBA float");
else
format = babl_format ("R'G'B'A float");
@@ -306,6 +309,7 @@ gimp_ink_motion (GimpPaintCore *paint_core,
GeglBuffer *paint_buffer;
gint paint_buffer_x;
gint paint_buffer_y;
+ GimpLayerMode paint_mode;
GimpRGB foreground;
GeglColor *color;
GimpBlob *last_blob;
@@ -380,7 +384,13 @@ gimp_ink_motion (GimpPaintCore *paint_core,
blobs_to_render = g_list_reverse (blobs_to_render);
}
- /* Get the buffer */
+ paint_mode = gimp_context_get_paint_mode (context);
+
+ gimp_context_get_foreground (context, &foreground);
+ gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+ &foreground, &foreground);
+ color = gimp_gegl_color_new (&foreground);
+
for (i = 0; i < n_strokes; i++)
{
GimpBlob *blob_to_render = g_list_nth_data (blobs_to_render, i);
@@ -389,7 +399,9 @@ gimp_ink_motion (GimpPaintCore *paint_core,
ink->cur_blob = blob_to_render;
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ paint_mode,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
NULL, NULL);
@@ -398,13 +410,7 @@ gimp_ink_motion (GimpPaintCore *paint_core,
if (! paint_buffer)
continue;
- gimp_context_get_foreground (context, &foreground);
- gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
- &foreground, &foreground);
- color = gimp_gegl_color_new (&foreground);
-
gegl_buffer_set_color (paint_buffer, NULL, color);
- g_object_unref (color);
/* draw the blob directly to the canvas_buffer */
render_blob (paint_core->canvas_buffer,
@@ -422,11 +428,13 @@ gimp_ink_motion (GimpPaintCore *paint_core,
drawable,
GIMP_OPACITY_OPAQUE,
gimp_context_get_opacity (context),
- gimp_context_get_paint_mode (context),
+ paint_mode,
GIMP_PAINT_CONSTANT);
}
+ g_object_unref (color);
+
g_list_free_full (blob_unions, g_free);
}
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index ae8cc35..618a5df 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -136,6 +136,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = brush_core->dynamics;
GimpImage *image;
+ GimpLayerMode paint_mode;
GimpRGB gradient_color;
GeglBuffer *paint_buffer;
gint paint_buffer_x;
@@ -181,6 +182,8 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords);
}
+ paint_mode = gimp_context_get_paint_mode (context);
+
n_strokes = gimp_symmetry_get_size (sym);
for (i = 0; i < n_strokes; i++)
{
@@ -189,7 +192,9 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords = gimp_symmetry_get_coords (sym, i);
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ paint_mode,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
&paint_width,
@@ -263,7 +268,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
- gimp_context_get_paint_mode (context),
+ paint_mode,
gimp_paint_options_get_brush_mode (paint_options),
force,
paint_appl_mode, op);
diff --git a/app/paint/gimppaintcore-loops.c b/app/paint/gimppaintcore-loops.c
index 33b2a8d..979e9e0 100644
--- a/app/paint/gimppaintcore-loops.c
+++ b/app/paint/gimppaintcore-loops.c
@@ -295,7 +295,6 @@ do_layer_blend (GeglBuffer *src_buffer,
gint y_offset,
gint mask_x_offset,
gint mask_y_offset,
- gboolean linear_mode,
GimpLayerMode paint_mode)
{
GeglRectangle roi;
@@ -318,7 +317,7 @@ do_layer_blend (GeglBuffer *src_buffer,
composite_trc = gimp_layer_mode_get_composite_space (paint_mode);
composite_mode = gimp_layer_mode_get_composite_mode (paint_mode);
- if (linear_mode)
+ if (gimp_layer_mode_is_linear (paint_mode))
iterator_format = babl_format ("RGBA float");
else
iterator_format = babl_format ("R'G'B'A float");
diff --git a/app/paint/gimppaintcore-loops.h b/app/paint/gimppaintcore-loops.h
index 7e58a8f..45c48d6 100644
--- a/app/paint/gimppaintcore-loops.h
+++ b/app/paint/gimppaintcore-loops.h
@@ -44,7 +44,6 @@ void do_layer_blend (GeglBuffer *src_buffer,
gint y_offset,
gint mask_x_offset,
gint mask_y_offset,
- gboolean linear_mode,
GimpLayerMode paint_mode);
void mask_components_onto (GeglBuffer *src_buffer,
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index 6b6317b..72b116d 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -106,6 +106,7 @@ static GeglBuffer *
gimp_paint_core_real_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -268,6 +269,7 @@ static GeglBuffer *
gimp_paint_core_real_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -443,8 +445,6 @@ gimp_paint_core_start (GimpPaintCore *core,
core->mask_buffer = NULL;
}
- core->linear_mode = gimp_drawable_get_linear (drawable);
-
if (paint_options->use_applicator)
{
core->applicator = gimp_applicator_new (NULL, FALSE, FALSE);
@@ -476,7 +476,7 @@ gimp_paint_core_start (GimpPaintCore *core,
{
const Babl *format;
- if (core->linear_mode)
+ if (gimp_drawable_get_linear (drawable))
format = babl_format ("RGBA float");
else
format = babl_format ("R'G'B'A float");
@@ -765,6 +765,7 @@ GeglBuffer *
gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -784,6 +785,7 @@ gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
paint_buffer =
GIMP_PAINT_CORE_GET_CLASS (core)->get_paint_buffer (core, drawable,
paint_options,
+ paint_mode,
coords,
paint_buffer_x,
paint_buffer_y,
@@ -972,7 +974,6 @@ gimp_paint_core_paste (GimpPaintCore *core,
core->paint_buffer_y,
core->mask_x_offset,
core->mask_y_offset,
- gimp_layer_mode_is_linear (paint_mode),
paint_mode);
if (core->comp_buffer)
@@ -985,7 +986,7 @@ gimp_paint_core_paste (GimpPaintCore *core,
width,
height),
gimp_drawable_get_active_mask (drawable),
- gimp_layer_mode_is_linear (paint_mode));
+ gimp_drawable_get_linear (drawable));
}
}
diff --git a/app/paint/gimppaintcore.h b/app/paint/gimppaintcore.h
index 6faab77..26a8550 100644
--- a/app/paint/gimppaintcore.h
+++ b/app/paint/gimppaintcore.h
@@ -59,8 +59,6 @@ struct _GimpPaintCore
GeglBuffer *saved_proj_buffer; /* proj tiles which have been modified */
GeglBuffer *canvas_buffer; /* the buffer to paint the mask to */
GeglBuffer *comp_buffer; /* scratch buffer used when masking components */
- gboolean linear_mode; /* if painting to a linear surface */
-
GeglBuffer *paint_buffer; /* the buffer to paint pixels to */
gint paint_buffer_x;
gint paint_buffer_y;
@@ -110,6 +108,7 @@ struct _GimpPaintCoreClass
GeglBuffer * (* get_paint_buffer) (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *paint_options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
@@ -168,6 +167,7 @@ void gimp_paint_core_round_line (GimpPaintCore *core,
GeglBuffer * gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
GimpDrawable *drawable,
GimpPaintOptions *options,
+ GimpLayerMode paint_mode,
const GimpCoords *coords,
gint *paint_buffer_x,
gint *paint_buffer_y,
diff --git a/app/paint/gimpsmudge.c b/app/paint/gimpsmudge.c
index 3999032..8009697 100644
--- a/app/paint/gimpsmudge.c
+++ b/app/paint/gimpsmudge.c
@@ -212,7 +212,9 @@ gimp_smudge_start (GimpPaintCore *paint_core,
* accumulator
*/
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ GIMP_LAYER_MODE_NORMAL,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
NULL, NULL);
@@ -315,7 +317,9 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
coords = gimp_symmetry_get_coords (sym, i);
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ GIMP_LAYER_MODE_NORMAL,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
&paint_width,
diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c
index 364c70e..265cffc 100644
--- a/app/paint/gimpsourcecore.c
+++ b/app/paint/gimpsourcecore.c
@@ -376,6 +376,7 @@ gimp_source_core_motion (GimpSourceCore *source_core,
gint paint_area_height;
gdouble fade_point;
gdouble opacity;
+ GimpLayerMode paint_mode;
GeglNode *op;
GimpCoords *origin;
GimpCoords *coords;
@@ -424,13 +425,17 @@ gimp_source_core_motion (GimpSourceCore *source_core,
paint_options,
origin);
+ paint_mode = gimp_context_get_paint_mode (GIMP_CONTEXT (paint_options));
+
n_strokes = gimp_symmetry_get_size (sym);
for (i = 0; i < n_strokes; i++)
{
coords = gimp_symmetry_get_coords (sym, i);
paint_buffer = gimp_paint_core_get_paint_buffer (paint_core, drawable,
- paint_options, coords,
+ paint_options,
+ paint_mode,
+ coords,
&paint_buffer_x,
&paint_buffer_y,
NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]