[gegl] bin: add configuration flag nearest_neighbor for high performance scaled blits
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] bin: add configuration flag nearest_neighbor for high performance scaled blits
- Date: Fri, 22 Mar 2019 21:28:33 +0000 (UTC)
commit 8699b0665803ee2a1b7430ab2cb573a7d6cbf0f7
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Mar 22 22:27:23 2019 +0100
bin: add configuration flag nearest_neighbor for high performance scaled blits
bin/lua/init.lua | 1 +
bin/mrg-gegl.c | 7 ++++---
bin/mrg-gegl.h | 2 ++
bin/ui-core.c | 3 +++
bin/ui.h | 3 +++
5 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/bin/lua/init.lua b/bin/lua/init.lua
index 97bdb64f6..50a5dee05 100644
--- a/bin/lua/init.lua
+++ b/bin/lua/init.lua
@@ -74,6 +74,7 @@ struct _GeState {
int is_fit;
int show_bounding_box;
float dir_scale;
+ int nearest_neighbor;
float render_quality; /* default (and in code swapped for preview_quality during preview rendering,
this is the canonical read location for the value) */
float preview_quality;
diff --git a/bin/mrg-gegl.c b/bin/mrg-gegl.c
index 8144e58e4..069b2c580 100644
--- a/bin/mrg-gegl.c
+++ b/bin/mrg-gegl.c
@@ -69,6 +69,7 @@ void mrg_gegl_buffer_blit (Mrg *mrg,
float u, float v,
float scale,
float preview_multiplier,
+ int nearest_neighbor,
int color_manage_display)
{
float fake_factor = preview_multiplier;
@@ -165,7 +166,7 @@ void mrg_gegl_buffer_blit (Mrg *mrg,
fmt = fmt_srgb;
}
gegl_buffer_get (buffer, &roi, scale / fake_factor, fmt, buf, width * 4,
- GEGL_ABYSS_NONE);
+ GEGL_ABYSS_NONE | (nearest_neighbor?GEGL_BUFFER_FILTER_NEAREST:0));
surface = cairo_image_surface_create_for_data (buf, CAIRO_FORMAT_RGB24, width, height, width * 4);
}
@@ -204,6 +205,7 @@ void mrg_gegl_blit (Mrg *mrg,
float u, float v,
float scale,
float preview_multiplier,
+ int nearest_neighbor,
int color_manage_display)
{
float fake_factor = preview_multiplier;
@@ -272,9 +274,8 @@ void mrg_gegl_blit (Mrg *mrg,
fmt = fmt_srgb;
}
-
gegl_node_blit (node, scale / fake_factor, &roi, fmt, buf, width * 4,
- GEGL_BLIT_DEFAULT);
+ GEGL_BLIT_DEFAULT | (nearest_neighbor?GEGL_BUFFER_FILTER_NEAREST:0));
surface = cairo_image_surface_create_for_data (buf, CAIRO_FORMAT_RGB24, width, height, width * 4);
}
diff --git a/bin/mrg-gegl.h b/bin/mrg-gegl.h
index f335d45dd..1bc15a186 100644
--- a/bin/mrg-gegl.h
+++ b/bin/mrg-gegl.h
@@ -11,6 +11,7 @@ void mrg_gegl_buffer_blit (Mrg *mrg,
float u, float v,
float scale,
float preview_multiplier,
+ int nearest_neighbor,
int color_manage);
@@ -21,6 +22,7 @@ void mrg_gegl_blit (Mrg *mrg,
float u, float v,
float scale,
float preview_multiplier,
+ int nearest_neighbor,
int color_manage);
diff --git a/bin/ui-core.c b/bin/ui-core.c
index 991111ad0..ae2e418f0 100644
--- a/bin/ui-core.c
+++ b/bin/ui-core.c
@@ -443,6 +443,7 @@ Setting settings[]=
INT_PROP(show_bounding_box, "show bounding box of active node"),
INT_PROP(show_controls, "show image viewer controls (maybe merge with show-graph and give better name)"),
INT_PROP(slide_enabled, "slide show going"),
+ INT_PROP(nearest_neighbor, "nearest neighbor"),
FLOAT_PROP(slide_pause, "display scale factor"),
};
@@ -4781,6 +4782,7 @@ static void gegl_ui (Mrg *mrg, void *data)
o->u, o->v,
o->scale,
o->render_quality,
+ o->nearest_neighbor,
o->color_managed_display);
break;
case GEGL_RENDERER_THREAD:
@@ -4795,6 +4797,7 @@ static void gegl_ui (Mrg *mrg, void *data)
o->u, o->v,
o->scale,
o->render_quality,
+ o->nearest_neighbor,
o->color_managed_display);
g_object_unref (buffer);
} else {
diff --git a/bin/ui.h b/bin/ui.h
index 61765e703..7c7dcaec3 100644
--- a/bin/ui.h
+++ b/bin/ui.h
@@ -85,6 +85,9 @@ struct _GeState {
int is_fit;
int show_bounding_box;
float dir_scale;
+
+ int nearest_neighbor;
+
float render_quality; /* default (and in code swapped for preview_quality during preview
rendering, this is the canonical read location for the value) */
float preview_quality;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]