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.
This commit is contained in:
@ -29,6 +29,7 @@
|
|||||||
#include "gimpchannel.h"
|
#include "gimpchannel.h"
|
||||||
#include "gimpdrawable.h"
|
#include "gimpdrawable.h"
|
||||||
#include "gimpdrawable-edit.h"
|
#include "gimpdrawable-edit.h"
|
||||||
|
#include "gimpdrawablefilter.h"
|
||||||
#include "gimpcontext.h"
|
#include "gimpcontext.h"
|
||||||
#include "gimpfilloptions.h"
|
#include "gimpfilloptions.h"
|
||||||
#include "gimpimage.h"
|
#include "gimpimage.h"
|
||||||
@ -189,35 +190,42 @@ gimp_drawable_edit_fill (GimpDrawable *drawable,
|
|||||||
if (gimp_drawable_edit_can_fill_direct (drawable, options))
|
if (gimp_drawable_edit_can_fill_direct (drawable, options))
|
||||||
{
|
{
|
||||||
gimp_drawable_edit_fill_direct (drawable, options, undo_desc);
|
gimp_drawable_edit_fill_direct (drawable, options, undo_desc);
|
||||||
|
|
||||||
|
gimp_drawable_update (drawable, x, y, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GeglBuffer *buffer;
|
GeglNode *operation;
|
||||||
gdouble opacity;
|
GimpDrawableFilter *filter;
|
||||||
GimpLayerMode mode;
|
gdouble opacity;
|
||||||
GimpLayerMode composite_mode;
|
GimpLayerMode mode;
|
||||||
|
GimpLayerMode composite_mode;
|
||||||
|
|
||||||
opacity = gimp_context_get_opacity (context);
|
opacity = gimp_context_get_opacity (context);
|
||||||
mode = gimp_context_get_paint_mode (context);
|
mode = gimp_context_get_paint_mode (context);
|
||||||
composite_mode = gimp_layer_mode_get_paint_composite_mode (mode);
|
composite_mode = gimp_layer_mode_get_paint_composite_mode (mode);
|
||||||
|
|
||||||
buffer = gimp_fill_options_create_buffer (options, drawable,
|
operation = gegl_node_new_child (NULL,
|
||||||
GEGL_RECTANGLE (0, 0,
|
"operation", "gimp:fill-source",
|
||||||
width, height),
|
"options", options,
|
||||||
-x, -y);
|
"drawable", drawable,
|
||||||
|
"pattern-offset-x", -x,
|
||||||
|
"pattern-offset-y", -y,
|
||||||
|
NULL);
|
||||||
|
|
||||||
gimp_drawable_apply_buffer (drawable, buffer,
|
filter = gimp_drawable_filter_new (drawable, undo_desc, operation, NULL);
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_drawable_update (drawable, x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user