[gimp/gimp-2-10] app: use gimp:fill-source in gimp_drawable_edit_fill()
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: use gimp:fill-source in gimp_drawable_edit_fill()
- Date: Wed, 27 Mar 2019 19:49:32 +0000 (UTC)
commit 9063b937fe1b667e46769770e5938de01aa7c6f3
Author: Ell <ell_se yahoo com>
Date: Wed Mar 27 15:38:06 2019 -0400
app: use gimp:fill-source in gimp_drawable_edit_fill()
In gimp_drawable_edit_fill(), when performing a non-direct fill,
use a GimpDrawableFilter with gimp:fill-source, added in the
previous commit, instead of using gimp_drawable_apply_buffer() with
an intermediate fill buffer. This avoids allocating a full-size
fill buffer, which may occupy a lot of space in pattern fills.
(cherry picked from commit 234f76b6fb7402dda6cd1ab4a95c33c666768002)
app/core/gimpdrawable-edit.c | 52 +++++++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 22 deletions(-)
---
diff --git a/app/core/gimpdrawable-edit.c b/app/core/gimpdrawable-edit.c
index 5da8a9d651..214b8fb802 100644
--- a/app/core/gimpdrawable-edit.c
+++ b/app/core/gimpdrawable-edit.c
@@ -29,6 +29,7 @@
#include "gimpchannel.h"
#include "gimpdrawable.h"
#include "gimpdrawable-edit.h"
+#include "gimpdrawablefilter.h"
#include "gimpcontext.h"
#include "gimpfilloptions.h"
#include "gimpimage.h"
@@ -189,35 +190,42 @@ gimp_drawable_edit_fill (GimpDrawable *drawable,
if (gimp_drawable_edit_can_fill_direct (drawable, options))
{
gimp_drawable_edit_fill_direct (drawable, options, undo_desc);
+
+ gimp_drawable_update (drawable, x, y, width, height);
}
else
{
- GeglBuffer *buffer;
- gdouble opacity;
- GimpLayerMode mode;
- GimpLayerMode composite_mode;
+ GeglNode *operation;
+ GimpDrawableFilter *filter;
+ gdouble opacity;
+ GimpLayerMode mode;
+ GimpLayerMode composite_mode;
opacity = gimp_context_get_opacity (context);
mode = gimp_context_get_paint_mode (context);
composite_mode = gimp_layer_mode_get_paint_composite_mode (mode);
- buffer = gimp_fill_options_create_buffer (options, drawable,
- GEGL_RECTANGLE (0, 0,
- width, height),
- -x, -y);
-
- gimp_drawable_apply_buffer (drawable, buffer,
- GEGL_RECTANGLE (0, 0, width, height),
- TRUE, undo_desc,
- opacity,
- mode,
- GIMP_LAYER_COLOR_SPACE_AUTO,
- GIMP_LAYER_COLOR_SPACE_AUTO,
- composite_mode,
- NULL, x, y);
-
- g_object_unref (buffer);
- }
+ operation = gegl_node_new_child (NULL,
+ "operation", "gimp:fill-source",
+ "options", options,
+ "drawable", drawable,
+ "pattern-offset-x", -x,
+ "pattern-offset-y", -y,
+ NULL);
+
+ filter = gimp_drawable_filter_new (drawable, undo_desc, operation, NULL);
- gimp_drawable_update (drawable, x, y, width, height);
+ gimp_drawable_filter_set_opacity (filter, opacity);
+ gimp_drawable_filter_set_mode (filter,
+ mode,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ composite_mode);
+
+ gimp_drawable_filter_apply (filter, NULL);
+ gimp_drawable_filter_commit (filter, NULL, FALSE);
+
+ g_object_unref (filter);
+ g_object_unref (operation);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]