[gegl] buffer: remove one conditional in 1x1px get



commit ca04c873195df0ad83da460d525d48e831b87121
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Jun 20 06:21:38 2014 +0200

    buffer: remove one conditional in 1x1px get

 gegl/buffer/gegl-buffer-access.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 570366d..c2cf098 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -122,17 +122,7 @@ gegl_buffer_get_pixel (GeglBuffer     *buffer,
 
     GeglTile *tile = buffer->tile_storage->hot_tile;
     const Babl *fish = NULL;
-    gint px_size;
 
-    if (format != buffer->soft_format)
-      {
-        fish    = babl_fish (buffer->soft_format, format);
-        px_size = babl_format_get_bytes_per_pixel (buffer->soft_format);
-      }
-    else
-      {
-        px_size = babl_format_get_bytes_per_pixel (format);
-      }
 
     if (!(tile &&
           tile->x == indice_x &&
@@ -151,13 +141,21 @@ gegl_buffer_get_pixel (GeglBuffer     *buffer,
         gint tile_origin_y = indice_y * tile_height;
         gint       offsetx = tiledx - tile_origin_x;
         gint       offsety = tiledy - tile_origin_y;
+        guchar    *tp;
 
-        guchar *tp         = gegl_tile_get_data (tile) + (offsety * tile_width + offsetx) * px_size;
-
-        if (fish)
-          babl_process (fish, tp, buf, 1);
+        if (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);
+          }
         else
-          memcpy (buf, tp, px_size);
+          {
+            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);
+          }
       }
   }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]