[arrayfire] 185/284: Using proper offsets for loadImageNative and saveImageNative

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 8873ed244abaabb3bedf8781a44f096d790fa4b5
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Sun Jan 10 02:45:28 2016 -0500

    Using proper offsets for loadImageNative and saveImageNative
---
 src/api/c/imageio2.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/api/c/imageio2.cpp b/src/api/c/imageio2.cpp
index adc4244..aed793e 100644
--- a/src/api/c/imageio2.cpp
+++ b/src/api/c/imageio2.cpp
@@ -61,9 +61,9 @@ static af_err readImage_t(af_array *rImage, const uchar* pSrcLine, const int nSr
                 } else {
                     // Non 8-bit types do not use ordering
                     // See Pixel Access Functions Chapter in FreeImage Doc
-                    pDst0[indx] = (T) *(src + (x * step + 0));
-                    pDst1[indx] = (T) *(src + (x * step + 1));
-                    pDst2[indx] = (T) *(src + (x * step + 2));
+                    pDst0[indx] = (T) *(src + (x * step + FI_RGBA_RED));
+                    pDst1[indx] = (T) *(src + (x * step + FI_RGBA_GREEN));
+                    pDst2[indx] = (T) *(src + (x * step + FI_RGBA_BLUE));
                 }
                 if (fi_color == 4) pDst3[indx] = (T) *(src + (x * step + FI_RGBA_ALPHA));
             }
@@ -239,15 +239,15 @@ static void save_t(T* pDstLine, const af_array in, const dim4 dims, uint nDstPit
                 *(pDstLine + x * step + FI_RGBA_RED) = (T) pSrc0[indx]; // r -> 0
             } else if(channels >=3) {
                 if((af_dtype) af::dtype_traits<T>::af_type == u8) {
-                    *(pDstLine + x * step + FI_RGBA_BLUE)  = (T) pSrc2[indx]; // b -> 0
+                    *(pDstLine + x * step + FI_RGBA_RED  ) = (T) pSrc0[indx]; // r -> 0
                     *(pDstLine + x * step + FI_RGBA_GREEN) = (T) pSrc1[indx]; // g -> 1
-                    *(pDstLine + x * step + FI_RGBA_RED)   = (T) pSrc0[indx]; // r -> 2
+                    *(pDstLine + x * step + FI_RGBA_BLUE ) = (T) pSrc2[indx]; // b -> 2
                 } else {
                     // Non 8-bit types do not use ordering
                     // See Pixel Access Functions Chapter in FreeImage Doc
-                    *(pDstLine + x * step + 0) = (T) pSrc0[indx]; // r -> 0
-                    *(pDstLine + x * step + 1) = (T) pSrc1[indx]; // g -> 1
-                    *(pDstLine + x * step + 2) = (T) pSrc2[indx]; // b -> 2
+                    *(pDstLine + x * step + FI_RGBA_RED  ) = (T) pSrc0[indx]; // r -> 0
+                    *(pDstLine + x * step + FI_RGBA_GREEN) = (T) pSrc1[indx]; // g -> 1
+                    *(pDstLine + x * step + FI_RGBA_BLUE ) = (T) pSrc2[indx]; // b -> 2
                 }
             }
             if(channels >= 4) *(pDstLine + x * step + FI_RGBA_ALPHA) = (T) pSrc3[indx]; // a

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list