Browse Source

Fix FTBFS on redefinitions in chalk/sdk/kis_integer_maths.h

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 2 years ago
parent
commit
cbc1062ce2
4 changed files with 27 additions and 6 deletions
  1. +2
    -2
      chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc
  2. +2
    -2
      chalk/colorspaces/gray_u8/kis_gray_colorspace.cc
  3. +2
    -2
      chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc
  4. +21
    -0
      chalk/sdk/kis_integer_maths.h

+ 2
- 2
chalk/colorspaces/gray_u16/kis_gray_u16_colorspace.cc View File

@@ -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);



+ 2
- 2
chalk/colorspaces/gray_u8/kis_gray_colorspace.cc View File

@@ -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);



+ 2
- 2
chalk/colorspaces/rgb_u16/kis_rgb_u16_colorspace.cc View File

@@ -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);



+ 21
- 0
chalk/sdk/kis_integer_maths.h View File

@@ -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)


Loading…
Cancel
Save