]> granicus.if.org Git - imagemagick/commitdiff
Fixed incorrect rounding when HDRI is enabled.
authorDirk Lemstra <dirk@git.imagemagick.org>
Mon, 26 Feb 2018 22:04:33 +0000 (23:04 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Mon, 26 Feb 2018 22:04:33 +0000 (23:04 +0100)
MagickCore/accelerate-kernels-private.h

index 4b5d942f315e55aadf2649301a85c632f98cbb96..6b209550bb518b942359db27e19296f332dc4a8c 100644 (file)
@@ -303,13 +303,17 @@ OPENCL_ELIF((MAGICKCORE_QUANTUM_DEPTH == 32))
 
 OPENCL_ENDIF()
 
+OPENCL_IF((MAGICKCORE_HDRI_SUPPORT == 1))
+
   STRINGIFY(
-    inline int ClampToCanvas(const int offset,const int range)
+    inline CLQuantum ClampToQuantum(const float value)
       {
-        return clamp(offset, (int)0, range-1);
+        return (CLQuantum) value;
       }
   )
 
+OPENCL_ELSE()
+
   STRINGIFY(
     inline CLQuantum ClampToQuantum(const float value)
       {
@@ -317,6 +321,15 @@ OPENCL_ENDIF()
       }
   )
 
+OPENCL_ENDIF()
+
+  STRINGIFY(
+    inline int ClampToCanvas(const int offset,const int range)
+      {
+        return clamp(offset, (int)0, range-1);
+      }
+  )
+
   STRINGIFY(
     inline uint ScaleQuantumToMap(CLQuantum value)
       {