| 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/fpdf_page/pageint.h" |
| 8 | 8 |
| 9 #include <limits.h> | 9 #include <limits.h> |
| 10 | 10 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 m_pParser.reset(new CPDF_StreamContentParser( | 704 m_pParser.reset(new CPDF_StreamContentParser( |
| 705 pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, | 705 pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, |
| 706 pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level)); | 706 pParentMatrix, pForm, pResources, &form_bbox, pGraphicStates, level)); |
| 707 m_pParser->GetCurStates()->m_CTM = form_matrix; | 707 m_pParser->GetCurStates()->m_CTM = form_matrix; |
| 708 m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; | 708 m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; |
| 709 if (ClipPath) { | 709 if (ClipPath) { |
| 710 m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, | 710 m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, |
| 711 TRUE); | 711 TRUE); |
| 712 } | 712 } |
| 713 if (pForm->m_Transparency & PDFTRANS_GROUP) { | 713 if (pForm->m_Transparency & PDFTRANS_GROUP) { |
| 714 m_pParser->GetCurStates()->m_GeneralState.MakePrivateCopy(); | |
| 715 CPDF_GeneralStateData* pData = | 714 CPDF_GeneralStateData* pData = |
| 716 m_pParser->GetCurStates()->m_GeneralState.GetObject(); | 715 m_pParser->GetCurStates()->m_GeneralState.GetPrivateCopy(); |
| 717 pData->m_BlendType = FXDIB_BLEND_NORMAL; | 716 pData->m_BlendType = FXDIB_BLEND_NORMAL; |
| 718 pData->m_StrokeAlpha = 1.0f; | 717 pData->m_StrokeAlpha = 1.0f; |
| 719 pData->m_FillAlpha = 1.0f; | 718 pData->m_FillAlpha = 1.0f; |
| 720 pData->m_pSoftMask = nullptr; | 719 pData->m_pSoftMask = nullptr; |
| 721 } | 720 } |
| 722 m_nStreams = 0; | 721 m_nStreams = 0; |
| 723 m_pSingleStream.reset(new CPDF_StreamAcc); | 722 m_pSingleStream.reset(new CPDF_StreamAcc); |
| 724 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); | 723 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); |
| 725 m_pData = (uint8_t*)m_pSingleStream->GetData(); | 724 m_pData = (uint8_t*)m_pSingleStream->GetData(); |
| 726 m_Size = m_pSingleStream->GetSize(); | 725 m_Size = m_pSingleStream->GetSize(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); | 767 m_StreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); |
| 769 m_CurrentOffset++; | 768 m_CurrentOffset++; |
| 770 } | 769 } |
| 771 } | 770 } |
| 772 if (m_InternalStage == STAGE_PARSE) { | 771 if (m_InternalStage == STAGE_PARSE) { |
| 773 if (!m_pParser) { | 772 if (!m_pParser) { |
| 774 m_pParser.reset(new CPDF_StreamContentParser( | 773 m_pParser.reset(new CPDF_StreamContentParser( |
| 775 m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, | 774 m_pObjectHolder->m_pDocument, m_pObjectHolder->m_pPageResources, |
| 776 nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, | 775 nullptr, nullptr, m_pObjectHolder, m_pObjectHolder->m_pResources, |
| 777 &m_pObjectHolder->m_BBox, nullptr, 0)); | 776 &m_pObjectHolder->m_BBox, nullptr, 0)); |
| 778 m_pParser->GetCurStates()->m_ColorState.MakePrivateCopy(); | 777 m_pParser->GetCurStates()->m_ColorState.GetPrivateCopy()->Default(); |
| 779 m_pParser->GetCurStates()->m_ColorState->Default(); | |
| 780 } | 778 } |
| 781 if (m_CurrentOffset >= m_Size) { | 779 if (m_CurrentOffset >= m_Size) { |
| 782 m_InternalStage = STAGE_CHECKCLIP; | 780 m_InternalStage = STAGE_CHECKCLIP; |
| 783 } else { | 781 } else { |
| 784 m_CurrentOffset += | 782 m_CurrentOffset += |
| 785 m_pParser->Parse(m_pData + m_CurrentOffset, | 783 m_pParser->Parse(m_pData + m_CurrentOffset, |
| 786 m_Size - m_CurrentOffset, PARSE_STEP_LIMIT); | 784 m_Size - m_CurrentOffset, PARSE_STEP_LIMIT); |
| 787 } | 785 } |
| 788 } | 786 } |
| 789 if (m_InternalStage == STAGE_CHECKCLIP) { | 787 if (m_InternalStage == STAGE_CHECKCLIP) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 807 continue; | 805 continue; |
| 808 if (pObj->m_ClipPath.GetTextCount()) | 806 if (pObj->m_ClipPath.GetTextCount()) |
| 809 continue; | 807 continue; |
| 810 CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0); | 808 CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0); |
| 811 if (!ClipPath.IsRect() || pObj->IsShading()) | 809 if (!ClipPath.IsRect() || pObj->IsShading()) |
| 812 continue; | 810 continue; |
| 813 CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0), | 811 CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0), |
| 814 ClipPath.GetPointX(2), ClipPath.GetPointY(2)); | 812 ClipPath.GetPointX(2), ClipPath.GetPointY(2)); |
| 815 CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right, | 813 CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right, |
| 816 pObj->m_Top); | 814 pObj->m_Top); |
| 817 if (old_rect.Contains(obj_rect)) | 815 if (old_rect.Contains(obj_rect)) { |
| 818 pObj->m_ClipPath.Clear(); | 816 pObj->m_ClipPath.SetNull(); |
| 817 } |
| 819 } | 818 } |
| 820 m_Status = Done; | 819 m_Status = Done; |
| 821 return; | 820 return; |
| 822 } | 821 } |
| 823 steps++; | 822 steps++; |
| 824 if (pPause && pPause->NeedToPauseNow()) { | 823 if (pPause && pPause->NeedToPauseNow()) { |
| 825 break; | 824 break; |
| 826 } | 825 } |
| 827 } | 826 } |
| 828 } | 827 } |
| OLD | NEW |