summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/page/cpdf_psfunc.cpp11
-rw-r--r--core/fpdfapi/page/cpdf_psfunc.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_psfunc.cpp b/core/fpdfapi/page/cpdf_psfunc.cpp
index be0afe9659..13d76aeb10 100644
--- a/core/fpdfapi/page/cpdf_psfunc.cpp
+++ b/core/fpdfapi/page/cpdf_psfunc.cpp
@@ -21,14 +21,13 @@ bool CPDF_PSFunc::v_Init(const CPDF_Object* pObj,
}
bool CPDF_PSFunc::v_Call(const float* inputs, float* results) const {
- CPDF_PSEngine& PS = const_cast<CPDF_PSEngine&>(m_PS);
- PS.Reset();
+ m_PS.Reset();
for (uint32_t i = 0; i < m_nInputs; i++)
- PS.Push(inputs[i]);
- PS.Execute();
- if (PS.GetStackSize() < m_nOutputs)
+ m_PS.Push(inputs[i]);
+ m_PS.Execute();
+ if (m_PS.GetStackSize() < m_nOutputs)
return false;
for (uint32_t i = 0; i < m_nOutputs; i++)
- results[m_nOutputs - i - 1] = PS.Pop();
+ results[m_nOutputs - i - 1] = m_PS.Pop();
return true;
}
diff --git a/core/fpdfapi/page/cpdf_psfunc.h b/core/fpdfapi/page/cpdf_psfunc.h
index 459da5a599..1274c21d50 100644
--- a/core/fpdfapi/page/cpdf_psfunc.h
+++ b/core/fpdfapi/page/cpdf_psfunc.h
@@ -25,7 +25,7 @@ class CPDF_PSFunc : public CPDF_Function {
bool v_Call(const float* inputs, float* results) const override;
private:
- CPDF_PSEngine m_PS;
+ mutable CPDF_PSEngine m_PS; // Pre-initialized scratch space for v_Call().
};
#endif // CORE_FPDFAPI_PAGE_CPDF_PSFUNC_H_