[gegl] gegl/buffer: move some conditionals out of hot-spot fast path for 1x1 fetch
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl/buffer: move some conditionals out of hot-spot fast path for 1x1 fetch
- Date: Tue, 9 Jan 2018 17:27:08 +0000 (UTC)
commit 571a6e8a5c976ab01dca3820fafc871eed015ad9
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Jan 8 23:36:02 2018 +0100
gegl/buffer: move some conditionals out of hot-spot fast path for 1x1 fetch
As well as making some related static functions inlineable.
gegl/buffer/gegl-buffer-access.c | 14 +++++++-------
gegl/buffer/gegl-tile.c | 8 ++++----
2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index ee362c7..5d1efb4 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -1868,17 +1868,12 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
gint rowstride,
GeglAbyssPolicy repeat_mode)
{
- g_return_if_fail (scale > 0.0);
-
- if (format == NULL)
- format = buffer->soft_format;
-
if (gegl_cl_is_accelerated ())
{
gegl_buffer_cl_cache_flush (buffer, rect);
}
- if (GEGL_FLOAT_EQUAL (scale, 1.0) &&
+ if (scale == 1.0 &&
rect &&
rect->width == 1)
{
@@ -1891,7 +1886,7 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
else
{
gint bpp = babl_format_get_bytes_per_pixel (buffer->soft_format);
- if (buffer->soft_format == format || rowstride != bpp)
+ if (!format || buffer->soft_format == format || rowstride != bpp)
{
gegl_buffer_iterate_read_dispatch (buffer, rect, dest_buf,
rowstride, format, 0, repeat_mode);
@@ -1910,6 +1905,11 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
}
}
+ if (format == NULL)
+ format = buffer->soft_format;
+
+ g_return_if_fail (scale > 0.0);
+
if (!rect && GEGL_FLOAT_EQUAL (scale, 1.0))
{
gegl_buffer_iterate_read_dispatch (buffer, &buffer->extent, dest_buf,
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index eef7c16..15b4139 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -101,7 +101,7 @@ void gegl_tile_unref (GeglTile *tile)
g_slice_free (GeglTile, tile);
}
-static GeglTile *
+static inline GeglTile *
gegl_tile_new_bare_internal (void)
{
GeglTile *tile = g_slice_new0 (GeglTile);
@@ -173,7 +173,7 @@ gegl_tile_new (gint size)
return tile;
}
-static void
+static inline void
gegl_tile_unclone (GeglTile *tile)
{
if (*gegl_tile_n_clones (tile) > 1)
@@ -277,7 +277,7 @@ gegl_tile_lock (GeglTile *tile)
}
}
-static void
+static inline void
_gegl_tile_void_pyramid (GeglTileSource *source,
gint x,
gint y,
@@ -289,7 +289,7 @@ _gegl_tile_void_pyramid (GeglTileSource *source,
_gegl_tile_void_pyramid (source, x/2, y/2, z+1);
}
-static void
+static inline void
gegl_tile_void_pyramid (GeglTile *tile)
{
if (tile->tile_storage &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]