| 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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "pageint.h" | 9 #include "pageint.h" |
| 10 #include <limits.h> | 10 #include <limits.h> |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); | 479 CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode")); |
| 480 CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); | 480 CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); |
| 481 m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample")); | 481 m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample")); |
| 482 m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); | 482 m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); |
| 483 m_pSampleStream = FX_NEW CPDF_StreamAcc; | 483 m_pSampleStream = FX_NEW CPDF_StreamAcc; |
| 484 m_pSampleStream->LoadAllData(pStream, FALSE); | 484 m_pSampleStream->LoadAllData(pStream, FALSE); |
| 485 m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs); | 485 m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs); |
| 486 int i; | 486 int i; |
| 487 FX_DWORD nTotalSamples = 1; | 487 FX_DWORD nTotalSamples = 1; |
| 488 for (i = 0; i < m_nInputs; i ++) { | 488 for (i = 0; i < m_nInputs; i ++) { |
| 489 m_pEncodeInfo[i].sizes = pSize->GetInteger(i); | 489 m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0; |
| 490 if (!pSize && i == 0) { | 490 if (!pSize && i == 0) { |
| 491 m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); | 491 m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size")); |
| 492 } | 492 } |
| 493 if (nTotalSamples > 0 && (FX_UINT32)(m_pEncodeInfo[i].sizes) > UINT_MAX
/ nTotalSamples) { | 493 if (nTotalSamples > 0 && (FX_UINT32)(m_pEncodeInfo[i].sizes) > UINT_MAX
/ nTotalSamples) { |
| 494 return FALSE; | 494 return FALSE; |
| 495 } | 495 } |
| 496 nTotalSamples *= m_pEncodeInfo[i].sizes; | 496 nTotalSamples *= m_pEncodeInfo[i].sizes; |
| 497 if (pEncode) { | 497 if (pEncode) { |
| 498 m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2); | 498 m_pEncodeInfo[i].encode_min = pEncode->GetFloat(i * 2); |
| 499 m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1); | 499 m_pEncodeInfo[i].encode_max = pEncode->GetFloat(i * 2 + 1); |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 for (int i = 0; i < m_nOutputs; i ++) { | 877 for (int i = 0; i < m_nOutputs; i ++) { |
| 878 if (results[i] < m_pRanges[i * 2]) { | 878 if (results[i] < m_pRanges[i * 2]) { |
| 879 results[i] = m_pRanges[i * 2]; | 879 results[i] = m_pRanges[i * 2]; |
| 880 } else if (results[i] > m_pRanges[i * 2 + 1]) { | 880 } else if (results[i] > m_pRanges[i * 2 + 1]) { |
| 881 results[i] = m_pRanges[i * 2 + 1]; | 881 results[i] = m_pRanges[i * 2 + 1]; |
| 882 } | 882 } |
| 883 } | 883 } |
| 884 } | 884 } |
| 885 return TRUE; | 885 return TRUE; |
| 886 } | 886 } |
| OLD | NEW |