summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_renderstatus.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_renderstatus.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_renderstatus.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 28c7166013..17576fc1f3 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -145,12 +145,14 @@ void DrawAxialShading(CFX_DIBitmap* pBitmap,
for (const auto& func : funcs) {
if (func) {
int nresults = 0;
- if (func->Call(&input, 1, pResults + offset, nresults))
+ if (func->Call(&input, 1, pResults + offset, &nresults))
offset += nresults;
}
}
- float R = 0.0f, G = 0.0f, B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pCS->GetRGB(pResults, &R, &G, &B);
rgb_array[i] =
FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -226,12 +228,14 @@ void DrawRadialShading(CFX_DIBitmap* pBitmap,
for (const auto& func : funcs) {
if (func) {
int nresults;
- if (func->Call(&input, 1, pResults + offset, nresults))
+ if (func->Call(&input, 1, pResults + offset, &nresults))
offset += nresults;
}
}
- float R = 0.0f, G = 0.0f, B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pCS->GetRGB(pResults, &R, &G, &B);
rgb_array[i] =
FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
@@ -355,7 +359,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
for (const auto& func : funcs) {
if (func) {
int nresults;
- if (func->Call(input, 2, pResults + offset, nresults))
+ if (func->Call(input, 2, pResults + offset, &nresults))
offset += nresults;
}
}
@@ -363,7 +367,7 @@ void DrawFuncShading(CFX_DIBitmap* pBitmap,
float R = 0.0f;
float G = 0.0f;
float B = 0.0f;
- pCS->GetRGB(pResults, R, G, B);
+ pCS->GetRGB(pResults, &R, &G, &B);
dib_buf[column] = FXARGB_TODIB(FXARGB_MAKE(
alpha, (int32_t)(R * 255), (int32_t)(G * 255), (int32_t)(B * 255)));
}
@@ -2041,8 +2045,10 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
CFX_FixedBufGrow<float, 16> comps(pColorSpace->CountComponents());
for (uint32_t i = 0; i < pColorSpace->CountComponents(); i++)
comps[i] = pBackColor->GetNumberAt(i);
- float R = 0.0f, G = 0.0f, B = 0.0f;
- pColorSpace->GetRGB(comps, R, G, B);
+ float R = 0.0f;
+ float G = 0.0f;
+ float B = 0.0f;
+ pColorSpace->GetRGB(comps, &R, &G, &B);
background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255),
(int32_t)(B * 255));
}
@@ -2585,7 +2591,7 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
for (size_t i = 0; i < count; i++) {
pFloats[i] = pBC->GetNumberAt(i);
}
- pCS->GetRGB(pFloats, R, G, B);
+ pCS->GetRGB(pFloats, &R, &G, &B);
back_color = 0xff000000 | ((int32_t)(R * 255) << 16) |
((int32_t)(G * 255) << 8) | (int32_t)(B * 255);
m_pContext->GetDocument()->GetPageData()->ReleaseColorSpace(pCSObj);
@@ -2621,7 +2627,7 @@ std::unique_ptr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
for (int i = 0; i < 256; i++) {
float input = (float)i / 255.0f;
int nresult;
- pFunc->Call(&input, 1, results, nresult);
+ pFunc->Call(&input, 1, results, &nresult);
transfers[i] = FXSYS_round(results[0] * 255);
}
} else {