[gegl] gegl/buffer: use a temporary buffer when column fetching
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl/buffer: use a temporary buffer when column fetching
- Date: Wed, 27 Dec 2017 13:37:12 +0000 (UTC)
commit dda39cc0bd0e9a92cb89323c888315f1fab13a65
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Dec 27 11:34:05 2017 +0100
gegl/buffer: use a temporary buffer when column fetching
gegl/buffer/gegl-buffer-access.c | 35 ++++++++++++++++++++++++++++-------
1 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index fb131b8..5475a9f 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1421,13 +1421,34 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
if (GEGL_FLOAT_EQUAL (scale, 1.0) &&
rect &&
- rect->width == 1 &&
- rect->height == 1)
- {
- gegl_buffer_get_pixel (buffer, rect->x, rect->y, format, dest_buf,
- repeat_mode);
- return;
- }
+ rect->width == 1)
+ {
+ if (rect->height == 1)
+ {
+ gegl_buffer_get_pixel (buffer, rect->x, rect->y, format, dest_buf,
+ repeat_mode);
+ return;
+ }
+ else
+ {
+ if (buffer->format == format)
+ {
+ gegl_buffer_iterate_read_dispatch (buffer, rect, dest_buf,
+ rowstride, format, 0, repeat_mode);
+ }
+ else
+ {
+ /* first fetch all pixels to a temporary buffer */
+ uint8_t tmp[rect->width * rect->height * 32];
+ gegl_buffer_iterate_read_dispatch (buffer, rect, &tmp[0],
+ rowstride, buffer->format, 0, repeat_mode);
+ /* then convert in a single shot */
+ babl_process (babl_fish (buffer->format, format),
+ &tmp[0], dest_buf, rect->height);
+ }
+ return;
+ }
+ }
if (!rect && GEGL_FLOAT_EQUAL (scale, 1.0))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]