[gegl] noise-simplex: deal with mipmap rendering
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] noise-simplex: deal with mipmap rendering
- Date: Fri, 4 Jul 2014 17:53:58 +0000 (UTC)
commit 63b7636fa3c58d3e4bfe36afd22688b732471246
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Jul 4 19:39:26 2014 +0200
noise-simplex: deal with mipmap rendering
operations/common/noise-simplex.c | 51 +++++++++++++++++++++----------------
1 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/operations/common/noise-simplex.c b/operations/common/noise-simplex.c
index badb31f..5e394f0 100644
--- a/operations/common/noise-simplex.c
+++ b/operations/common/noise-simplex.c
@@ -227,32 +227,39 @@ c_process (GeglOperation *operation,
const GeglRectangle *roi,
gint level)
{
+ gint factor = 1 << level;
GeglProperties *o = GEGL_PROPERTIES (operation);
Context context;
- gfloat *pixel;
- gint s, t;
+ gfloat *pixel = out_buf;
- context.seed = o->seed;
-
- for (t = 0, pixel = out_buf ; t < roi->height ; t += 1)
- {
- for (s = 0 ; s < roi->width ; s += 1, pixel += 1)
- {
- gint i;
- gdouble c, d;
-
- /* Pile up noise octaves onto the output value. */
+ gint x = roi->x;
+ gint y = roi->y;
- for (i = 0, c = 1, d = o->scale / 50.0, *pixel = 0;
- i < o->iterations;
- c *= 2, d *= 2, i += 1)
- {
- *pixel += noise2 ((double) (s + roi->x) * d,
- (double) (t + roi->y) * d,
- &context) / c;
- }
- }
- }
+ context.seed = o->seed;
+
+ while (n_pixels --)
+ {
+ gint i;
+ gdouble c, d;
+
+ /* Pile up noise octaves onto the output value. */
+
+ for (i = 0, c = 1, d = o->scale / 50.0, *pixel = 0;
+ i < o->iterations;
+ c *= 2, d *= 2, i += 1)
+ {
+ *pixel += noise2 ((double) (x) * d * factor, (double) (y) * d * factor, &context) / c;
+ }
+
+ pixel += 1;
+
+ x++;
+ if (x>=roi->x + roi->width)
+ {
+ x=roi->x;
+ y++;
+ }
+ }
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]