[babl] extensions: simplify gggl/conv_rgbF_rgbaF slightly



commit bfbfa4a678bb3f8fd6c816c693acda0f221f7756
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Apr 5 00:39:23 2018 +0200

    extensions: simplify gggl/conv_rgbF_rgbaF slightly

 extensions/gggl.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/extensions/gggl.c b/extensions/gggl.c
index 8195ba1..200caa3 100644
--- a/extensions/gggl.c
+++ b/extensions/gggl.c
@@ -411,20 +411,15 @@ static void
 conv_rgbF_rgbaF (const Babl *conversion,unsigned char *src, unsigned char *dst, long samples)
 {
   long n = samples;
+  float *fsrc = (void*) src;
+  float *fdst = (void*) dst;
 
   while (n--)
     {
-      *(uint32_t *) dst = (*(uint32_t *) src);
-      src           += 4;
-      dst           += 4;
-      *(uint32_t *) dst = (*(uint32_t *) src);
-      src           += 4;
-      dst           += 4;
-      *(uint32_t *) dst = (*(uint32_t *) src);
-      src           += 4;
-      dst           += 4;
-      *(float *) dst = 1.0;
-      dst           += 4;
+      *fdst++ = *fsrc++;
+      *fdst++ = *fsrc++; 
+      *fdst++ = *fsrc++;
+      *fdst++ = 1.0f;
     }
 }
 


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