| 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 "../../../include/fpdfapi/fpdf_serial.h" | 9 #include "../../../include/fpdfapi/fpdf_serial.h" |
| 10 #include "../../../include/fxcrt/fx_ext.h" |
| 10 #include "pageint.h" | 11 #include "pageint.h" |
| 11 | 12 |
| 12 #define REQUIRE_PARAMS(count) \ | 13 #define REQUIRE_PARAMS(count) \ |
| 13 if (m_ParamCount != count) { \ | 14 if (m_ParamCount != count) { \ |
| 14 return; \ | 15 return; \ |
| 15 } | 16 } |
| 16 | 17 |
| 17 CPDF_StreamContentParser::CPDF_StreamContentParser( | 18 CPDF_StreamContentParser::CPDF_StreamContentParser( |
| 18 CPDF_Document* pDocument, | 19 CPDF_Document* pDocument, |
| 19 CPDF_Dictionary* pPageResources, | 20 CPDF_Dictionary* pPageResources, |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 if (PathClipType) { | 1528 if (PathClipType) { |
| 1528 if (!matrix.IsIdentity()) { | 1529 if (!matrix.IsIdentity()) { |
| 1529 Path.Transform(&matrix); | 1530 Path.Transform(&matrix); |
| 1530 matrix.SetIdentity(); | 1531 matrix.SetIdentity(); |
| 1531 } | 1532 } |
| 1532 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); | 1533 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); |
| 1533 } | 1534 } |
| 1534 } | 1535 } |
| 1535 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) { | 1536 CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf) { |
| 1536 CFX_ByteTextBuf buf; | 1537 CFX_ByteTextBuf buf; |
| 1537 FX_BOOL bFirst = TRUE; | 1538 bool bFirst = true; |
| 1538 int code = 0; | 1539 int code = 0; |
| 1539 const uint8_t* str = src_buf.GetBuffer(); | 1540 const uint8_t* str = src_buf.GetBuffer(); |
| 1540 FX_DWORD size = src_buf.GetSize(); | 1541 FX_DWORD size = src_buf.GetSize(); |
| 1541 for (FX_DWORD i = 0; i < size; i++) { | 1542 for (FX_DWORD i = 0; i < size; i++) { |
| 1542 uint8_t ch = str[i]; | 1543 uint8_t ch = str[i]; |
| 1543 if (ch >= '0' && ch <= '9') { | 1544 |
| 1545 if (std::isxdigit(ch)) { |
| 1546 int val = FXSYS_toHexDigit(ch); |
| 1544 if (bFirst) { | 1547 if (bFirst) { |
| 1545 code = (ch - '0') * 16; | 1548 code = val * 16; |
| 1546 } else { | 1549 } else { |
| 1547 code += ch - '0'; | 1550 code += val; |
| 1548 buf.AppendChar((char)code); | |
| 1549 } | |
| 1550 bFirst = !bFirst; | |
| 1551 } else if (ch >= 'A' && ch <= 'F') { | |
| 1552 if (bFirst) { | |
| 1553 code = (ch - 'A' + 10) * 16; | |
| 1554 } else { | |
| 1555 code += ch - 'A' + 10; | |
| 1556 buf.AppendChar((char)code); | |
| 1557 } | |
| 1558 bFirst = !bFirst; | |
| 1559 } else if (ch >= 'a' && ch <= 'f') { | |
| 1560 if (bFirst) { | |
| 1561 code = (ch - 'a' + 10) * 16; | |
| 1562 } else { | |
| 1563 code += ch - 'a' + 10; | |
| 1564 buf.AppendChar((char)code); | 1551 buf.AppendChar((char)code); |
| 1565 } | 1552 } |
| 1566 bFirst = !bFirst; | 1553 bFirst = !bFirst; |
| 1567 } | 1554 } |
| 1568 } | 1555 } |
| 1569 if (!bFirst) { | 1556 if (!bFirst) |
| 1570 buf.AppendChar((char)code); | 1557 buf.AppendChar((char)code); |
| 1571 } | 1558 |
| 1572 return buf.GetByteString(); | 1559 return buf.GetByteString(); |
| 1573 } | 1560 } |
| OLD | NEW |