| OLD | NEW | 
|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 
| 6 | 6 | 
| 7 #include <limits.h> | 7 #include <limits.h> | 
| 8 | 8 | 
| 9 #include "../../../include/fpdfapi/fpdf_module.h" | 9 #include "../../../include/fpdfapi/fpdf_module.h" | 
| 10 #include "../../../include/fpdfapi/fpdf_page.h" | 10 #include "../../../include/fpdfapi/fpdf_page.h" | 
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 480   CPDF_StreamAcc* m_pSampleStream; | 480   CPDF_StreamAcc* m_pSampleStream; | 
| 481 }; | 481 }; | 
| 482 | 482 | 
| 483 CPDF_SampledFunc::CPDF_SampledFunc() { | 483 CPDF_SampledFunc::CPDF_SampledFunc() { | 
| 484   m_pSampleStream = NULL; | 484   m_pSampleStream = NULL; | 
| 485   m_pEncodeInfo = NULL; | 485   m_pEncodeInfo = NULL; | 
| 486   m_pDecodeInfo = NULL; | 486   m_pDecodeInfo = NULL; | 
| 487 } | 487 } | 
| 488 CPDF_SampledFunc::~CPDF_SampledFunc() { | 488 CPDF_SampledFunc::~CPDF_SampledFunc() { | 
| 489   delete m_pSampleStream; | 489   delete m_pSampleStream; | 
| 490   if (m_pEncodeInfo) { | 490   FX_Free(m_pEncodeInfo); | 
| 491     FX_Free(m_pEncodeInfo); | 491   FX_Free(m_pDecodeInfo); | 
| 492   } |  | 
| 493   if (m_pDecodeInfo) { |  | 
| 494     FX_Free(m_pDecodeInfo); |  | 
| 495   } |  | 
| 496 } | 492 } | 
| 497 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { | 493 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { | 
| 498   if (pObj->GetType() != PDFOBJ_STREAM) { | 494   if (pObj->GetType() != PDFOBJ_STREAM) { | 
| 499     return FALSE; | 495     return FALSE; | 
| 500   } | 496   } | 
| 501   CPDF_Stream* pStream = (CPDF_Stream*)pObj; | 497   CPDF_Stream* pStream = (CPDF_Stream*)pObj; | 
| 502   CPDF_Dictionary* pDict = pStream->GetDict(); | 498   CPDF_Dictionary* pDict = pStream->GetDict(); | 
| 503   CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size")); | 499   CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size")); | 
| 504   CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); | 500   CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); | 
| 505   CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); | 501   CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 671   FX_FLOAT* m_pBeginValues; | 667   FX_FLOAT* m_pBeginValues; | 
| 672   FX_FLOAT* m_pEndValues; | 668   FX_FLOAT* m_pEndValues; | 
| 673   int m_nOrigOutputs; | 669   int m_nOrigOutputs; | 
| 674 }; | 670 }; | 
| 675 | 671 | 
| 676 CPDF_ExpIntFunc::CPDF_ExpIntFunc() { | 672 CPDF_ExpIntFunc::CPDF_ExpIntFunc() { | 
| 677   m_pBeginValues = NULL; | 673   m_pBeginValues = NULL; | 
| 678   m_pEndValues = NULL; | 674   m_pEndValues = NULL; | 
| 679 } | 675 } | 
| 680 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { | 676 CPDF_ExpIntFunc::~CPDF_ExpIntFunc() { | 
| 681   if (m_pBeginValues) { |  | 
| 682     FX_Free(m_pBeginValues); | 677     FX_Free(m_pBeginValues); | 
| 683   } |  | 
| 684   if (m_pEndValues) { |  | 
| 685     FX_Free(m_pEndValues); | 678     FX_Free(m_pEndValues); | 
| 686   } |  | 
| 687 } | 679 } | 
| 688 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { | 680 FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) { | 
| 689   CPDF_Dictionary* pDict = pObj->GetDict(); | 681   CPDF_Dictionary* pDict = pObj->GetDict(); | 
| 690   if (pDict == NULL) { | 682   if (pDict == NULL) { | 
| 691     return FALSE; | 683     return FALSE; | 
| 692   } | 684   } | 
| 693   CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0")); | 685   CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0")); | 
| 694   if (m_nOutputs == 0) { | 686   if (m_nOutputs == 0) { | 
| 695     m_nOutputs = 1; | 687     m_nOutputs = 1; | 
| 696     if (pArray0) { | 688     if (pArray0) { | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 740 | 732 | 
| 741 CPDF_StitchFunc::CPDF_StitchFunc() { | 733 CPDF_StitchFunc::CPDF_StitchFunc() { | 
| 742   m_nSubs = 0; | 734   m_nSubs = 0; | 
| 743   m_pSubFunctions = NULL; | 735   m_pSubFunctions = NULL; | 
| 744   m_pBounds = NULL; | 736   m_pBounds = NULL; | 
| 745   m_pEncode = NULL; | 737   m_pEncode = NULL; | 
| 746 } | 738 } | 
| 747 CPDF_StitchFunc::~CPDF_StitchFunc() { | 739 CPDF_StitchFunc::~CPDF_StitchFunc() { | 
| 748   for (int i = 0; i < m_nSubs; i++) | 740   for (int i = 0; i < m_nSubs; i++) | 
| 749     delete m_pSubFunctions[i]; | 741     delete m_pSubFunctions[i]; | 
| 750   if (m_pSubFunctions) { | 742   FX_Free(m_pSubFunctions); | 
| 751     FX_Free(m_pSubFunctions); | 743   FX_Free(m_pBounds); | 
| 752   } | 744   FX_Free(m_pEncode); | 
| 753   if (m_pBounds) { |  | 
| 754     FX_Free(m_pBounds); |  | 
| 755   } |  | 
| 756   if (m_pEncode) { |  | 
| 757     FX_Free(m_pEncode); |  | 
| 758   } |  | 
| 759 } | 745 } | 
| 760 FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { | 746 FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { | 
| 761   CPDF_Dictionary* pDict = pObj->GetDict(); | 747   CPDF_Dictionary* pDict = pObj->GetDict(); | 
| 762   if (pDict == NULL) { | 748   if (pDict == NULL) { | 
| 763     return FALSE; | 749     return FALSE; | 
| 764   } | 750   } | 
| 765   CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions")); | 751   CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions")); | 
| 766   if (pArray == NULL) { | 752   if (pArray == NULL) { | 
| 767     return FALSE; | 753     return FALSE; | 
| 768   } | 754   } | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 852     delete pFunc; | 838     delete pFunc; | 
| 853     return NULL; | 839     return NULL; | 
| 854   } | 840   } | 
| 855   return pFunc; | 841   return pFunc; | 
| 856 } | 842 } | 
| 857 CPDF_Function::CPDF_Function() { | 843 CPDF_Function::CPDF_Function() { | 
| 858   m_pDomains = NULL; | 844   m_pDomains = NULL; | 
| 859   m_pRanges = NULL; | 845   m_pRanges = NULL; | 
| 860 } | 846 } | 
| 861 CPDF_Function::~CPDF_Function() { | 847 CPDF_Function::~CPDF_Function() { | 
| 862   if (m_pDomains) { | 848   FX_Free(m_pDomains); | 
| 863     FX_Free(m_pDomains); | 849   FX_Free(m_pRanges); | 
| 864     m_pDomains = NULL; |  | 
| 865   } |  | 
| 866   if (m_pRanges) { |  | 
| 867     FX_Free(m_pRanges); |  | 
| 868     m_pRanges = NULL; |  | 
| 869   } |  | 
| 870 } | 850 } | 
| 871 FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { | 851 FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { | 
| 872   CPDF_Dictionary* pDict; | 852   CPDF_Dictionary* pDict; | 
| 873   if (pObj->GetType() == PDFOBJ_STREAM) { | 853   if (pObj->GetType() == PDFOBJ_STREAM) { | 
| 874     pDict = ((CPDF_Stream*)pObj)->GetDict(); | 854     pDict = ((CPDF_Stream*)pObj)->GetDict(); | 
| 875   } else { | 855   } else { | 
| 876     pDict = (CPDF_Dictionary*)pObj; | 856     pDict = (CPDF_Dictionary*)pObj; | 
| 877   } | 857   } | 
| 878   CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain")); | 858   CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain")); | 
| 879   if (pDomains == NULL) { | 859   if (pDomains == NULL) { | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 929     for (int i = 0; i < m_nOutputs; i++) { | 909     for (int i = 0; i < m_nOutputs; i++) { | 
| 930       if (results[i] < m_pRanges[i * 2]) { | 910       if (results[i] < m_pRanges[i * 2]) { | 
| 931         results[i] = m_pRanges[i * 2]; | 911         results[i] = m_pRanges[i * 2]; | 
| 932       } else if (results[i] > m_pRanges[i * 2 + 1]) { | 912       } else if (results[i] > m_pRanges[i * 2 + 1]) { | 
| 933         results[i] = m_pRanges[i * 2 + 1]; | 913         results[i] = m_pRanges[i * 2 + 1]; | 
| 934       } | 914       } | 
| 935     } | 915     } | 
| 936   } | 916   } | 
| 937   return TRUE; | 917   return TRUE; | 
| 938 } | 918 } | 
| OLD | NEW | 
|---|