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/fpdfeditpage.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/fpdfeditpage.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfeditpage.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 6d39cb100f..6c14079131 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.cpp @@ -8,6 +8,7 @@ #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" +#include "third_party/base/stl_util.h" #ifdef PDF_ENABLE_XFA #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" @@ -135,9 +136,10 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj; if (!pPageObj) return; - FX_POSITION LastPersition = pPage->GetPageObjectList()->GetTailPosition(); - pPage->GetPageObjectList()->InsertObject(LastPersition, pPageObj); + pPage->GetPageObjectList()->push_back( + std::unique_ptr<CPDF_PageObject>(pPageObj)); + switch (pPageObj->m_Type) { case FPDF_PAGEOBJ_PATH: { CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; @@ -145,8 +147,6 @@ DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page, break; } case FPDF_PAGEOBJ_TEXT: { - // CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; - // pPathObj->CalcBoundingBox(); break; } case FPDF_PAGEOBJ_IMAGE: { @@ -177,7 +177,7 @@ DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { "Page")) { return -1; } - return pPage->GetPageObjectList()->GetCount(); + return pdfium::CollectionSize<int>(*pPage->GetPageObjectList()); } DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, @@ -186,9 +186,9 @@ DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( "Page")) { - return NULL; + return nullptr; } - return pPage->GetPageObjectList()->GetObjectByIndex(index); + return pPage->GetPageObjectList()->GetPageObjectByIndex(index); } DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { |