Chromium Code Reviews| 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/fdrm/fx_crypt.h" | 9 #include "../../../include/fdrm/fx_crypt.h" |
| 10 #include "../fpdf_font/font_int.h" | 10 #include "../fpdf_font/font_int.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 m_ImageMap.GetNextAssoc(pos, objNum, imageData); | 185 m_ImageMap.GetNextAssoc(pos, objNum, imageData); |
| 186 nCount = imageData->m_nCount; | 186 nCount = imageData->m_nCount; |
| 187 if (bRelease || nCount < 2) { | 187 if (bRelease || nCount < 2) { |
| 188 delete imageData->m_Obj; | 188 delete imageData->m_Obj; |
| 189 delete imageData; | 189 delete imageData; |
| 190 m_ImageMap.RemoveKey(objNum); | 190 m_ImageMap.RemoveKey(objNum); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 { | 194 { |
| 195 pos = m_ColorSpaceMap.GetStartPosition(); | 195 FX_POSITION pos_start = m_ColorSpaceMap.GetStartPosition(); |
|
Tom Sepez
2014/08/15 18:54:44
nit: I'd unroll the loop rather than trying to be
| |
| 196 while (pos) { | 196 for (int releaseLoop = 0; releaseLoop < 2; releaseLoop++){ |
| 197 CPDF_Object* csKey; | 197 pos = pos_start; |
| 198 CPDF_CountedObject<CPDF_ColorSpace*>* csData; | 198 while (pos) { |
| 199 m_ColorSpaceMap.GetNextAssoc(pos, csKey, csData); | 199 CPDF_Object* csKey; |
| 200 nCount = csData->m_nCount; | 200 CPDF_CountedObject<CPDF_ColorSpace*>* csData; |
| 201 if (bRelease || nCount < 2) { | 201 m_ColorSpaceMap.GetNextAssoc(pos, csKey, csData); |
| 202 csData->m_Obj->ReleaseCS(); | 202 nCount = csData->m_nCount; |
| 203 csData->m_Obj = NULL; | 203 if ((bRelease || nCount < 2) && csData->m_Obj) { |
|
Tom Sepez
2014/08/15 18:58:48
What about csData's that dont have an m_Obj? Look
| |
| 204 int CS_Family = csData->m_Obj->GetFamily(); | |
| 205 if ((releaseLoop == 0 && CS_Family == PDFCS_INDEXED) || (rel easeLoop == 1 && CS_Family != PDFCS_INDEXED)) { | |
| 206 csData->m_Obj->ReleaseCS(); | |
| 207 csData->m_Obj = NULL; | |
| 208 } | |
| 209 } | |
| 204 } | 210 } |
| 205 } | 211 } |
| 206 } | 212 } |
| 207 { | 213 { |
| 208 pos = m_IccProfileMap.GetStartPosition(); | 214 pos = m_IccProfileMap.GetStartPosition(); |
| 209 while (pos) { | 215 while (pos) { |
| 210 CPDF_Stream* ipKey; | 216 CPDF_Stream* ipKey; |
| 211 CPDF_CountedObject<CPDF_IccProfile*>* ipData; | 217 CPDF_CountedObject<CPDF_IccProfile*>* ipData; |
| 212 m_IccProfileMap.GetNextAssoc(pos, ipKey, ipData); | 218 m_IccProfileMap.GetNextAssoc(pos, ipKey, ipData); |
| 213 nCount = ipData->m_nCount; | 219 nCount = ipData->m_nCount; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 m_FontFileMap.SetAt(pFontStream, ftData); | 643 m_FontFileMap.SetAt(pFontStream, ftData); |
| 638 return pFontFile; | 644 return pFontFile; |
| 639 } | 645 } |
| 640 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce) | 646 void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO L bForce) |
| 641 { | 647 { |
| 642 if (!pFontStream) { | 648 if (!pFontStream) { |
| 643 return; | 649 return; |
| 644 } | 650 } |
| 645 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce); | 651 PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontS tream, NULL, bForce); |
| 646 } | 652 } |
| OLD | NEW |