Example #1
0
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj)
{
    CPDF_Dictionary* pDict = pObj->GetDict();
    if (pDict == NULL) {
        return FALSE;
    }
    CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0"));
    if (m_nOutputs == 0) {
        m_nOutputs = 1;
        if (pArray0) {
            m_nOutputs = pArray0->GetCount();
        }
    }
    CPDF_Array* pArray1 = pDict->GetArray(FX_BSTRC("C1"));
    m_pBeginValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2);
    m_pEndValues = FX_Alloc(FX_FLOAT, m_nOutputs * 2);
    for (int i = 0; i < m_nOutputs; i ++) {
        m_pBeginValues[i] = pArray0 ? pArray0->GetFloat(i) : 0.0f;
        m_pEndValues[i] = pArray1 ? pArray1->GetFloat(i) : 1.0f;
    }
    m_Exponent = pDict->GetFloat(FX_BSTRC("N"));
    m_nOrigOutputs = m_nOutputs;
    if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
        return FALSE;
    }
    m_nOutputs *= m_nInputs;
    return TRUE;
}