| 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 "core/fdrm/crypto/include/fx_crypt.h" | 9 #include "core/fdrm/crypto/include/fx_crypt.h" |
| 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) { | 145 void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) { |
| 146 m_bForceClear = bForceRelease; | 146 m_bForceClear = bForceRelease; |
| 147 | 147 |
| 148 for (auto& it : m_PatternMap) { | 148 for (auto& it : m_PatternMap) { |
| 149 CPDF_CountedPattern* ptData = it.second; | 149 CPDF_CountedPattern* ptData = it.second; |
| 150 if (!ptData->get()) | 150 if (!ptData->get()) |
| 151 continue; | 151 continue; |
| 152 | 152 |
| 153 if (bForceRelease || ptData->use_count() < 2) { | 153 if (bForceRelease || ptData->use_count() < 2) |
| 154 ptData->get()->SetForceClear(bForceRelease); | |
| 155 ptData->clear(); | 154 ptData->clear(); |
| 156 } | |
| 157 } | 155 } |
| 158 | 156 |
| 159 for (auto& it : m_FontMap) { | 157 for (auto& it : m_FontMap) { |
| 160 CPDF_CountedFont* fontData = it.second; | 158 CPDF_CountedFont* fontData = it.second; |
| 161 if (!fontData->get()) | 159 if (!fontData->get()) |
| 162 continue; | 160 continue; |
| 163 | 161 |
| 164 if (bForceRelease || fontData->use_count() < 2) { | 162 if (bForceRelease || fontData->use_count() < 2) { |
| 165 fontData->clear(); | 163 fontData->clear(); |
| 166 } | 164 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 427 } |
| 430 } | 428 } |
| 431 CPDF_Pattern* pPattern = nullptr; | 429 CPDF_Pattern* pPattern = nullptr; |
| 432 if (bShading) { | 430 if (bShading) { |
| 433 pPattern = | 431 pPattern = |
| 434 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); | 432 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); |
| 435 } else { | 433 } else { |
| 436 CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr; | 434 CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr; |
| 437 if (pDict) { | 435 if (pDict) { |
| 438 int type = pDict->GetIntegerBy("PatternType"); | 436 int type = pDict->GetIntegerBy("PatternType"); |
| 439 if (type == 1) { | 437 if (type == CPDF_Pattern::TILING) { |
| 440 pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); | 438 pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); |
| 441 } else if (type == 2) { | 439 } else if (type == CPDF_Pattern::SHADING) { |
| 442 pPattern = | 440 pPattern = |
| 443 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); | 441 new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); |
| 444 } | 442 } |
| 445 } | 443 } |
| 446 } | 444 } |
| 447 if (!pPattern) | 445 if (!pPattern) |
| 448 return nullptr; | 446 return nullptr; |
| 449 | 447 |
| 450 if (!ptData) { | 448 if (!ptData) { |
| 451 ptData = new CPDF_CountedPattern(pPattern); | 449 ptData = new CPDF_CountedPattern(pPattern); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 608 } |
| 611 | 609 |
| 612 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( | 610 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( |
| 613 CPDF_Object* pPatternObj) const { | 611 CPDF_Object* pPatternObj) const { |
| 614 if (!pPatternObj) | 612 if (!pPatternObj) |
| 615 return nullptr; | 613 return nullptr; |
| 616 | 614 |
| 617 auto it = m_PatternMap.find(pPatternObj); | 615 auto it = m_PatternMap.find(pPatternObj); |
| 618 return it != m_PatternMap.end() ? it->second : nullptr; | 616 return it != m_PatternMap.end() ? it->second : nullptr; |
| 619 } | 617 } |
| OLD | NEW |