make all uses of gegl_buffer_set refer to 0 level

The ones are there for the API symmetry with gegl_buffer_get's scale,
using discrete levels is probably better than the scale equivalent in
all cases.
parent b975b23d
......@@ -481,7 +481,7 @@ gegl_buffer_set_internal (GeglBuffer *buffer,
gegl_buffer_cl_cache_flush (buffer, rect);
}
gegl_buffer_iterate_write (buffer, rect, (void *) src, rowstride, format, 0);
gegl_buffer_iterate_write (buffer, rect, (void *) src, rowstride, format, level);
if (gegl_buffer_is_shared (buffer))
{
......@@ -1389,7 +1389,7 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
gegl_buffer_cl_cache_flush (buffer, rect);
}
if (!rect && scale == 1.0)
if (!rect && GEGL_FLOAT_EQUAL (scale, 1.0))
{
gegl_buffer_iterate_read_dispatch (buffer, &buffer->extent, dest_buf,
rowstride, format, 0, repeat_mode);
......@@ -1978,7 +1978,7 @@ gegl_buffer_set_pattern (GeglBuffer *buffer,
gegl_rectangle_intersect (&dest_rect, &dest_rect, &roi);
gegl_buffer_set (buffer, &dest_rect, 1, buffer_format,
gegl_buffer_set (buffer, &dest_rect, 0, buffer_format,
pattern_data, rowstride);
}
......
......@@ -235,7 +235,7 @@ process (GeglOperation *operation,
#undef USE_IF_ALPHA
/* write result row to dest */
gegl_buffer_set (output, &rowrect, 1, format, &dest[0], GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (output, &rowrect, 0, format, &dest[0], GEGL_AUTO_ROWSTRIDE);
/* rotate pointers */
tmp = rowbefore;
......
......@@ -257,7 +257,7 @@ process (GeglOperation *operation,
}
}
gegl_buffer_set (output, result, 1.0, gegl_buffer_get_format (output), dst_buf,
gegl_buffer_set (output, result, 0, gegl_buffer_get_format (output), dst_buf,
GEGL_AUTO_ROWSTRIDE);
gegl_free (dst_buf);
......
......@@ -2426,7 +2426,7 @@ process (GeglOperation *operation,
offset += (result->x - working_region.x);
offset *= 4;
gegl_buffer_set (output, result, 1.0, babl_format ("R'G'B'A float"),
gegl_buffer_set (output, result, 0, babl_format ("R'G'B'A float"),
res + offset, rowstride);
g_free (res);
......
......@@ -270,7 +270,7 @@ process (GeglOperation *operation,
}
}
gegl_buffer_set (output, roi, 1.0, babl_format ("RaGaBaA float"),
gegl_buffer_set (output, roi, 0, babl_format ("RaGaBaA float"),
out_buf, GEGL_AUTO_ROWSTRIDE);
g_free (in_buf);
......
......@@ -215,7 +215,7 @@ process (GeglOperation *operation,
}
}
gegl_buffer_set (output, roi, 1.0, babl_format ("RaGaBaA float"),
gegl_buffer_set (output, roi, 0, babl_format ("RaGaBaA float"),
out_buf, GEGL_AUTO_ROWSTRIDE);
g_free (in_buf);
......
......@@ -615,7 +615,7 @@ process (GeglOperation *operation,
pixelize (input_buf, output_buf, &chunked_result, &src_rect,
whole_region, o);
gegl_buffer_set (output, &chunked_result, 1.0,
gegl_buffer_set (output, &chunked_result, 0,
babl_format ("RaGaBaA float"),
output_buf, GEGL_AUTO_ROWSTRIDE);
}
......
......@@ -75,7 +75,7 @@ read_webp (const gchar *path, GeglBuffer *buf, GeglRectangle *bounds_out, const
return FALSE;
}
gegl_buffer_set (buf, &bounds, 1, format, config.output.u.RGBA.rgba,
gegl_buffer_set (buf, &bounds, 0, format, config.output.u.RGBA.rgba,
config.output.u.RGBA.stride);
WebPFreeDecBuffer (&config.output);
......
......@@ -36,7 +36,7 @@ TEST ()
print (("%d,%d %dx%d\n", cur_query_rect.x, cur_query_rect.y, cur_query_rect.width, cur_query_rect.height));
gegl_buffer_get (buffer, &cur_query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_type);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
......@@ -36,7 +36,7 @@ TEST ()
print (("%d,%d %dx%d\n", cur_query_rect.x, cur_query_rect.y, cur_query_rect.width, cur_query_rect.height));
gegl_buffer_get (buffer, &cur_query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_type);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
......@@ -26,7 +26,7 @@ TEST ()
print (("%s\n", abyss_names[i]));
gegl_buffer_get (buffer, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_types[i]);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
......@@ -36,7 +36,7 @@ TEST ()
print (("%d,%d %dx%d\n", cur_query_rect.x, cur_query_rect.y, cur_query_rect.width, cur_query_rect.height));
gegl_buffer_get (buffer, &cur_query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_type);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
......@@ -36,7 +36,7 @@ TEST ()
print (("%d,%d %dx%d\n", cur_query_rect.x, cur_query_rect.y, cur_query_rect.width, cur_query_rect.height));
gegl_buffer_get (buffer, &cur_query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_type);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
......@@ -36,7 +36,7 @@ TEST ()
print (("%d,%d %dx%d\n", cur_query_rect.x, cur_query_rect.y, cur_query_rect.width, cur_query_rect.height));
gegl_buffer_get (buffer, &cur_query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, abyss_type);
gegl_buffer_set (buffer2, &query_rect, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (buffer2, &query_rect, 0, format, buf, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
}
......
TEST ()
{
GeglBuffer *buffer, *buffer2;
GeglRectangle bound = {0, 0, 20, 20};
GeglRectangle source = {2, 2, 5, 5};
GeglRectangle dest = {10, 10, 5, 5};
const gchar *blank = g_malloc0 (100000);
test_start ();
buffer = gegl_buffer_new (&bound, babl_format ("Y float"));
buffer2 = gegl_buffer_new (&bound, babl_format ("Y float"));
vgrad (buffer2);
gegl_buffer_set (buffer2, &dest, 0, babl_format ("Y float"), blank, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
vgrad (buffer2);
gegl_buffer_set (buffer2, &dest, 1, babl_format ("Y float"), blank, GEGL_AUTO_ROWSTRIDE);
print_buffer (buffer2);
g_object_unref (buffer);
g_object_unref (buffer2);
test_end ();
/* test writing to only higher mipmap levels,. what happens to reads there
* and above?
*
* below - perhaps synthesising these - bypassing cache would not be
* half-bad? if the result is not for a 1:1 render?
*
*/
}
......@@ -84,7 +84,7 @@ test_buffer_change_signal_on_set(void)
gegl_buffer_signal_connect(test_case->buffer, "changed", (GCallback)handle_buffer_changed, test_case);
gegl_buffer_set(test_case->buffer, &rect, 1, test_case->buffer_format, tmp, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set(test_case->buffer, &rect, 0, test_case->buffer_format, tmp, GEGL_AUTO_ROWSTRIDE);
g_assert_cmpint(test_case->buffer_changed_called, ==, 1);
g_assert(test_gegl_rectangle_equal(&(test_case->buffer_changed_rect), &rect));
......
......@@ -160,9 +160,9 @@ test_comparison (const gfloat *reference,
src_ref_buffer = gegl_buffer_new (&extent, input_format);
src_aux_buffer = gegl_buffer_new (&extent, input_format);
gegl_buffer_set (src_ref_buffer, &extent, 1, input_format,
gegl_buffer_set (src_ref_buffer, &extent, 0, input_format,
reference, GEGL_AUTO_ROWSTRIDE);
gegl_buffer_set (src_aux_buffer, &extent, 1, input_format,
gegl_buffer_set (src_aux_buffer, &extent, 0, input_format,
test_case, GEGL_AUTO_ROWSTRIDE);
/* Build the test graph */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment