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

Unified Diff: fpdfsdk/fxedit/fxet_edit.cpp

Issue 2594153003: Remove CFX_ArrayTemplate, use unique_ptr in fpdfsdk/pdfwindow (Closed)
Patch Set: Fix compilation Created 3 years, 11 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/fxedit/fxet_edit.h ('k') | fpdfsdk/pdfwindow/PWL_Edit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fxedit/fxet_edit.cpp
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index ececa0b9a3c09904ba60f273fb8df0f574ce5e11..aa77e9fa5b0ee82dee6a275de3275a87f0cbe33a 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -936,65 +936,60 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
}
// static
-void CFX_Edit::GeneratePageObjects(
- CPDF_PageObjectHolder* pObjectHolder,
- CFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange,
- FX_COLORREF crText,
- CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
- FX_FLOAT fFontSize = pEdit->GetFontSize();
+void CFX_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder,
+ CFX_Edit* pEdit,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange,
+ FX_COLORREF crText,
+ std::vector<CPDF_TextObject*>* ObjArray) {
+ ObjArray->clear();
+
+ IPVT_FontMap* pFontMap = pEdit->GetFontMap();
+ if (!pFontMap)
+ return;
+ FX_FLOAT fFontSize = pEdit->GetFontSize();
int32_t nOldFontIndex = -1;
-
CFX_ByteTextBuf sTextBuf;
+ CPVT_WordPlace oldplace;
CFX_FloatPoint ptBT(0.0f, 0.0f);
-
- ObjArray.RemoveAll();
-
CFX_Edit_Iterator* pIterator = pEdit->GetIterator();
- if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
-
- CPVT_WordPlace oldplace;
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
- break;
-
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- if (place.LineCmp(oldplace) != 0 || nOldFontIndex != word.nFontIndex) {
- if (sTextBuf.GetLength() > 0) {
- ObjArray.Add(AddTextObjToPageObjects(
- pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
- fFontSize, 0.0f, 100,
- CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- sTextBuf.MakeString()));
-
- sTextBuf.Clear();
- }
+ if (pRange)
+ pIterator->SetAt(pRange->BeginPos);
+ else
+ pIterator->SetAt(0);
- ptBT = word.ptWord;
- nOldFontIndex = word.nFontIndex;
- }
+ while (pIterator->NextWord()) {
+ CPVT_WordPlace place = pIterator->GetAt();
+ if (pRange && place.WordCmp(pRange->EndPos) > 0)
+ break;
- sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0)
- .AsStringC();
- oldplace = place;
+ CPVT_Word word;
+ if (!pIterator->GetWord(word))
+ continue;
+
+ if (place.LineCmp(oldplace) != 0 || nOldFontIndex != word.nFontIndex) {
+ if (sTextBuf.GetLength() > 0) {
+ ObjArray->push_back(AddTextObjToPageObjects(
+ pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
+ fFontSize, 0.0f, 100,
+ CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
+ sTextBuf.MakeString()));
+
+ sTextBuf.Clear();
}
+ ptBT = word.ptWord;
+ nOldFontIndex = word.nFontIndex;
}
-
- if (sTextBuf.GetLength() > 0) {
- ObjArray.Add(AddTextObjToPageObjects(
- pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize,
- 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- sTextBuf.MakeString()));
- }
+ sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0)
+ .AsStringC();
+ oldplace = place;
+ }
+ if (sTextBuf.GetLength() > 0) {
+ ObjArray->push_back(AddTextObjToPageObjects(
+ pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize,
+ 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
+ sTextBuf.MakeString()));
}
}
« no previous file with comments | « fpdfsdk/fxedit/fxet_edit.h ('k') | fpdfsdk/pdfwindow/PWL_Edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698