[gegl] emboss: make mipmap rendering capable
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] emboss: make mipmap rendering capable
- Date: Wed, 12 Dec 2018 17:46:06 +0000 (UTC)
commit 700d4a626cb840fe1af933e64f5e241bd7c87e53
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Dec 12 18:45:15 2018 +0100
emboss: make mipmap rendering capable
operations/common-gpl3+/emboss.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/operations/common-gpl3+/emboss.c b/operations/common-gpl3+/emboss.c
index 71f60e09c..031ac15a8 100644
--- a/operations/common-gpl3+/emboss.c
+++ b/operations/common-gpl3+/emboss.c
@@ -215,6 +215,7 @@ process (GeglOperation *operation,
const Babl *format;
gint y;
gint floats_per_pixel;
+ float factor = 1.0f / (1<<level);
/*blur-map or emboss*/
if (o->type == GEGL_EMBOSS_TYPE_BUMPMAP)
@@ -233,18 +234,26 @@ process (GeglOperation *operation,
rect.y = result->y - op_area->top;
rect.height = result->height + op_area->top + op_area->bottom;
+ if (level)
+ {
+ rect.x *= factor;
+ rect.y *= factor;
+ rect.width *= factor;
+ rect.height *= factor;
+ }
+
src_buf = g_new0 (gfloat, rect.width * rect.height * floats_per_pixel);
dst_buf = g_new0 (gfloat, rect.width * rect.height * floats_per_pixel);
- gegl_buffer_get (input, &rect, 1.0, format, src_buf,
+ gegl_buffer_get (input, &rect, factor, format, src_buf,
GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
/*do for every row*/
for (y = 0; y < rect.height; y++)
emboss (src_buf, &rect, dst_buf, &rect, o->type, y, floats_per_pixel,
- DEG_TO_RAD (o->azimuth), DEG_TO_RAD (o->elevation), o->depth);
+ DEG_TO_RAD (o->azimuth), DEG_TO_RAD (o->elevation), o->depth * factor);
- gegl_buffer_set (output, &rect, 0, format,
+ gegl_buffer_set (output, &rect, level, format,
dst_buf, GEGL_AUTO_ROWSTRIDE);
g_free (src_buf);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]