[gimp/gimp-2-10] app: use compositing format for fill buffer
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: use compositing format for fill buffer
- Date: Wed, 27 Mar 2019 19:49:17 +0000 (UTC)
commit 1416571389dfd867c13c20b83640e504fd174573
Author: Ell <ell_se yahoo com>
Date: Wed Mar 27 12:33:21 2019 -0400
app: use compositing format for fill buffer
Add gimp_fill_options_get_format(), which returns the format to be
used for the fill buffer; this is the same format used during
compositing. Use this format in gimp_fill_options_create_buffer(),
instead of the drawable format.
This fixes the result of fill operations when the fill color/
pattern is not representable in the drawable format, and speeds up
color fills by avoiding color-conversion for the fill buffer during
processing.
(cherry picked from commit 245a17c79f81413a47d9df309b20af46e8f15c44)
app/core/gimpfilloptions.c | 21 ++++++++++++++++++++-
app/core/gimpfilloptions.h | 3 +++
2 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index 95398fb900..6c232ce906 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -29,6 +29,8 @@
#include "core-types.h"
+#include "operations/layer-modes/gimp-layer-modes.h"
+
#include "gimp.h"
#include "gimp-palettes.h"
#include "gimpdrawable.h"
@@ -404,6 +406,23 @@ gimp_fill_options_get_undo_desc (GimpFillOptions *options)
g_return_val_if_reached (NULL);
}
+const Babl *
+gimp_fill_options_get_format (GimpFillOptions *options,
+ GimpDrawable *drawable)
+{
+ GimpContext *context;
+
+ g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), NULL);
+ g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+ context = GIMP_CONTEXT (options);
+
+ return gimp_layer_mode_get_format (gimp_context_get_paint_mode (context),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ gimp_drawable_get_format (drawable));
+}
+
GeglBuffer *
gimp_fill_options_create_buffer (GimpFillOptions *options,
GimpDrawable *drawable,
@@ -422,7 +441,7 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
g_return_val_if_fail (rect != NULL, NULL);
buffer = gegl_buffer_new (rect,
- gimp_drawable_get_format_with_alpha (drawable));
+ gimp_fill_options_get_format (options, drawable));
gimp_fill_options_fill_buffer (options, drawable, buffer,
pattern_offset_x, pattern_offset_y);
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index d8dcfa4ba5..2d183a129f 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -71,6 +71,9 @@ gboolean gimp_fill_options_set_by_fill_mode (GimpFillOptions *optio
const gchar * gimp_fill_options_get_undo_desc (GimpFillOptions *options);
+const Babl * gimp_fill_options_get_format (GimpFillOptions *options,
+ GimpDrawable *drawable);
+
GeglBuffer * gimp_fill_options_create_buffer (GimpFillOptions *options,
GimpDrawable *drawable,
const GeglRectangle *rect,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]