Commit 45fc4cb4 authored by Ell's avatar Ell

app: add gimp_fill_options_fill_buffer()

... which is similar to gimp_fill_options_create_buffer(), however,
it fills an existing buffer, instead of creating a new buffer.

Implement gimp_fill_options_create_buffer() in terms of the new
function.
parent 8adec5fb
......@@ -411,7 +411,7 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
gint pattern_offset_x,
gint pattern_offset_y)
{
GeglBuffer *buffer;
GeglBuffer *buffer;
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), NULL);
g_return_val_if_fail (gimp_fill_options_get_style (options) !=
......@@ -424,6 +424,26 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
buffer = gegl_buffer_new (rect,
gimp_drawable_get_format_with_alpha (drawable));
gimp_fill_options_fill_buffer (options, drawable, buffer,
pattern_offset_x, pattern_offset_y);
return buffer;
}
void
gimp_fill_options_fill_buffer (GimpFillOptions *options,
GimpDrawable *drawable,
GeglBuffer *buffer,
gint pattern_offset_x,
gint pattern_offset_y)
{
g_return_if_fail (GIMP_IS_FILL_OPTIONS (options));
g_return_if_fail (gimp_fill_options_get_style (options) !=
GIMP_FILL_STYLE_PATTERN ||
gimp_context_get_pattern (GIMP_CONTEXT (options)) != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (GEGL_IS_BUFFER (buffer));
switch (gimp_fill_options_get_style (options))
{
case GIMP_FILL_STYLE_SOLID:
......@@ -451,6 +471,4 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
}
break;
}
return buffer;
}
......@@ -76,6 +76,11 @@ GeglBuffer * gimp_fill_options_create_buffer (GimpFillOptions *optio
const GeglRectangle *rect,
gint pattern_offset_x,
gint pattern_offset_y);
void gimp_fill_options_fill_buffer (GimpFillOptions *options,
GimpDrawable *drawable,
GeglBuffer *buffer,
gint pattern_offset_x,
gint pattern_offset_y);
#endif /* __GIMP_FILL_OPTIONS_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment