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/fpdf_page/pageint.h" | 7 #include "core/fpdfapi/page/pageint.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <memory> | 12 #include <memory> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "core/fpdfapi/fpdf_page/cpdf_psengine.h" | |
17 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" | 16 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" |
18 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" | 17 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" |
19 #include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" | 18 #include "core/fpdfapi/fpdf_parser/cpdf_simple_parser.h" |
20 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" | 19 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" |
21 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" | 20 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" |
| 21 #include "core/fpdfapi/page/cpdf_psengine.h" |
22 #include "core/fxcrt/fx_safe_types.h" | 22 #include "core/fxcrt/fx_safe_types.h" |
23 #include "third_party/base/numerics/safe_conversions_impl.h" | 23 #include "third_party/base/numerics/safe_conversions_impl.h" |
24 | 24 |
25 class CPDF_PSOP { | 25 class CPDF_PSOP { |
26 public: | 26 public: |
27 explicit CPDF_PSOP(PDF_PSOP op) : m_op(op), m_value(0) { | 27 explicit CPDF_PSOP(PDF_PSOP op) : m_op(op), m_value(0) { |
28 ASSERT(m_op != PSOP_CONST); | 28 ASSERT(m_op != PSOP_CONST); |
29 ASSERT(m_op != PSOP_PROC); | 29 ASSERT(m_op != PSOP_PROC); |
30 } | 30 } |
31 explicit CPDF_PSOP(FX_FLOAT value) : m_op(PSOP_CONST), m_value(value) {} | 31 explicit CPDF_PSOP(FX_FLOAT value) : m_op(PSOP_CONST), m_value(value) {} |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 for (uint32_t i = 0; i < m_nInputs; i++) | 457 for (uint32_t i = 0; i < m_nInputs; i++) |
458 PS.Push(inputs[i]); | 458 PS.Push(inputs[i]); |
459 PS.Execute(); | 459 PS.Execute(); |
460 if (PS.GetStackSize() < m_nOutputs) | 460 if (PS.GetStackSize() < m_nOutputs) |
461 return FALSE; | 461 return FALSE; |
462 for (uint32_t i = 0; i < m_nOutputs; i++) | 462 for (uint32_t i = 0; i < m_nOutputs; i++) |
463 results[m_nOutputs - i - 1] = PS.Pop(); | 463 results[m_nOutputs - i - 1] = PS.Pop(); |
464 return TRUE; | 464 return TRUE; |
465 } | 465 } |
466 | 466 |
467 | |
468 CPDF_SampledFunc::CPDF_SampledFunc() : CPDF_Function(Type::kType0Sampled) {} | 467 CPDF_SampledFunc::CPDF_SampledFunc() : CPDF_Function(Type::kType0Sampled) {} |
469 | 468 |
470 CPDF_SampledFunc::~CPDF_SampledFunc() {} | 469 CPDF_SampledFunc::~CPDF_SampledFunc() {} |
471 | 470 |
472 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { | 471 FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) { |
473 CPDF_Stream* pStream = pObj->AsStream(); | 472 CPDF_Stream* pStream = pObj->AsStream(); |
474 if (!pStream) | 473 if (!pStream) |
475 return false; | 474 return false; |
476 | 475 |
477 CPDF_Dictionary* pDict = pStream->GetDict(); | 476 CPDF_Dictionary* pDict = pStream->GetDict(); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 return m_Type == Type::kType2ExpotentialInterpolation | 836 return m_Type == Type::kType2ExpotentialInterpolation |
838 ? static_cast<const CPDF_ExpIntFunc*>(this) | 837 ? static_cast<const CPDF_ExpIntFunc*>(this) |
839 : nullptr; | 838 : nullptr; |
840 } | 839 } |
841 | 840 |
842 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const { | 841 const CPDF_StitchFunc* CPDF_Function::ToStitchFunc() const { |
843 return m_Type == Type::kType3Stitching | 842 return m_Type == Type::kType3Stitching |
844 ? static_cast<const CPDF_StitchFunc*>(this) | 843 ? static_cast<const CPDF_StitchFunc*>(this) |
845 : nullptr; | 844 : nullptr; |
846 } | 845 } |
OLD | NEW |