summaryrefslogtreecommitdiff
path: root/core/fxge/dib/cfx_dibitmap.cpp
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/fxge/dib/cfx_dibitmap.cpp
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/fxge/dib/cfx_dibitmap.cpp')
-rw-r--r--core/fxge/dib/cfx_dibitmap.cpp27
1 files changed, 14 insertions, 13 deletions
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<uint8_t>(src_alpha);