summaryrefslogtreecommitdiff
path: root/core/src/reflow
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-17 15:15:08 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-17 15:15:08 -0700
commit4cb07c9c9cd5761ce3179d3d7254c1cf0efeafa5 (patch)
tree2549011fbc3d9d6b8415394a5dc6372a2b346b1e /core/src/reflow
parent48606843d54c5f870d69627afedd574b58d65b3e (diff)
downloadpdfium-4cb07c9c9cd5761ce3179d3d7254c1cf0efeafa5.tar.xz
Fix all remaining instances of FX_NEW.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1084613006
Diffstat (limited to 'core/src/reflow')
-rw-r--r--core/src/reflow/autoreflow.cpp12
-rw-r--r--core/src/reflow/layoutprocessor_reflow.cpp19
-rw-r--r--core/src/reflow/layoutprovider_taggedpdf.cpp17
-rw-r--r--core/src/reflow/reflowedpage.cpp19
-rw-r--r--core/src/reflow/reflowedtextpage.cpp19
-rw-r--r--core/src/reflow/reflowengine.cpp10
6 files changed, 28 insertions, 68 deletions
diff --git a/core/src/reflow/autoreflow.cpp b/core/src/reflow/autoreflow.cpp
index 8c37960932..a10175525c 100644
--- a/core/src/reflow/autoreflow.cpp
+++ b/core/src/reflow/autoreflow.cpp
@@ -100,7 +100,7 @@ void CPDF_AutoReflowLayoutProvider::Conver2AppreceOrder(const CPDF_PageObjects*
}
IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_AutoReflow(CPDF_PageObjects* pPage, FX_BOOL bReadOrder)
{
- return FX_NEW CPDF_AutoReflowLayoutProvider(pPage, bReadOrder);
+ return new CPDF_AutoReflowLayoutProvider(pPage, bReadOrder);
}
CPDF_AutoReflowElement::CPDF_AutoReflowElement(LayoutType layoutType , CPDF_AutoReflowElement* pParent)
{
@@ -251,8 +251,7 @@ void CPDF_AutoReflowLayoutProvider::CreateElement()
} else {
pNextCell = NULL;
}
- pCurrElm = NULL;
- pCurrElm = FX_NEW CPDF_AutoReflowElement(LayoutParagraph, pParent);
+ pCurrElm = new CPDF_AutoReflowElement(LayoutParagraph, pParent);
if(pCurrElm->GetType() == LayoutParagraph && plastCell) {
int SpaceBefore = 0;
if(pCell->m_CellWritingMode != plastCell->m_CellWritingMode ) {
@@ -561,7 +560,7 @@ void CPDF_AutoReflowLayoutProvider::GenerateLine(CFX_PtrArray& cellArray)
pPerObj = pObj;
if(bNewLine) {
int c = pCell ? pCell->m_ObjList.GetCount() : 0;
- pCell = FX_NEW CRF_CELL;
+ pCell = new CRF_CELL;
pCell->m_CellWritingMode = m_WritingMode;
pCell->m_BBox = ObjBBox;
if(pObj->m_Type == PDFPAGE_TEXT) {
@@ -719,10 +718,7 @@ int CPDF_AutoReflowLayoutProvider::GetWritingMode(CPDF_PageObject* pPreObj, CPDF
LayoutStatus CPDF_AutoReflowLayoutProvider::StartLoad(IFX_Pause* pPause)
{
m_pPause = pPause;
- m_pRoot = FX_NEW CPDF_AutoReflowElement(LayoutDocument);
- if(!m_pRoot) {
- return LayoutError;
- }
+ m_pRoot = new CPDF_AutoReflowElement(LayoutDocument);
m_Step = 0;
return Continue();
}
diff --git a/core/src/reflow/layoutprocessor_reflow.cpp b/core/src/reflow/layoutprocessor_reflow.cpp
index d2fa7e9371..218d301f0f 100644
--- a/core/src/reflow/layoutprocessor_reflow.cpp
+++ b/core/src/reflow/layoutprocessor_reflow.cpp
@@ -12,10 +12,7 @@ IPDF_LayoutProcessor* IPDF_LayoutProcessor::Create_LayoutProcessor_Reflow(FX_FLO
if(pReflowedPage == NULL || fWidth <= 20) {
return NULL;
}
- CPDF_LayoutProcessor_Reflow* pReflowEngine = FX_NEW CPDF_LayoutProcessor_Reflow();
- if (NULL == pReflowEngine) {
- return NULL;
- }
+ CPDF_LayoutProcessor_Reflow* pReflowEngine = new CPDF_LayoutProcessor_Reflow();
pReflowEngine->Init(TopIndent, fWidth, fHeight, (CPDF_ReflowedPage*)pReflowedPage, flags, lineSpace);
return pReflowEngine;
}
@@ -29,8 +26,8 @@ CPDF_LayoutProcessor_Reflow::CPDF_LayoutProcessor_Reflow()
m_fCurrLineHeight = 0;
m_bIllustration = FALSE;
m_pPreObj = NULL;
- m_pCurrLine = FX_NEW CRF_DataPtrArray(50);
- m_pTempLine = FX_NEW CRF_DataPtrArray(50);
+ m_pCurrLine = new CRF_DataPtrArray(50);
+ m_pTempLine = new CRF_DataPtrArray(50);
m_StartIndent = 0;
m_PausePosition = 0;
}
@@ -557,10 +554,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F
}
switch(layoutType) {
case LayoutTable: {
- CRF_Table* pTable = FX_NEW CRF_Table;
- if (NULL == pTable) {
- break;
- }
+ CRF_Table* pTable = new CRF_Table;
m_TableArray.Add(pTable);
pTable->m_ReflowPageHeight = m_pReflowedPage->m_PageHeight;
pTable->m_TableWidth = GetElmWidth(pElement);
@@ -771,10 +765,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessObject(CPDF_PageObject* pObj, FX_FLOAT
if(!(m_flags & RF_PARSER_IMAGE)) {
return;
}
- CPDF_PageObjects* pObjs = FX_NEW CPDF_PageObjects(FALSE);
- if (NULL == pObjs) {
- return;
- }
+ CPDF_PageObjects* pObjs = new CPDF_PageObjects(FALSE);
FX_POSITION pos = pObjs->GetLastObjectPosition();
pos = pObjs->InsertObject(pos, pObj);
CFX_AffineMatrix matrix;
diff --git a/core/src/reflow/layoutprovider_taggedpdf.cpp b/core/src/reflow/layoutprovider_taggedpdf.cpp
index c40c1cdb64..4a5a22bd61 100644
--- a/core/src/reflow/layoutprovider_taggedpdf.cpp
+++ b/core/src/reflow/layoutprovider_taggedpdf.cpp
@@ -636,10 +636,7 @@ IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_TaggedPDF(CPDF_P
if(pPage == NULL) {
return NULL;
}
- CPDF_LayoutProvider_TaggedPDF* pProvider = FX_NEW CPDF_LayoutProvider_TaggedPDF;
- if (!pProvider) {
- return NULL;
- }
+ CPDF_LayoutProvider_TaggedPDF* pProvider = new CPDF_LayoutProvider_TaggedPDF;
pProvider->Init(pPage);
return pProvider;
}
@@ -672,11 +669,7 @@ void CPDF_LayoutProvider_TaggedPDF::ProcessElement(CPDF_LayoutElement*pParent, C
m_Status = LayoutError;
return;
}
- CPDF_LayoutElement* pElement = FX_NEW CPDF_LayoutElement;
- if (!pElement) {
- m_Status = LayoutError;
- return;
- }
+ CPDF_LayoutElement* pElement = new CPDF_LayoutElement;
pElement->m_pParentElement = pParent;
pElement->m_pTaggedElement = pTaggedElement;
pParent->m_ChildArray.Add(pElement);
@@ -729,11 +722,7 @@ LayoutStatus CPDF_LayoutProvider_TaggedPDF::StartLoad(IFX_Pause* pPause)
m_Status = LayoutError;
return LayoutError;
}
- m_pRoot = FX_NEW CPDF_LayoutElement;
- if (!m_pRoot) {
- m_Status = LayoutError;
- return LayoutError;
- }
+ m_pRoot = new CPDF_LayoutElement;
for(int i = 0; i < count; i++) {
CPDF_StructElement* pElement = m_pPageTree->GetTopElement(i);
if(pElement) {
diff --git a/core/src/reflow/reflowedpage.cpp b/core/src/reflow/reflowedpage.cpp
index 11baef8718..ba2667f074 100644
--- a/core/src/reflow/reflowedpage.cpp
+++ b/core/src/reflow/reflowedpage.cpp
@@ -36,11 +36,11 @@ CPDF_ReflowedPage::CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool)
m_pMemoryPool = pMemoryPool;
m_bCreateMemoryPool = FALSE;
} else {
- m_pMemoryPool = FX_NEW CFX_GrowOnlyPool;
+ m_pMemoryPool = new CFX_GrowOnlyPool;
m_bCreateMemoryPool = TRUE;
}
- m_pCharState = FX_NEW CRF_CharStateArray(10);
- m_pReflowed = FX_NEW CRF_DataPtrArray(500);
+ m_pCharState = new CRF_CharStateArray(10);
+ m_pReflowed = new CRF_DataPtrArray(500);
m_pPageInfos = NULL;
}
CPDF_ReflowedPage::~CPDF_ReflowedPage()
@@ -79,7 +79,7 @@ FX_BOOL CPDF_ReflowedPage::RetainPageObjsMemberShip()
return FALSE;
}
if (NULL == m_pPageInfos) {
- m_pPageInfos = FX_NEW CFX_MapPtrToPtr();
+ m_pPageInfos = new CFX_MapPtrToPtr();
} else {
return TRUE;
}
@@ -100,10 +100,7 @@ void CPDF_ReflowedPage::MarkPageObjMemberShip(CPDF_PageObject* pObj, CRF_PageInf
if (NULL == m_pPageInfos) {
return;
}
- CRF_PageInfo* pPageInfo = FX_NEW CRF_PageInfo(pObj, pParent);
- if (NULL == pPageInfo) {
- return;
- }
+ CRF_PageInfo* pPageInfo = new CRF_PageInfo(pObj, pParent);
m_pPageInfos->SetAt(pObj, pPageInfo);
if (PDFPAGE_FORM != pObj->m_Type) {
return;
@@ -593,11 +590,9 @@ void CPDF_ProgressiveReflowPageRender::Start(IPDF_ReflowedPage* pReflowPage, CFX
m_pReflowPage = (CPDF_ReflowedPage*)pReflowPage;
m_pFXDevice = pDevice;
if(NULL == m_pDisplayMatrix) {
- m_pDisplayMatrix = FX_NEW CFX_AffineMatrix;
- }
- if (m_pDisplayMatrix) {
- m_pDisplayMatrix->Copy(*pMatrix);
+ m_pDisplayMatrix = new CFX_AffineMatrix;
}
+ m_pDisplayMatrix->Copy(*pMatrix);
m_Status = ToBeContinued;
Display(pPause);
}
diff --git a/core/src/reflow/reflowedtextpage.cpp b/core/src/reflow/reflowedtextpage.cpp
index a5ad0be948..0844f780b6 100644
--- a/core/src/reflow/reflowedtextpage.cpp
+++ b/core/src/reflow/reflowedtextpage.cpp
@@ -4,10 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <algorithm>
+
#include "reflowedtextpage.h"
+
IPDF_TextPage* IPDF_TextPage::CreateReflowTextPage(IPDF_ReflowedPage* pRefPage)
{
- return FX_NEW CRF_TextPage(pRefPage);
+ return new CRF_TextPage(pRefPage);
}
CRF_TextPage::CRF_TextPage(IPDF_ReflowedPage* pRefPage)
{
@@ -32,24 +35,14 @@ FX_BOOL CRF_TextPage::ParseTextPage()
return FALSE;
}
int count = m_pRefPage->m_pReflowed->GetSize();
- if(count < 500) {
- m_pDataList = FX_NEW CRF_CharDataPtrArray(count);
- } else {
- m_pDataList = FX_NEW CRF_CharDataPtrArray(500);
- }
- if (NULL == m_pDataList) {
- return FALSE;
- }
+ m_pDataList = new CRF_CharDataPtrArray(std::min(count, 500));
for(int i = 0; i < count; i++) {
CRF_Data* pData = (*(m_pRefPage->m_pReflowed))[i];
if(pData->GetType() == CRF_Data::Text) {
m_pDataList->Add((CRF_CharData*)pData);
}
}
- m_CountBSArray = FX_NEW CFX_CountBSINT32Array(20);
- if(NULL == m_CountBSArray) {
- return FALSE;
- }
+ m_CountBSArray = new CFX_CountBSINT32Array(20);
return TRUE;
}
FX_BOOL CRF_TextPage::IsParsered() const
diff --git a/core/src/reflow/reflowengine.cpp b/core/src/reflow/reflowengine.cpp
index 11007c904b..7f766caefb 100644
--- a/core/src/reflow/reflowengine.cpp
+++ b/core/src/reflow/reflowengine.cpp
@@ -8,8 +8,7 @@
#include "reflowedpage.h"
IPDF_ReflowedPage* IPDF_ReflowedPage::Create()
{
- CPDF_ReflowedPage* pRefPage = FX_NEW CPDF_ReflowedPage(NULL);
- return pRefPage;
+ return new CPDF_ReflowedPage(NULL);
}
IPDF_ReflowedPage* Create_ReflowPage()
{
@@ -21,10 +20,7 @@ IPDF_ProgressiveReflowPageParser* Create_ReflowPageParser()
}
IPDF_ProgressiveReflowPageParser* IPDF_ProgressiveReflowPageParser::Create()
{
- CPDF_ProgressiveReflowPageParser* pParser = FX_NEW CPDF_ProgressiveReflowPageParser;
- if (NULL == pParser) {
- return NULL;
- }
+ CPDF_ProgressiveReflowPageParser* pParser = new CPDF_ProgressiveReflowPageParser;
pParser->Init();
return pParser;
}
@@ -34,5 +30,5 @@ IPDF_ProgressiveReflowPageRender* Create_ReflowPageRender()
}
IPDF_ProgressiveReflowPageRender* IPDF_ProgressiveReflowPageRender::Create()
{
- return FX_NEW CPDF_ProgressiveReflowPageRender;
+ return new CPDF_ProgressiveReflowPageRender;
}