diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-17 16:46:26 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-17 16:46:26 -0800 |
commit | 2398d8938277a2492b411f8f807bf1935918ccae (patch) | |
tree | 0f8c13509e23d6a0ea80d461ab803fae62a4638f /fpdfsdk/src/fpdf_flatten.cpp | |
parent | efbc1912f10f5a53e7df3a24ebfd6b78412f0bba (diff) | |
download | pdfium-2398d8938277a2492b411f8f807bf1935918ccae.tar.xz |
Remove CFX_PtrList from renderer main loop.
Exposes an iterator over the object list, but not the object
holder, since pages and forms inherit from object holder, and
we don't want to imply that there's only one thing that might
be iterated over for those classes.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1700183002 .
Diffstat (limited to 'fpdfsdk/src/fpdf_flatten.cpp')
-rw-r--r-- | fpdfsdk/src/fpdf_flatten.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 36b8319dca..9aee35f760 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, |