[gegl] buffer: improve data extent computation in gegl_buffer_set_pattern()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: improve data extent computation in gegl_buffer_set_pattern()
- Date: Wed, 14 Mar 2018 09:57:49 +0000 (UTC)
commit aea6acfb4e0c2e80a60dda1bba20cd461cc13b5b
Author: Ell <ell_se yahoo com>
Date: Wed Mar 14 05:47:57 2018 -0400
buffer: improve data extent computation in gegl_buffer_set_pattern()
In gegl_buffer_set_pattern(), calculate the width/height of
extended_data_extent directly, instead of using loops, and make
sure they're not greater than the ROI width/height, respectively.
gegl/buffer/gegl-buffer-access.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index a225ba7..52fc23c 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -2672,13 +2672,15 @@ gegl_buffer_set_pattern (GeglBuffer *buffer,
extended_data_extent = pattern_data_extent;
/* Avoid gegl_buffer_set on too small chunks */
- while (extended_data_extent.width < buffer->tile_width * 2 &&
- extended_data_extent.width < roi.width)
- extended_data_extent.width += pattern_extent->width;
-
- while (extended_data_extent.height < buffer->tile_height * 2 &&
- extended_data_extent.height < roi.height)
- extended_data_extent.height += pattern_extent->height;
+ extended_data_extent.width *= (buffer->tile_width * 2 +
+ (extended_data_extent.width - 1)) /
+ extended_data_extent.width;
+ extended_data_extent.width = MIN (extended_data_extent.width, roi.width);
+
+ extended_data_extent.height *= (buffer->tile_height * 2 +
+ (extended_data_extent.height - 1)) /
+ extended_data_extent.height;
+ extended_data_extent.height = MIN (extended_data_extent.height, roi.height);
/* XXX: Bad taste, the pattern needs to be small enough.
* See Bug 712814 for an alternative malloc-free implementation */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]