summaryrefslogtreecommitdiffstats
path: root/chalk
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2017-06-01 08:53:08 +0200
committerSlávek Banko <slavek.banko@axis.cz>2017-06-01 08:53:21 +0200
commit57a8a8d0de1dedca8caafaf24b1a4f11aec023e2 (patch)
tree1892e449e5229aba96b13a7b5d5acda44c40860c /chalk
parent540a8da1460e44cfd6ce73cfe9d8c4d76392d6ab (diff)
downloadkoffice-57a8a8d0de1dedca8caafaf24b1a4f11aec023e2.tar.gz
koffice-57a8a8d0de1dedca8caafaf24b1a4f11aec023e2.zip
Fix FTBFS on redefinitions in chalk/sdk/kis_integer_maths.h
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit cbc1062ce2a32d52e55445d303b1adb4078f87ec)
Diffstat (limited to 'chalk')
-rw-r--r--chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc4
-rw-r--r--chalk/colorspaces/gray_u8/kis_gray_colorspace.cc4
-rw-r--r--chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc4
-rw-r--r--chalk/sdk/kis_integer_maths.h21
4 files changed, 27 insertions, 6 deletions
diff --git a/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
index b24c48b3..43bdf40f 100644
--- a/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
+++ b/chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
@@ -404,8 +404,8 @@ void KisGrayU16ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowS
TQ_UINT16 srcColor = src[channel];
TQ_UINT16 dstColor = dst[channel];
- srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
- srcColor = kClamp(UINT16_MAX - srcColor, 0u, UINT16_MAX);
+ srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), (unsigned)UINT16_MAX);
+ srcColor = kClamp((unsigned)UINT16_MAX - srcColor, 0u, (unsigned)UINT16_MAX);
TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
diff --git a/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc b/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
index 7968e311..989cc2c5 100644
--- a/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
+++ b/chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
@@ -746,8 +746,8 @@ void KisGrayColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowStri
TQ_UINT8 srcColor = src[channel];
TQ_UINT8 dstColor = dst[channel];
- srcColor = kMin(((UINT8_MAX - dstColor) * (UINT8_MAX + 1)) / (srcColor + 1), UINT8_MAX);
- srcColor = kClamp(UINT8_MAX - srcColor, 0u, UINT8_MAX);
+ srcColor = kMin(((UINT8_MAX - dstColor) * (UINT8_MAX + 1u)) / (srcColor + 1u), (unsigned)UINT8_MAX);
+ srcColor = kClamp((unsigned)UINT8_MAX - srcColor, 0u, (unsigned)UINT8_MAX);
TQ_UINT8 newColor = UINT8_BLEND(srcColor, dstColor, srcBlend);
diff --git a/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
index 75aa6649..40198c91 100644
--- a/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
+++ b/chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
@@ -444,8 +444,8 @@ void KisRgbU16ColorSpace::compositeBurn(TQ_UINT8 *dstRowStart, TQ_INT32 dstRowSt
TQ_UINT16 srcColor = src[channel];
TQ_UINT16 dstColor = dst[channel];
- srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), UINT16_MAX);
- srcColor = kClamp(UINT16_MAX - srcColor, 0u, UINT16_MAX);
+ srcColor = kMin(((UINT16_MAX - dstColor) * (UINT16_MAX + 1u)) / (srcColor + 1u), (unsigned)UINT16_MAX);
+ srcColor = kClamp((unsigned)UINT16_MAX - srcColor, 0u, (unsigned)UINT16_MAX);
TQ_UINT16 newColor = UINT16_BLEND(srcColor, dstColor, srcBlend);
diff --git a/chalk/sdk/kis_integer_maths.h b/chalk/sdk/kis_integer_maths.h
index c8db9aee..bd52c343 100644
--- a/chalk/sdk/kis_integer_maths.h
+++ b/chalk/sdk/kis_integer_maths.h
@@ -19,17 +19,38 @@
#ifndef KIS_INTEGER_MATHS_H
#define KIS_INTEGER_MATHS_H
+#include <config.h>
+#if defined(HAVE_STDINT_H)
+#include <stdint.h>
+#endif
+
+#if !defined(UINT8_MAX)
#define UINT8_MAX 255u
+#endif
+#if !defined(UINT8_MIN)
#define UINT8_MIN 0u
+#endif
+#if !defined(UINT16_MAX)
#define UINT16_MAX 65535u
+#endif
+#if !defined(UINT16_MIN)
#define UINT16_MIN 0u
+#endif
+#if !defined(UINT32_MAX)
#define UINT32_MAX (4294967295u)
+#endif
+#if !defined(UINT32_MIN)
#define UINT32_MIN 0u
+#endif
+#if !defined(INT16_MAX)
#define INT16_MAX 32767
+#endif
+#if !defined(INT16_MIN)
#define INT16_MIN -32768
+#endif
/// take a and scale it up by 256*b/255
inline uint UINT8_SCALEBY(uint a, uint b)