[gimp/gimp-2-10] app: properly handle NULL rectangle arguments in gimp-gegl-loops
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: properly handle NULL rectangle arguments in gimp-gegl-loops
- Date: Thu, 21 Jun 2018 16:32:49 +0000 (UTC)
commit cc626176b18fbe0b17118897ca5329723ee72b60
Author: Ell <ell_se yahoo com>
Date: Thu Jun 21 08:04:31 2018 -0400
app: properly handle NULL rectangle arguments in gimp-gegl-loops
... and gimppaintcore-loops
When a rectangle argument is NULL, use the extents of the
corresponding buffer, instead of raising a CRITICAL, to match the
old behavior.
(cherry picked from commit 8a881ca61a74f9d1cac4e208f972d193beb21aaa)
app/gegl/gimp-gegl-loops.cc | 54 ++++++++++++++++++++++++++++++++++++++++
app/paint/gimppaintcore-loops.cc | 15 ++++++-----
app/paint/gimppaintcore-loops.h | 2 +-
3 files changed, 64 insertions(+), 7 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-loops.cc b/app/gegl/gimp-gegl-loops.cc
index 419df1d8cf..e1091ccf41 100644
--- a/app/gegl/gimp-gegl-loops.cc
+++ b/app/gegl/gimp-gegl-loops.cc
@@ -112,6 +112,12 @@ gimp_gegl_convolve (GeglBuffer *src_buffer,
gint dest_components;
gfloat offset;
+ if (! src_rect)
+ src_rect = gegl_buffer_get_extent (src_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
src_format = gegl_buffer_get_format (src_buffer);
if (babl_format_is_palette (src_format))
@@ -300,6 +306,12 @@ gimp_gegl_dodgeburn (GeglBuffer *src_buffer,
if (type == GIMP_DODGE_BURN_TYPE_BURN)
exposure = -exposure;
+ if (! src_rect)
+ src_rect = gegl_buffer_get_extent (src_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
gimp_parallel_distribute_area (src_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *src_area)
{
@@ -517,6 +529,12 @@ gimp_gegl_smudge_with_paint (GeglBuffer *accum_buffer,
gboolean sse2 = (gimp_cpu_accel_get_support () &
GIMP_CPU_ACCEL_X86_SSE2);
+ if (! accum_rect)
+ accum_rect = gegl_buffer_get_extent (accum_buffer);
+
+ if (! canvas_rect)
+ canvas_rect = gegl_buffer_get_extent (canvas_buffer);
+
/* convert brush color from double to float */
if (brush_color)
{
@@ -591,6 +609,12 @@ gimp_gegl_apply_mask (GeglBuffer *mask_buffer,
const GeglRectangle *dest_rect,
gdouble opacity)
{
+ if (! mask_rect)
+ mask_rect = gegl_buffer_get_extent (mask_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
gimp_parallel_distribute_area (mask_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *mask_area)
{
@@ -630,6 +654,12 @@ gimp_gegl_combine_mask (GeglBuffer *mask_buffer,
const GeglRectangle *dest_rect,
gdouble opacity)
{
+ if (! mask_rect)
+ mask_rect = gegl_buffer_get_extent (mask_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
gimp_parallel_distribute_area (mask_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *mask_area)
{
@@ -670,6 +700,12 @@ gimp_gegl_combine_mask_weird (GeglBuffer *mask_buffer,
gdouble opacity,
gboolean stipple)
{
+ if (! mask_rect)
+ mask_rect = gegl_buffer_get_extent (mask_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
gimp_parallel_distribute_area (mask_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *mask_area)
{
@@ -728,6 +764,18 @@ gimp_gegl_replace (GeglBuffer *top_buffer,
gdouble opacity,
const gboolean *affect)
{
+ if (! top_rect)
+ top_rect = gegl_buffer_get_extent (top_buffer);
+
+ if (! bottom_rect)
+ bottom_rect = gegl_buffer_get_extent (bottom_buffer);
+
+ if (! mask_rect)
+ mask_rect = gegl_buffer_get_extent (mask_buffer);
+
+ if (! dest_rect)
+ dest_rect = gegl_buffer_get_extent (dest_buffer);
+
gimp_parallel_distribute_area (top_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *top_area)
{
@@ -838,6 +886,12 @@ gimp_gegl_index_to_mask (GeglBuffer *indexed_buffer,
const GeglRectangle *mask_rect,
gint index)
{
+ if (! indexed_rect)
+ indexed_rect = gegl_buffer_get_extent (indexed_buffer);
+
+ if (! mask_rect)
+ mask_rect = gegl_buffer_get_extent (mask_buffer);
+
gimp_parallel_distribute_area (indexed_rect, MIN_PARALLEL_SUB_AREA,
[=] (const GeglRectangle *indexed_area)
{
diff --git a/app/paint/gimppaintcore-loops.cc b/app/paint/gimppaintcore-loops.cc
index 92c8ab5eb7..6d950ed3e7 100644
--- a/app/paint/gimppaintcore-loops.cc
+++ b/app/paint/gimppaintcore-loops.cc
@@ -1319,15 +1319,18 @@ do_layer_blend (GeglBuffer *src_buffer,
*/
void
-mask_components_onto (GeglBuffer *src_buffer,
- GeglBuffer *aux_buffer,
- GeglBuffer *dst_buffer,
- GeglRectangle *roi,
- GimpComponentMask mask,
- gboolean linear_mode)
+mask_components_onto (GeglBuffer *src_buffer,
+ GeglBuffer *aux_buffer,
+ GeglBuffer *dst_buffer,
+ const GeglRectangle *roi,
+ GimpComponentMask mask,
+ gboolean linear_mode)
{
const Babl *iterator_format;
+ if (! roi)
+ roi = gegl_buffer_get_extent (dst_buffer);
+
if (linear_mode)
iterator_format = babl_format ("RGBA float");
else
diff --git a/app/paint/gimppaintcore-loops.h b/app/paint/gimppaintcore-loops.h
index 1e2c1fdce6..541b2330a0 100644
--- a/app/paint/gimppaintcore-loops.h
+++ b/app/paint/gimppaintcore-loops.h
@@ -95,7 +95,7 @@ void do_layer_blend (GeglBuffer *src_buf
void mask_components_onto (GeglBuffer *src_buffer,
GeglBuffer *aux_buffer,
GeglBuffer *dst_buffer,
- GeglRectangle *roi,
+ const GeglRectangle *roi,
GimpComponentMask mask,
gboolean linear_mode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]