[gegl] buffer: fix gegl_buffer_get_pixel with format==NULL
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: fix gegl_buffer_get_pixel with format==NULL
- Date: Thu, 18 Jan 2018 13:14:31 +0000 (UTC)
commit 9c35450634c1e16c150924ac2058e13afa7aa0e0
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Jan 18 14:11:44 2018 +0100
buffer: fix gegl_buffer_get_pixel with format==NULL
fixing bug #792631
gegl/buffer/gegl-buffer-access.c | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index c26f5e9..a60919f 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -69,8 +69,6 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
const GeglRectangle *abyss = &buffer->abyss;
guchar *buf = data;
-
-
if (y < abyss->y ||
x < abyss->x ||
y >= abyss->y + abyss->height ||
@@ -116,7 +114,6 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
}
}
-
{
gint tile_width = buffer->tile_width;
gint tile_height = buffer->tile_height;
@@ -126,7 +123,6 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
gint indice_y = gegl_tile_indice (tiledy, tile_height);
GeglTile *tile = buffer->tile_storage->hot_tile;
- const Babl *fish = NULL;
if (!(tile &&
tile->x == indice_x &&
@@ -145,31 +141,25 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
g_rec_mutex_unlock (&buffer->tile_storage->mutex);
}
-
if (tile)
{
gint tile_origin_x = indice_x * tile_width;
gint tile_origin_y = indice_y * tile_height;
gint offsetx = tiledx - tile_origin_x;
gint offsety = tiledy - tile_origin_y;
- guchar *tp;
+ gint px_size = babl_format_get_bytes_per_pixel (buffer->soft_format);
+ guchar *tp = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) * px_size;
- if (format != buffer->soft_format)
+ if (format && format != buffer->soft_format)
{
- gint px_size = babl_format_get_bytes_per_pixel (buffer->soft_format);
- fish = babl_fish (buffer->soft_format, format);
- tp = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) * px_size;
- babl_process (fish, tp, buf, 1);
+ babl_process (babl_fish (buffer->soft_format, format), tp, buf, 1);
}
else
{
- gint px_size = babl_format_get_bytes_per_pixel (format);
- tp = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) * px_size;
memcpy (buf, tp, px_size);
}
}
}
-
}
static inline void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]