summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_dibsource.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-03-15 13:26:37 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-15 21:10:29 +0000
commita12159b17085796e2b72d2b49e850092e0b4e8b7 (patch)
treedf7a5d149c9bbfe5c2d2ec16631c3dcb6ae9a901 /core/fpdfapi/render/cpdf_dibsource.cpp
parent59d9416553b293f6df923c2f3ef33def2d51d7b7 (diff)
downloadpdfium-a12159b17085796e2b72d2b49e850092e0b4e8b7.tar.xz
Refactor some CPDF_ColorSpace code.
Change-Id: I1e30d68dae3bf70cf3c426f6126d593b7f1c3ba4 Reviewed-on: https://pdfium-review.googlesource.com/2991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_dibsource.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 403866300d..341327b5e9 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -457,7 +457,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode,
float def_value;
float def_min;
float def_max;
- m_pColorSpace->GetDefaultValue(i, def_value, def_min, def_max);
+ m_pColorSpace->GetDefaultValue(i, &def_value, &def_min, &def_max);
if (m_Family == PDFCS_INDEXED) {
def_max = max_data;
}
@@ -468,8 +468,8 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool& bDefaultDecode,
} else {
for (uint32_t i = 0; i < m_nComponents; i++) {
float def_value;
- m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMin,
- pCompData[i].m_DecodeStep);
+ m_pColorSpace->GetDefaultValue(i, &def_value, &pCompData[i].m_DecodeMin,
+ &pCompData[i].m_DecodeStep);
if (m_Family == PDFCS_INDEXED) {
pCompData[i].m_DecodeStep = max_data;
}
@@ -701,10 +701,10 @@ int CPDF_DIBSource::StratLoadMask() {
m_pColorSpace->CountComponents() <= m_nComponents) {
float R, G, B;
std::vector<float> colors(m_nComponents);
- for (uint32_t i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++)
colors[i] = pMatte->GetFloatAt(i);
- }
- m_pColorSpace->GetRGB(colors.data(), R, G, B);
+
+ m_pColorSpace->GetRGB(colors.data(), &R, &G, &B);
m_MatteColor = FXARGB_MAKE(0, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
}
@@ -779,13 +779,13 @@ void CPDF_DIBSource::LoadPalette() {
color_values[0] = m_pCompData[0].m_DecodeMin;
color_values[1] = color_values[2] = color_values[0];
float R = 0.0f, G = 0.0f, B = 0.0f;
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
FX_ARGB argb0 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
color_values[0] += m_pCompData[0].m_DecodeStep;
color_values[1] += m_pCompData[0].m_DecodeStep;
color_values[2] += m_pCompData[0].m_DecodeStep;
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
FX_ARGB argb1 = ArgbEncode(255, FXSYS_round(R * 255), FXSYS_round(G * 255),
FXSYS_round(B * 255));
if (argb0 != 0xFF000000 || argb1 != 0xFFFFFFFF) {
@@ -816,9 +816,9 @@ void CPDF_DIBSource::LoadPalette() {
for (int k = 0; k < nComponents; k++) {
temp_buf[k] = *color_value;
}
- m_pColorSpace->GetRGB(temp_buf.data(), R, G, B);
+ m_pColorSpace->GetRGB(temp_buf.data(), &R, &G, &B);
} else {
- m_pColorSpace->GetRGB(color_value, R, G, B);
+ m_pColorSpace->GetRGB(color_value, &R, &G, &B);
}
SetPaletteArgb(i, ArgbEncode(255, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -935,7 +935,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
G = (1.0f - color_values[1]) * k;
B = (1.0f - color_values[2]) * k;
} else {
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
}
R = ClampValue(R, 1.0f);
G = ClampValue(G, 1.0f);
@@ -961,7 +961,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
G = (1.0f - color_values[1]) * k;
B = (1.0f - color_values[2]) * k;
} else {
- m_pColorSpace->GetRGB(color_values, R, G, B);
+ m_pColorSpace->GetRGB(color_values, &R, &G, &B);
}
R = ClampValue(R, 1.0f);
G = ClampValue(G, 1.0f);
@@ -1183,12 +1183,12 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
bool bFlipX,
int clip_left,
int clip_width) const {
- uint32_t set_argb = (uint32_t)-1;
+ uint32_t set_argb = 0xFFFFFFFF;
uint32_t reset_argb = 0;
if (m_bImageMask) {
if (m_bDefaultDecode) {
set_argb = 0;
- reset_argb = (uint32_t)-1;
+ reset_argb = 0xFFFFFFFF;
}
} else if (m_bColorKey) {
reset_argb = m_pPalette ? m_pPalette.get()[0] : 0xFF000000;