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_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../include/fpdfapi/fpdf_module.h" | 10 #include "../../../include/fpdfapi/fpdf_module.h" |
11 #include "../../../src/fxcrt/fx_safe_types.h" | 11 #include "../../../src/fxcrt/fx_safe_types.h" |
12 #include "../../../third_party/base/numerics/safe_conversions_impl.h" | 12 #include "../../../third_party/base/numerics/safe_conversions_impl.h" |
13 #include "pageint.h" | 13 #include "pageint.h" |
14 | 14 |
15 class CPDF_PSEngine; | 15 class CPDF_PSEngine; |
16 typedef enum {PSOP_ADD, PSOP_SUB, PSOP_MUL, PSOP_DIV, PSOP_IDIV, PSOP_MOD, | 16 typedef enum {PSOP_ADD, PSOP_SUB, PSOP_MUL, PSOP_DIV, PSOP_IDIV, PSOP_MOD, |
17 PSOP_NEG, PSOP_ABS, PSOP_CEILING, PSOP_FLOOR, PSOP_ROUND, PSOP_TRU
NCATE, | 17 PSOP_NEG, PSOP_ABS, PSOP_CEILING, PSOP_FLOOR, PSOP_ROUND, PSOP_TRU
NCATE, |
18 PSOP_SQRT, PSOP_SIN, PSOP_COS, PSOP_ATAN, PSOP_EXP, PSOP_LN, PSOP_
LOG, | 18 PSOP_SQRT, PSOP_SIN, PSOP_COS, PSOP_ATAN, PSOP_EXP, PSOP_LN, PSOP_
LOG, |
19 PSOP_CVI, PSOP_CVR, PSOP_EQ, PSOP_NE, PSOP_GT, PSOP_GE, PSOP_LT, P
SOP_LE, | 19 PSOP_CVI, PSOP_CVR, PSOP_EQ, PSOP_NE, PSOP_GT, PSOP_GE, PSOP_LT, P
SOP_LE, |
20 PSOP_AND, PSOP_OR, PSOP_XOR, PSOP_NOT, PSOP_BITSHIFT, PSOP_TRUE, P
SOP_FALSE, | 20 PSOP_AND, PSOP_OR, PSOP_XOR, PSOP_NOT, PSOP_BITSHIFT, PSOP_TRUE, P
SOP_FALSE, |
21 PSOP_IF, PSOP_IFELSE, PSOP_POP, PSOP_EXCH, PSOP_DUP, PSOP_COPY, | 21 PSOP_IF, PSOP_IFELSE, PSOP_POP, PSOP_EXCH, PSOP_DUP, PSOP_COPY, |
22 PSOP_INDEX, PSOP_ROLL, PSOP_PROC, PSOP_CONST | 22 PSOP_INDEX, PSOP_ROLL, PSOP_PROC, PSOP_CONST |
23 } PDF_PSOP; | 23 } PDF_PSOP; |
24 class CPDF_PSProc : public CFX_Object | 24 class CPDF_PSProc |
25 { | 25 { |
26 public: | 26 public: |
27 ~CPDF_PSProc(); | 27 ~CPDF_PSProc(); |
28 FX_BOOL Parse(CPDF_SimpleParser& parser); | 28 FX_BOOL Parse(CPDF_SimpleParser& parser); |
29 FX_BOOL Execute(CPDF_PSEngine* pEngine); | 29 FX_BOOL Execute(CPDF_PSEngine* pEngine); |
30 CFX_PtrArray m_Operators; | 30 CFX_PtrArray m_Operators; |
31 }; | 31 }; |
32 #define PSENGINE_STACKSIZE 100 | 32 #define PSENGINE_STACKSIZE 100 |
33 class CPDF_PSEngine : public CFX_Object | 33 class CPDF_PSEngine |
34 { | 34 { |
35 public: | 35 public: |
36 CPDF_PSEngine(); | 36 CPDF_PSEngine(); |
37 ~CPDF_PSEngine(); | 37 ~CPDF_PSEngine(); |
38 FX_BOOL Parse(const FX_CHAR* string, int size); | 38 FX_BOOL Parse(const FX_CHAR* string, int size); |
39 FX_BOOL Execute() | 39 FX_BOOL Execute() |
40 { | 40 { |
41 return m_MainProc.Execute(this); | 41 return m_MainProc.Execute(this); |
42 } | 42 } |
43 FX_BOOL DoOperator(PDF_PSOP op); | 43 FX_BOOL DoOperator(PDF_PSOP op); |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 for (int i = 0; i < m_nOutputs; i ++) { | 898 for (int i = 0; i < m_nOutputs; i ++) { |
899 if (results[i] < m_pRanges[i * 2]) { | 899 if (results[i] < m_pRanges[i * 2]) { |
900 results[i] = m_pRanges[i * 2]; | 900 results[i] = m_pRanges[i * 2]; |
901 } else if (results[i] > m_pRanges[i * 2 + 1]) { | 901 } else if (results[i] > m_pRanges[i * 2 + 1]) { |
902 results[i] = m_pRanges[i * 2 + 1]; | 902 results[i] = m_pRanges[i * 2 + 1]; |
903 } | 903 } |
904 } | 904 } |
905 } | 905 } |
906 return TRUE; | 906 return TRUE; |
907 } | 907 } |
OLD | NEW |