| 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 "core/fpdfapi/page/pageint.h" | 7 #include "core/fpdfapi/page/pageint.h" |
| 8 | 8 |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 | 10 |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 567 |
| 568 FX_SAFE_INT32 range_check = bitpos; | 568 FX_SAFE_INT32 range_check = bitpos; |
| 569 range_check += bits_to_output.ValueOrDie(); | 569 range_check += bits_to_output.ValueOrDie(); |
| 570 if (!range_check.IsValid()) | 570 if (!range_check.IsValid()) |
| 571 return false; | 571 return false; |
| 572 | 572 |
| 573 const uint8_t* pSampleData = m_pSampleStream->GetData(); | 573 const uint8_t* pSampleData = m_pSampleStream->GetData(); |
| 574 if (!pSampleData) | 574 if (!pSampleData) |
| 575 return false; | 575 return false; |
| 576 | 576 |
| 577 for (uint32_t j = 0; j < m_nOutputs; j++) { | 577 for (uint32_t j = 0; j < m_nOutputs; j++, bitpos += m_nBitsPerSample) { |
| 578 uint32_t sample = | 578 uint32_t sample = |
| 579 GetBits32(pSampleData, bitpos.ValueOrDie() + j * m_nBitsPerSample, | 579 GetBits32(pSampleData, bitpos.ValueOrDie(), m_nBitsPerSample); |
| 580 m_nBitsPerSample); | |
| 581 FX_FLOAT encoded = (FX_FLOAT)sample; | 580 FX_FLOAT encoded = (FX_FLOAT)sample; |
| 582 for (uint32_t i = 0; i < m_nInputs; i++) { | 581 for (uint32_t i = 0; i < m_nInputs; i++) { |
| 583 if (index[i] == m_EncodeInfo[i].sizes - 1) { | 582 if (index[i] == m_EncodeInfo[i].sizes - 1) { |
| 584 if (index[i] == 0) | 583 if (index[i] == 0) |
| 585 encoded = encoded_input[i] * (FX_FLOAT)sample; | 584 encoded = encoded_input[i] * (FX_FLOAT)sample; |
| 586 } else { | 585 } else { |
| 587 FX_SAFE_INT32 bitpos2 = blocksize[i]; | 586 FX_SAFE_INT32 bitpos2 = blocksize[i]; |
| 588 bitpos2 += pos; | 587 bitpos2 += pos; |
| 589 bitpos2 *= m_nOutputs; | 588 bitpos2 *= m_nOutputs; |
| 590 bitpos2 += j; | 589 bitpos2 += j; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 return m_Type == Type::kType2ExpotentialInterpolation | 850 return m_Type == Type::kType2ExpotentialInterpolation |
| 852 ? static_cast<const CPDF_ExpIntFunc*>(this) | 851 ? static_cast<const CPDF_ExpIntFunc*>(this) |
| 853 : nullptr; | 852 : nullptr; |
| 854 } | 853 } |
| 855 | 854 |
| 856 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const { | 855 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const { |
| 857 return m_Type == Type::kType3Stitching | 856 return m_Type == Type::kType3Stitching |
| 858 ? static_cast<const CPDF_StitchFunc*>(this) | 857 ? static_cast<const CPDF_StitchFunc*>(this) |
| 859 : nullptr; | 858 : nullptr; |
| 860 } | 859 } |
| OLD | NEW |