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

Side by Side Diff: core/src/reflow/layoutprocessor_reflow.cpp

Issue 1084613006: Fix all remaining instances of FX_NEW. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: std::min Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « core/src/reflow/autoreflow.cpp ('k') | core/src/reflow/layoutprovider_taggedpdf.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/reflow/reflowengine.h" 7 #include "../../include/reflow/reflowengine.h"
8 #include "reflowedpage.h" 8 #include "reflowedpage.h"
9 #include "layoutprovider_taggedpdf.h" 9 #include "layoutprovider_taggedpdf.h"
10 IPDF_LayoutProcessor* IPDF_LayoutProcessor::Create_LayoutProcessor_Reflow(FX_FLO AT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, void* pReflowedPage, int flags, FX_FLOAT lineSpace ) 10 IPDF_LayoutProcessor* IPDF_LayoutProcessor::Create_LayoutProcessor_Reflow(FX_FLO AT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, void* pReflowedPage, int flags, FX_FLOAT lineSpace )
11 { 11 {
12 if(pReflowedPage == NULL || fWidth <= 20) { 12 if(pReflowedPage == NULL || fWidth <= 20) {
13 return NULL; 13 return NULL;
14 } 14 }
15 CPDF_LayoutProcessor_Reflow* pReflowEngine = FX_NEW CPDF_LayoutProcessor_Ref low(); 15 CPDF_LayoutProcessor_Reflow* pReflowEngine = new CPDF_LayoutProcessor_Reflow ();
16 if (NULL == pReflowEngine) {
17 return NULL;
18 }
19 pReflowEngine->Init(TopIndent, fWidth, fHeight, (CPDF_ReflowedPage*)pReflowe dPage, flags, lineSpace); 16 pReflowEngine->Init(TopIndent, fWidth, fHeight, (CPDF_ReflowedPage*)pReflowe dPage, flags, lineSpace);
20 return pReflowEngine; 17 return pReflowEngine;
21 } 18 }
22 CPDF_LayoutProcessor_Reflow::CPDF_LayoutProcessor_Reflow() 19 CPDF_LayoutProcessor_Reflow::CPDF_LayoutProcessor_Reflow()
23 { 20 {
24 m_pPause = NULL; 21 m_pPause = NULL;
25 m_pLayoutElement = NULL; 22 m_pLayoutElement = NULL;
26 m_fRefWidth = 0; 23 m_fRefWidth = 0;
27 m_fRefWidth = 0; 24 m_fRefWidth = 0;
28 m_fCurrLineWidth = 0; 25 m_fCurrLineWidth = 0;
29 m_fCurrLineHeight = 0; 26 m_fCurrLineHeight = 0;
30 m_bIllustration = FALSE; 27 m_bIllustration = FALSE;
31 m_pPreObj = NULL; 28 m_pPreObj = NULL;
32 m_pCurrLine = FX_NEW CRF_DataPtrArray(50); 29 m_pCurrLine = new CRF_DataPtrArray(50);
33 m_pTempLine = FX_NEW CRF_DataPtrArray(50); 30 m_pTempLine = new CRF_DataPtrArray(50);
34 m_StartIndent = 0; 31 m_StartIndent = 0;
35 m_PausePosition = 0; 32 m_PausePosition = 0;
36 } 33 }
37 CPDF_LayoutProcessor_Reflow::~CPDF_LayoutProcessor_Reflow() 34 CPDF_LayoutProcessor_Reflow::~CPDF_LayoutProcessor_Reflow()
38 { 35 {
39 if (m_pCurrLine) { 36 if (m_pCurrLine) {
40 m_pCurrLine->RemoveAll(); 37 m_pCurrLine->RemoveAll();
41 delete m_pCurrLine; 38 delete m_pCurrLine;
42 } 39 }
43 m_pCurrLine = NULL; 40 m_pCurrLine = NULL;
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 547 }
551 } 548 }
552 if(reflowWidth * 2 < width) { 549 if(reflowWidth * 2 < width) {
553 reflowWidth = width; 550 reflowWidth = width;
554 m_StartIndent = 0; 551 m_StartIndent = 0;
555 } 552 }
556 break; 553 break;
557 } 554 }
558 switch(layoutType) { 555 switch(layoutType) {
559 case LayoutTable: { 556 case LayoutTable: {
560 CRF_Table* pTable = FX_NEW CRF_Table; 557 CRF_Table* pTable = new CRF_Table;
561 if (NULL == pTable) {
562 break;
563 }
564 m_TableArray.Add(pTable); 558 m_TableArray.Add(pTable);
565 pTable->m_ReflowPageHeight = m_pReflowedPage->m_PageHeight; 559 pTable->m_ReflowPageHeight = m_pReflowedPage->m_PageHeight;
566 pTable->m_TableWidth = GetElmWidth(pElement); 560 pTable->m_TableWidth = GetElmWidth(pElement);
567 break; 561 break;
568 } 562 }
569 case LayoutTableRow: { 563 case LayoutTableRow: {
570 if(!m_TableArray.GetSize()) { 564 if(!m_TableArray.GetSize()) {
571 break; 565 break;
572 } 566 }
573 int count = pElement->CountChildren(); 567 int count = pElement->CountChildren();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 { 758 {
765 if(!pObj) { 759 if(!pObj) {
766 return; 760 return;
767 } 761 }
768 if(pObj->m_Type == PDFPAGE_TEXT) { 762 if(pObj->m_Type == PDFPAGE_TEXT) {
769 ProcessTextObject( (CPDF_TextObject *)pObj, reflowWidth, objMatrix); 763 ProcessTextObject( (CPDF_TextObject *)pObj, reflowWidth, objMatrix);
770 } else if(pObj->m_Type == PDFPAGE_IMAGE) { 764 } else if(pObj->m_Type == PDFPAGE_IMAGE) {
771 if(!(m_flags & RF_PARSER_IMAGE)) { 765 if(!(m_flags & RF_PARSER_IMAGE)) {
772 return; 766 return;
773 } 767 }
774 CPDF_PageObjects* pObjs = FX_NEW CPDF_PageObjects(FALSE); 768 CPDF_PageObjects* pObjs = new CPDF_PageObjects(FALSE);
775 if (NULL == pObjs) {
776 return;
777 }
778 FX_POSITION pos = pObjs->GetLastObjectPosition(); 769 FX_POSITION pos = pObjs->GetLastObjectPosition();
779 pos = pObjs->InsertObject(pos, pObj); 770 pos = pObjs->InsertObject(pos, pObj);
780 CFX_AffineMatrix matrix; 771 CFX_AffineMatrix matrix;
781 FX_RECT rect = pObj->GetBBox(&matrix); 772 FX_RECT rect = pObj->GetBBox(&matrix);
782 CPDF_ImageObject* ImageObj = (CPDF_ImageObject*)pObj; 773 CPDF_ImageObject* ImageObj = (CPDF_ImageObject*)pObj;
783 ProcessUnitaryObjs(pObjs, reflowWidth, objMatrix); 774 ProcessUnitaryObjs(pObjs, reflowWidth, objMatrix);
784 delete pObjs; 775 delete pObjs;
785 } else if(pObj->m_Type == PDFPAGE_PATH) { 776 } else if(pObj->m_Type == PDFPAGE_PATH) {
786 } else if(pObj->m_Type == PDFPAGE_FORM) { 777 } else if(pObj->m_Type == PDFPAGE_FORM) {
787 CPDF_FormObject* pForm = (CPDF_FormObject*)pObj; 778 CPDF_FormObject* pForm = (CPDF_FormObject*)pObj;
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 } 1542 }
1552 if (m_pTempLine) { 1543 if (m_pTempLine) {
1553 Transform(&tempMatrix, m_pTempLine, 0, m_pTempLine->GetSize()); 1544 Transform(&tempMatrix, m_pTempLine, 0, m_pTempLine->GetSize());
1554 AddTemp2CurrLine(0, m_pTempLine->GetSize()); 1545 AddTemp2CurrLine(0, m_pTempLine->GetSize());
1555 m_pTempLine->RemoveAll(); 1546 m_pTempLine->RemoveAll();
1556 } 1547 }
1557 } 1548 }
1558 void CPDF_LayoutProcessor_Reflow::ProcessPathObject(CPDF_PathObject *pObj, FX_FL OAT reflowWidth) 1549 void CPDF_LayoutProcessor_Reflow::ProcessPathObject(CPDF_PathObject *pObj, FX_FL OAT reflowWidth)
1559 { 1550 {
1560 } 1551 }
OLDNEW
« no previous file with comments | « core/src/reflow/autoreflow.cpp ('k') | core/src/reflow/layoutprovider_taggedpdf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698