[gimp/gimp-2-10] app: add gimp_fill_options_fill_buffer()



commit 5d536afdeddc91c48b9c12cdc9155d705a38dfaf
Author: Ell <ell_se yahoo com>
Date:   Sun Dec 2 03:05:36 2018 -0500

    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.
    
    (cherry picked from commit 45fc4cb4f9552b3a9b315a86ee8e272c08732654)

 app/core/gimpfilloptions.c | 24 +++++++++++++++++++++---
 app/core/gimpfilloptions.h |  5 +++++
 2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index fb42509da0..95398fb900 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -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;
 }
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index f4277c5466..d8dcfa4ba5 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]