summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-07-12 14:45:08 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-12 18:58:24 +0000
commitd79ac21b7595442bce82ec93f59cda9f8fb3cb24 (patch)
tree2c479141e360094a21cad7a1566a0c1a04e8a9c9 /core/fpdfapi
parent58bf3de718e510648ee136c887be5b2d577644a7 (diff)
downloadpdfium-d79ac21b7595442bce82ec93f59cda9f8fb3cb24.tar.xz
Move CMYKtoRGB methods to fx_codec and clean them up
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 <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_devicecs.cpp13
2 files changed, 8 insertions, 7 deletions
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;