From b34c4d8c337aba6d7d44dfd58087ebd6e2d143e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 9 Oct 2014 21:08:16 +0200 Subject: Add support for lcms2 --- ksvg/impl/SVGColorProfileElementImpl.cc | 12 ++++++------ ksvg/impl/SVGColorProfileElementImpl.h | 11 ++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'ksvg/impl') diff --git a/ksvg/impl/SVGColorProfileElementImpl.cc b/ksvg/impl/SVGColorProfileElementImpl.cc index 0aa91e52..f59e7c23 100644 --- a/ksvg/impl/SVGColorProfileElementImpl.cc +++ b/ksvg/impl/SVGColorProfileElementImpl.cc @@ -205,13 +205,13 @@ bool SVGColorProfileElementImpl::loadColorProfile() m_hInput = cmsOpenProfileFromFile(open.latin1(), "r"); m_hOutput = cmsCreate_sRGBProfile(); - unsigned int dwIn = BYTES_SH(2) | CHANNELS_SH(_cmsChannelsOf(m_inputColorSpace)); - unsigned int dwOut = BYTES_SH(2) | CHANNELS_SH(_cmsChannelsOf(m_outputColorSpace)); + unsigned int dwIn = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_inputColorSpace)); + unsigned int dwOut = BYTES_SH(2) | CHANNELS_SH(cmsChannelsOf(m_outputColorSpace)); if(m_renderingIntent != RENDERING_INTENT_AUTO) - m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, m_renderingIntent - 2, cmsFLAGS_NOTPRECALC); + m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, m_renderingIntent - 2, cmsFLAGS_NOOPTIMIZE); else - m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, cmsTakeRenderingIntent(m_hInput), cmsFLAGS_NOTPRECALC); + m_hTrans = cmsCreateTransform(m_hInput, dwIn, m_hOutput, dwOut, cmsGetHeaderRenderingIntent(m_hInput), cmsFLAGS_NOOPTIMIZE); m_inputColorSpace = cmsGetColorSpace(m_hInput); m_outputColorSpace = cmsGetColorSpace(m_hOutput); @@ -237,7 +237,7 @@ TQRgb SVGColorProfileElementImpl::correctPixel(float r, float g, float b) return tqRgb(0, 0, 0); } - unsigned short input[MAXCHANNELS], output[MAXCHANNELS]; + unsigned short input[cmsMAXCHANNELS], output[cmsMAXCHANNELS]; input[0] = ((unsigned int) r) * 257; input[1] = ((unsigned int) g) * 257; @@ -245,7 +245,7 @@ TQRgb SVGColorProfileElementImpl::correctPixel(float r, float g, float b) cmsDoTransform(m_hTrans, input, output, 1); - if(m_outputColorSpace == icSigRgbData) + if(m_outputColorSpace == cmsSigRgbData) return tqRgb(output[0] / 257, output[1] / 257, output[2] / 257); return tqRgb(0, 0, 0); diff --git a/ksvg/impl/SVGColorProfileElementImpl.h b/ksvg/impl/SVGColorProfileElementImpl.h index db4f322e..7c4f884f 100644 --- a/ksvg/impl/SVGColorProfileElementImpl.h +++ b/ksvg/impl/SVGColorProfileElementImpl.h @@ -28,6 +28,15 @@ #undef QT_VERSION // Needed for 1.08 *grml* #include LCMS_HEADER +#if LCMS_VERSION < 2000 +#define cmsColorSpaceSignature icColorSpaceSignature +#define cmsChannelsOf _cmsChannelsOf +#define cmsFLAGS_NOOPTIMIZE cmsFLAGS_NOTPRECALC +#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent +#define cmsMAXCHANNELS MAXCHANNELS +#define cmsSigRgbData icSigRgbData +#endif + #include "SVGElementImpl.h" #include "SVGURIReferenceImpl.h" @@ -74,7 +83,7 @@ private: cmsHTRANSFORM m_hTrans; int m_intent; - icColorSpaceSignature m_inputColorSpace, m_outputColorSpace; + cmsColorSpaceSignature m_inputColorSpace, m_outputColorSpace; public: KSVG_GET -- cgit v1.2.1