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/fxge/dib/cfx_dibitmap.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'core/fxge/dib/cfx_dibitmap.cpp') diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 02c3543c85..fd6defece2 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -755,10 +755,11 @@ void CFX_DIBitmap::ConvertCMYKColorScale(uint32_t forecolor, uint8_t r; uint8_t g; uint8_t b; - AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette.get()[i]), - FXSYS_GetMValue(m_pPalette.get()[i]), - FXSYS_GetYValue(m_pPalette.get()[i]), - FXSYS_GetKValue(m_pPalette.get()[i]), r, g, b); + std::tie(r, g, b) = + AdobeCMYK_to_sRGB1(FXSYS_GetCValue(m_pPalette.get()[i]), + FXSYS_GetMValue(m_pPalette.get()[i]), + FXSYS_GetYValue(m_pPalette.get()[i]), + FXSYS_GetKValue(m_pPalette.get()[i])); int gray = 255 - FXRGB2GRAY(r, g, b); m_pPalette.get()[i] = CmykEncode(bc + (fc - bc) * gray / 255, bm + (fm - bm) * gray / 255, @@ -773,8 +774,8 @@ void CFX_DIBitmap::ConvertCMYKColorScale(uint32_t forecolor, uint8_t r; uint8_t g; uint8_t b; - AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], - r, g, b); + std::tie(r, g, b) = AdobeCMYK_to_sRGB1(scanline[0], scanline[1], + scanline[2], scanline[3]); *scanline++ = 0; *scanline++ = 0; *scanline++ = 0; @@ -789,8 +790,8 @@ void CFX_DIBitmap::ConvertCMYKColorScale(uint32_t forecolor, uint8_t r; uint8_t g; uint8_t b; - AdobeCMYK_to_sRGB1(scanline[0], scanline[1], scanline[2], scanline[3], r, - g, b); + std::tie(r, g, b) = AdobeCMYK_to_sRGB1(scanline[0], scanline[1], + scanline[2], scanline[3]); int gray = 255 - FXRGB2GRAY(r, g, b); *scanline++ = bc + (fc - bc) * gray / 255; *scanline++ = bm + (fm - bm) * gray / 255; @@ -1007,8 +1008,8 @@ bool CFX_DIBitmap::CompositeRect(int left, uint8_t r; uint8_t g; uint8_t b; - AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3], r, g, - b); + std::tie(r, g, b) = + AdobeCMYK_to_sRGB1(color_p[0], color_p[1], color_p[2], color_p[3]); gray = FXRGB2GRAY(r, g, b); } else { gray = (uint8_t)FXRGB2GRAY((int)color_p[2], color_p[1], color_p[0]); @@ -1074,9 +1075,9 @@ bool CFX_DIBitmap::CompositeRect(int left, if (m_bpp < 24 || (!(alpha_flag >> 8) && IsCmykImage())) return false; if (alpha_flag >> 8 && !IsCmykImage()) { - AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), - FXSYS_GetYValue(color), FXSYS_GetKValue(color), - color_p[2], color_p[1], color_p[0]); + std::tie(color_p[2], color_p[1], color_p[0]) = + AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), + FXSYS_GetYValue(color), FXSYS_GetKValue(color)); } if (!IsCmykImage()) color_p[3] = static_cast(src_alpha); -- cgit v1.2.3