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 "pageint.h" | 7 #include "pageint.h" |
8 | 8 |
9 #include "core/include/fpdfapi/fpdf_module.h" | 9 #include "core/include/fpdfapi/fpdf_module.h" |
10 #include "core/include/fpdfapi/fpdf_page.h" | 10 #include "core/include/fpdfapi/fpdf_page.h" |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 return CFX_ByteStringC(table[i].m_Ptr, table[i].m_Size); | 481 return CFX_ByteStringC(table[i].m_Ptr, table[i].m_Size); |
482 } | 482 } |
483 i += 2; | 483 i += 2; |
484 } | 484 } |
485 return CFX_ByteStringC(); | 485 return CFX_ByteStringC(); |
486 } | 486 } |
487 void _PDF_ReplaceAbbr(CPDF_Object* pObj) { | 487 void _PDF_ReplaceAbbr(CPDF_Object* pObj) { |
488 switch (pObj->GetType()) { | 488 switch (pObj->GetType()) { |
489 case PDFOBJ_DICTIONARY: { | 489 case PDFOBJ_DICTIONARY: { |
490 CPDF_Dictionary* pDict = pObj->AsDictionary(); | 490 CPDF_Dictionary* pDict = pObj->AsDictionary(); |
491 FX_POSITION pos = pDict->GetStartPos(); | 491 for (const auto& it : *pDict) { |
492 while (pos) { | 492 CFX_ByteString key = it.first; |
493 CFX_ByteString key; | 493 CPDF_Object* value = it.second; |
494 CPDF_Object* value = pDict->GetNextElement(pos, key); | |
495 CFX_ByteStringC fullname = _PDF_FindFullName( | 494 CFX_ByteStringC fullname = _PDF_FindFullName( |
496 _PDF_InlineKeyAbbr, sizeof _PDF_InlineKeyAbbr / sizeof(_FX_BSTR), | 495 _PDF_InlineKeyAbbr, sizeof _PDF_InlineKeyAbbr / sizeof(_FX_BSTR), |
497 key); | 496 key); |
498 if (!fullname.IsEmpty()) { | 497 if (!fullname.IsEmpty()) { |
499 pDict->ReplaceKey(key, fullname); | 498 pDict->ReplaceKey(key, fullname); |
500 key = fullname; | 499 key = fullname; |
501 } | 500 } |
502 | 501 |
503 if (value->IsName()) { | 502 if (value->IsName()) { |
504 CFX_ByteString name = value->GetString(); | 503 CFX_ByteString name = value->GetString(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 return CFX_ByteStringC(table[i + 1].m_Ptr, table[i + 1].m_Size); | 544 return CFX_ByteStringC(table[i + 1].m_Ptr, table[i + 1].m_Size); |
546 } | 545 } |
547 i += 2; | 546 i += 2; |
548 } | 547 } |
549 return CFX_ByteStringC(); | 548 return CFX_ByteStringC(); |
550 } | 549 } |
551 void _PDF_ReplaceFull(CPDF_Object* pObj) { | 550 void _PDF_ReplaceFull(CPDF_Object* pObj) { |
552 switch (pObj->GetType()) { | 551 switch (pObj->GetType()) { |
553 case PDFOBJ_DICTIONARY: { | 552 case PDFOBJ_DICTIONARY: { |
554 CPDF_Dictionary* pDict = pObj->AsDictionary(); | 553 CPDF_Dictionary* pDict = pObj->AsDictionary(); |
555 FX_POSITION pos = pDict->GetStartPos(); | 554 for (const auto& it : *pDict) { |
556 while (pos) { | 555 CFX_ByteString key = it.first; |
557 CFX_ByteString key; | 556 CPDF_Object* value = it.second; |
558 CPDF_Object* value = pDict->GetNextElement(pos, key); | |
559 CFX_ByteStringC abbrName = _PDF_FindAbbrName( | 557 CFX_ByteStringC abbrName = _PDF_FindAbbrName( |
560 _PDF_InlineKeyAbbr, sizeof(_PDF_InlineKeyAbbr) / sizeof(_FX_BSTR), | 558 _PDF_InlineKeyAbbr, sizeof(_PDF_InlineKeyAbbr) / sizeof(_FX_BSTR), |
561 key); | 559 key); |
562 if (!abbrName.IsEmpty()) { | 560 if (!abbrName.IsEmpty()) { |
563 pDict->ReplaceKey(key, abbrName); | 561 pDict->ReplaceKey(key, abbrName); |
564 key = abbrName; | 562 key = abbrName; |
565 } | 563 } |
566 if (value->IsName()) { | 564 if (value->IsName()) { |
567 CFX_ByteString name = value->GetString(); | 565 CFX_ByteString name = value->GetString(); |
568 abbrName = _PDF_FindAbbrName( | 566 abbrName = _PDF_FindAbbrName( |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 m_pObjectList->m_ObjectList.AddTail(pPathObj); | 1516 m_pObjectList->m_ObjectList.AddTail(pPathObj); |
1519 } | 1517 } |
1520 if (PathClipType) { | 1518 if (PathClipType) { |
1521 if (!matrix.IsIdentity()) { | 1519 if (!matrix.IsIdentity()) { |
1522 Path.Transform(&matrix); | 1520 Path.Transform(&matrix); |
1523 matrix.SetIdentity(); | 1521 matrix.SetIdentity(); |
1524 } | 1522 } |
1525 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); | 1523 m_pCurStates->m_ClipPath.AppendPath(Path, PathClipType, TRUE); |
1526 } | 1524 } |
1527 } | 1525 } |
OLD | NEW |