summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-23 16:30:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-23 16:30:06 +0000
commitfd016f4e9b0df99ed4670b50b30e5c6f18028f9a (patch)
tree61e993c265bc7da6b2fe175c8f08890807d60386
parentcca452eab645fd6b0e63ab2fd1dd553277df111e (diff)
downloadpdfium-fd016f4e9b0df99ed4670b50b30e5c6f18028f9a.tar.xz
Fix some nits in CPDF_SampledFunc().
Change-Id: I54aae3c65ded779f1421b8f971a187979e5a204b Reviewed-on: https://pdfium-review.googlesource.com/31150 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_sampledfunc.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_sampledfunc.cpp b/core/fpdfapi/page/cpdf_sampledfunc.cpp
index cdedc862bb..6ec87fc672 100644
--- a/core/fpdfapi/page/cpdf_sampledfunc.cpp
+++ b/core/fpdfapi/page/cpdf_sampledfunc.cpp
@@ -42,10 +42,10 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj,
if (!pStream)
return false;
- CPDF_Dictionary* pDict = pStream->GetDict();
- CPDF_Array* pSize = pDict->GetArrayFor("Size");
- CPDF_Array* pEncode = pDict->GetArrayFor("Encode");
- CPDF_Array* pDecode = pDict->GetArrayFor("Decode");
+ const CPDF_Dictionary* pDict = pStream->GetDict();
+ const CPDF_Array* pSize = pDict->GetArrayFor("Size");
+ const CPDF_Array* pEncode = pDict->GetArrayFor("Encode");
+ const CPDF_Array* pDecode = pDict->GetArrayFor("Decode");
m_nBitsPerSample = pDict->GetIntegerFor("BitsPerSample");
if (!IsValidBitsPerSample(m_nBitsPerSample))
return false;
@@ -66,7 +66,7 @@ bool CPDF_SampledFunc::v_Init(CPDF_Object* pObj,
} else {
m_EncodeInfo[i].encode_min = 0;
m_EncodeInfo[i].encode_max =
- m_EncodeInfo[i].sizes == 1 ? 1 : (float)m_EncodeInfo[i].sizes - 1;
+ m_EncodeInfo[i].sizes == 1 ? 1 : m_EncodeInfo[i].sizes - 1;
}
}
nTotalSampleBits *= m_nBitsPerSample;
@@ -132,11 +132,11 @@ bool CPDF_SampledFunc::v_Call(const float* inputs, float* results) const {
for (uint32_t j = 0; j < m_nOutputs; j++, bitpos += m_nBitsPerSample) {
uint32_t sample =
GetBits32(pSampleData, bitpos.ValueOrDie(), m_nBitsPerSample);
- float encoded = (float)sample;
+ float encoded = sample;
for (uint32_t i = 0; i < m_nInputs; i++) {
if (index[i] == m_EncodeInfo[i].sizes - 1) {
if (index[i] == 0)
- encoded = encoded_input[i] * (float)sample;
+ encoded = encoded_input[i] * sample;
} else {
FX_SAFE_INT32 bitpos2 = blocksize[i];
bitpos2 += pos;
@@ -147,12 +147,12 @@ bool CPDF_SampledFunc::v_Call(const float* inputs, float* results) const {
return false;
uint32_t sample1 =
GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
- encoded +=
- (encoded_input[i] - index[i]) * ((float)sample1 - (float)sample);
+ encoded += (encoded_input[i] - index[i]) *
+ (static_cast<float>(sample1) - sample);
}
}
results[j] =
- Interpolate(encoded, 0, (float)m_SampleMax, m_DecodeInfo[j].decode_min,
+ Interpolate(encoded, 0, m_SampleMax, m_DecodeInfo[j].decode_min,
m_DecodeInfo[j].decode_max);
}
return true;