[gegl] noise-cell: render lower mipmap levels correctly
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] noise-cell: render lower mipmap levels correctly
- Date: Fri, 4 Jul 2014 17:53:48 +0000 (UTC)
commit f4ad1420a48b8f77a0a44022e791e1d08a42024d
Author: Øyvind Kolås <pippin gimp org>
Date: Fri Jul 4 19:38:23 2014 +0200
noise-cell: render lower mipmap levels correctly
operations/common/noise-cell.c | 51 +++++++++++++++++++++++----------------
1 files changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/operations/common/noise-cell.c b/operations/common/noise-cell.c
index ade350a..c79a17d 100644
--- a/operations/common/noise-cell.c
+++ b/operations/common/noise-cell.c
@@ -323,38 +323,47 @@ 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;
+ Context context;
+ gfloat *pixel = out_buf;
+
+ gint x = roi->x;
+ gint y = roi->y;
context.seed = o->seed;
context.rank = o->rank;
context.shape = o->shape;
context.palettize = o->palettize;
+
+ while (n_pixels --)
+ {
+ gint i;
+ gdouble c, d;
- 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. */
-
- 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;
- }
- }
+ /* 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;
+ return TRUE;
}
+
static gboolean
process (GeglOperation *operation,
GeglBuffer *out_buf,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]