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/fxedit/fxet_pageobjs.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/fxedit/fxet_pageobjs.cpp')
-rw-r--r-- | fpdfsdk/src/fxedit/fxet_pageobjs.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index d54e4649db..c3bd79759b 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp @@ -409,10 +409,10 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, pDevice->RestoreState(); } -static void AddRectToPageObjects(CPDF_PageObjectHolder* pPageObjs, +static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, FX_COLORREF crFill, const CPDF_Rect& rcFill) { - CPDF_PathObject* pPathObj = new CPDF_PathObject; + std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject); CPDF_PathData* pPathData = pPathObj->m_Path.GetModify(); pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top); @@ -425,12 +425,11 @@ static void AddRectToPageObjects(CPDF_PageObjectHolder* pPageObjs, pPathObj->m_FillType = FXFILL_ALTERNATE; pPathObj->m_bStroke = FALSE; - pPageObjs->GetPageObjectList()->InsertObject( - pPageObjs->GetPageObjectList()->GetTailPosition(), pPathObj); + pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj)); } static CPDF_TextObject* AddTextObjToPageObjects( - CPDF_PageObjectHolder* pPageObjs, + CPDF_PageObjectHolder* pObjectHolder, FX_COLORREF crText, CPDF_Font* pFont, FX_FLOAT fFontSize, @@ -438,8 +437,7 @@ static CPDF_TextObject* AddTextObjToPageObjects( int32_t nHorzScale, const CPDF_Point& point, const CFX_ByteString& text) { - CPDF_TextObject* pTxtObj = new CPDF_TextObject; - + std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetModify(); pTextStateData->m_pFont = pFont; pTextStateData->m_FontSize = fFontSize; @@ -462,14 +460,14 @@ static CPDF_TextObject* AddTextObjToPageObjects( pTxtObj->SetPosition(point.x, point.y); pTxtObj->SetText(text); - pPageObjs->GetPageObjectList()->InsertObject( - pPageObjs->GetPageObjectList()->GetTailPosition(), pTxtObj); - return pTxtObj; + CPDF_TextObject* pRet = pTxtObj.get(); + pObjectHolder->GetPageObjectList()->push_back(std::move(pTxtObj)); + return pRet; } void IFX_Edit::GeneratePageObjects( - CPDF_PageObjectHolder* pPageObjects, + CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, @@ -504,7 +502,7 @@ void IFX_Edit::GeneratePageObjects( nOldFontIndex != word.nFontIndex) { if (sTextBuf.GetLength() > 0) { ObjArray.Add(AddTextObjToPageObjects( - pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), + pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.GetByteString())); @@ -523,7 +521,7 @@ void IFX_Edit::GeneratePageObjects( if (sTextBuf.GetLength() > 0) { ObjArray.Add(AddTextObjToPageObjects( - pPageObjects, crText, pFontMap->GetPDFFont(nOldFontIndex), + pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.GetByteString())); @@ -533,7 +531,7 @@ void IFX_Edit::GeneratePageObjects( } void IFX_Edit::GenerateRichPageObjects( - CPDF_PageObjectHolder* pPageObjects, + CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, @@ -574,7 +572,7 @@ void IFX_Edit::GenerateRichPageObjects( crOld != crCurText) { if (sTextBuf.GetLength() > 0) { ObjArray.Add(AddTextObjToPageObjects( - pPageObjects, crOld, pFontMap->GetPDFFont(wp.nFontIndex), + pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.GetByteString())); @@ -597,7 +595,7 @@ void IFX_Edit::GenerateRichPageObjects( rcUnderline.top += ptOffset.y; rcUnderline.bottom += ptOffset.y; - AddRectToPageObjects(pPageObjects, crCurText, rcUnderline); + AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); } if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) { @@ -607,7 +605,7 @@ void IFX_Edit::GenerateRichPageObjects( rcCrossout.top += ptOffset.y; rcCrossout.bottom += ptOffset.y; - AddRectToPageObjects(pPageObjects, crCurText, rcCrossout); + AddRectToPageObjects(pObjectHolder, crCurText, rcCrossout); } oldplace = place; @@ -616,7 +614,7 @@ void IFX_Edit::GenerateRichPageObjects( if (sTextBuf.GetLength() > 0) { ObjArray.Add(AddTextObjToPageObjects( - pPageObjects, crOld, pFontMap->GetPDFFont(wp.nFontIndex), + pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CPDF_Point(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), sTextBuf.GetByteString())); @@ -625,7 +623,7 @@ void IFX_Edit::GenerateRichPageObjects( } } -void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pPageObjects, +void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, IFX_Edit* pEdit, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, @@ -651,7 +649,7 @@ void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pPageObjects, rcUnderline.right += ptOffset.x; rcUnderline.top += ptOffset.y; rcUnderline.bottom += ptOffset.y; - AddRectToPageObjects(pPageObjects, color, rcUnderline); + AddRectToPageObjects(pObjectHolder, color, rcUnderline); } } } |