Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: fpdfsdk/src/fpdf_flatten.cpp

Issue 1700183002: Remove CFX_PtrList from renderer main loop. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/include/pdfwindow/PWL_Edit.h ('k') | fpdfsdk/src/fpdfeditpage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdf_flatten.cpp
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 36b8319dcace85d09f5fa6f5750dd8091bca37af..9aee35f7608ebfea531152edef7b1048d0b4e825 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -35,17 +35,14 @@ FX_BOOL IsValiableRect(CPDF_Rect rect, CPDF_Rect rcPage) {
return TRUE;
}
-FX_BOOL GetContentsRect(CPDF_Document* pDoc,
- CPDF_Dictionary* pDict,
- CPDF_RectArray* pRectArray) {
- CPDF_Page* pPDFPage = new CPDF_Page;
+void GetContentsRect(CPDF_Document* pDoc,
+ CPDF_Dictionary* pDict,
+ CPDF_RectArray* pRectArray) {
+ std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page);
pPDFPage->Load(pDoc, pDict, FALSE);
pPDFPage->ParseContent(nullptr);
- FX_POSITION pos = pPDFPage->GetPageObjectList()->GetHeadPosition();
- while (pos) {
- CPDF_PageObject* pPageObject =
- pPDFPage->GetPageObjectList()->GetNextObject(pos);
+ for (auto& pPageObject : *pPDFPage->GetPageObjectList()) {
if (!pPageObject)
continue;
@@ -54,14 +51,9 @@ FX_BOOL GetContentsRect(CPDF_Document* pDoc,
rc.right = pPageObject->m_Right;
rc.bottom = pPageObject->m_Bottom;
rc.top = pPageObject->m_Top;
-
- if (IsValiableRect(rc, pDict->GetRectBy("MediaBox"))) {
+ if (IsValiableRect(rc, pDict->GetRectBy("MediaBox")))
pRectArray->Add(rc);
- }
}
-
- delete pPDFPage;
- return TRUE;
}
void ParserStream(CPDF_Dictionary* pPageDic,
« no previous file with comments | « fpdfsdk/include/pdfwindow/PWL_Edit.h ('k') | fpdfsdk/src/fpdfeditpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698