From d79ac21b7595442bce82ec93f59cda9f8fb3cb24 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Wed, 12 Jul 2017 14:45:08 -0400 Subject: Move CMYKtoRGB methods to fx_codec and clean them up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL moves CMYKtoRGB methods to fx_codec. It also cleans them up a bit, including allowing them to return tuples instead of having non-const refs in their parameters. Change-Id: Ib3ec45102ec7eff623cd07a624e852d39bf335e4 Reviewed-on: https://pdfium-review.googlesource.com/7591 Commit-Queue: Nicolás Peña Reviewed-by: dsinclair --- core/fpdfapi/page/cpdf_colorspace.cpp | 2 +- core/fpdfapi/page/cpdf_devicecs.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'core/fpdfapi/page') diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 90ef8944d3..520f9f4ded 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -513,7 +513,7 @@ bool CPDF_ColorSpace::SetCMYK(float* pBuf, float R; float G; float B; - AdobeCMYK_to_sRGB(c, m, y, k, R, G, B); + std::tie(R, G, B) = AdobeCMYK_to_sRGB(c, m, y, k); return SetRGB(pBuf, R, G, B); } diff --git a/core/fpdfapi/page/cpdf_devicecs.cpp b/core/fpdfapi/page/cpdf_devicecs.cpp index d410b1fb4a..91dffb129c 100644 --- a/core/fpdfapi/page/cpdf_devicecs.cpp +++ b/core/fpdfapi/page/cpdf_devicecs.cpp @@ -95,9 +95,9 @@ bool CPDF_DeviceCS::GetRGB(float* pBuf, float* R, float* G, float* B) const { *G = 1.0f - std::min(1.0f, pBuf[1] + k); *B = 1.0f - std::min(1.0f, pBuf[2] + k); } else { - AdobeCMYK_to_sRGB(NormalizeChannel(pBuf[0]), NormalizeChannel(pBuf[1]), - NormalizeChannel(pBuf[2]), NormalizeChannel(pBuf[3]), - *R, *G, *B); + std::tie(*R, *G, *B) = AdobeCMYK_to_sRGB( + NormalizeChannel(pBuf[0]), NormalizeChannel(pBuf[1]), + NormalizeChannel(pBuf[2]), NormalizeChannel(pBuf[3])); } return true; default: @@ -151,7 +151,7 @@ bool CPDF_DeviceCS::v_SetCMYK(float* pBuf, case PDFCS_DEVICEGRAY: return false; case PDFCS_DEVICERGB: - AdobeCMYK_to_sRGB(c, m, y, k, pBuf[0], pBuf[1], pBuf[2]); + std::tie(pBuf[0], pBuf[1], pBuf[2]) = AdobeCMYK_to_sRGB(c, m, y, k); return true; case PDFCS_DEVICECMYK: pBuf[0] = c; @@ -200,8 +200,9 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, pDestBuf[1] = 255 - std::min(255, pSrcBuf[1] + k); pDestBuf[0] = 255 - std::min(255, pSrcBuf[2] + k); } else { - AdobeCMYK_to_sRGB1(pSrcBuf[0], pSrcBuf[1], pSrcBuf[2], pSrcBuf[3], - pDestBuf[2], pDestBuf[1], pDestBuf[0]); + std::tie(pDestBuf[2], pDestBuf[1], pDestBuf[0]) = + AdobeCMYK_to_sRGB1(pSrcBuf[0], pSrcBuf[1], pSrcBuf[2], + pSrcBuf[3]); } pSrcBuf += 4; pDestBuf += 3; -- cgit v1.2.3