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

Side by Side Diff: core/src/reflow/reflowedpage.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/layoutprovider_taggedpdf.cpp ('k') | core/src/reflow/reflowedtextpage.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 CPDF_ProgressiveReflowPageParser::CPDF_ProgressiveReflowPageParser() 9 CPDF_ProgressiveReflowPageParser::CPDF_ProgressiveReflowPageParser()
10 { 10 {
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 CPDF_ReflowedPage::CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool) 30 CPDF_ReflowedPage::CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool)
31 { 31 {
32 m_PageWidth = 0; 32 m_PageWidth = 0;
33 m_PageHeight = 0; 33 m_PageHeight = 0;
34 m_bWaiting = TRUE; 34 m_bWaiting = TRUE;
35 if(pMemoryPool) { 35 if(pMemoryPool) {
36 m_pMemoryPool = pMemoryPool; 36 m_pMemoryPool = pMemoryPool;
37 m_bCreateMemoryPool = FALSE; 37 m_bCreateMemoryPool = FALSE;
38 } else { 38 } else {
39 m_pMemoryPool = FX_NEW CFX_GrowOnlyPool; 39 m_pMemoryPool = new CFX_GrowOnlyPool;
40 m_bCreateMemoryPool = TRUE; 40 m_bCreateMemoryPool = TRUE;
41 } 41 }
42 m_pCharState = FX_NEW CRF_CharStateArray(10); 42 m_pCharState = new CRF_CharStateArray(10);
43 m_pReflowed = FX_NEW CRF_DataPtrArray(500); 43 m_pReflowed = new CRF_DataPtrArray(500);
44 m_pPageInfos = NULL; 44 m_pPageInfos = NULL;
45 } 45 }
46 CPDF_ReflowedPage::~CPDF_ReflowedPage() 46 CPDF_ReflowedPage::~CPDF_ReflowedPage()
47 { 47 {
48 if (m_pReflowed) { 48 if (m_pReflowed) {
49 for(int i = 0; i < m_pReflowed->GetSize(); i++) { 49 for(int i = 0; i < m_pReflowed->GetSize(); i++) {
50 CRF_Data* pData = (*m_pReflowed)[i]; 50 CRF_Data* pData = (*m_pReflowed)[i];
51 if(pData->m_Type == CRF_Data::Image) { 51 if(pData->m_Type == CRF_Data::Image) {
52 delete ((CRF_ImageData*)pData)->m_pBitmap; 52 delete ((CRF_ImageData*)pData)->m_pBitmap;
53 } 53 }
(...skipping 18 matching lines...) Expand all
72 if (m_pPageInfos) { 72 if (m_pPageInfos) {
73 ReleasePageObjsMemberShip(); 73 ReleasePageObjsMemberShip();
74 } 74 }
75 } 75 }
76 FX_BOOL CPDF_ReflowedPage::RetainPageObjsMemberShip() 76 FX_BOOL CPDF_ReflowedPage::RetainPageObjsMemberShip()
77 { 77 {
78 if (NULL == m_pPDFPage) { 78 if (NULL == m_pPDFPage) {
79 return FALSE; 79 return FALSE;
80 } 80 }
81 if (NULL == m_pPageInfos) { 81 if (NULL == m_pPageInfos) {
82 m_pPageInfos = FX_NEW CFX_MapPtrToPtr(); 82 m_pPageInfos = new CFX_MapPtrToPtr();
83 } else { 83 } else {
84 return TRUE; 84 return TRUE;
85 } 85 }
86 FX_POSITION pos = m_pPDFPage->GetFirstObjectPosition(); 86 FX_POSITION pos = m_pPDFPage->GetFirstObjectPosition();
87 if (!pos) { 87 if (!pos) {
88 return FALSE; 88 return FALSE;
89 } 89 }
90 CPDF_PageObject* pPageObj = NULL; 90 CPDF_PageObject* pPageObj = NULL;
91 while (pos) { 91 while (pos) {
92 pPageObj = m_pPDFPage->GetNextObject(pos); 92 pPageObj = m_pPDFPage->GetNextObject(pos);
93 MarkPageObjMemberShip(pPageObj, NULL); 93 MarkPageObjMemberShip(pPageObj, NULL);
94 pPageObj = NULL; 94 pPageObj = NULL;
95 } 95 }
96 return TRUE; 96 return TRUE;
97 } 97 }
98 void CPDF_ReflowedPage::MarkPageObjMemberShip(CPDF_PageObject* pObj, CRF_PageInf o* pParent) 98 void CPDF_ReflowedPage::MarkPageObjMemberShip(CPDF_PageObject* pObj, CRF_PageInf o* pParent)
99 { 99 {
100 if (NULL == m_pPageInfos) { 100 if (NULL == m_pPageInfos) {
101 return; 101 return;
102 } 102 }
103 CRF_PageInfo* pPageInfo = FX_NEW CRF_PageInfo(pObj, pParent); 103 CRF_PageInfo* pPageInfo = new CRF_PageInfo(pObj, pParent);
104 if (NULL == pPageInfo) {
105 return;
106 }
107 m_pPageInfos->SetAt(pObj, pPageInfo); 104 m_pPageInfos->SetAt(pObj, pPageInfo);
108 if (PDFPAGE_FORM != pObj->m_Type) { 105 if (PDFPAGE_FORM != pObj->m_Type) {
109 return; 106 return;
110 } 107 }
111 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj; 108 CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj;
112 FX_POSITION pos; 109 FX_POSITION pos;
113 pos = pFormObj->m_pForm->GetFirstObjectPosition(); 110 pos = pFormObj->m_pForm->GetFirstObjectPosition();
114 if (!pos) { 111 if (!pos) {
115 return; 112 return;
116 } 113 }
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if(!pReflowPage || !pDevice || !pMatrix) { 583 if(!pReflowPage || !pDevice || !pMatrix) {
587 m_Status = Failed; 584 m_Status = Failed;
588 return; 585 return;
589 } 586 }
590 m_DitherBits = DitherBits; 587 m_DitherBits = DitherBits;
591 m_Status = Ready; 588 m_Status = Ready;
592 m_CurrNum = 0; 589 m_CurrNum = 0;
593 m_pReflowPage = (CPDF_ReflowedPage*)pReflowPage; 590 m_pReflowPage = (CPDF_ReflowedPage*)pReflowPage;
594 m_pFXDevice = pDevice; 591 m_pFXDevice = pDevice;
595 if(NULL == m_pDisplayMatrix) { 592 if(NULL == m_pDisplayMatrix) {
596 m_pDisplayMatrix = FX_NEW CFX_AffineMatrix; 593 m_pDisplayMatrix = new CFX_AffineMatrix;
597 } 594 }
598 if (m_pDisplayMatrix) { 595 m_pDisplayMatrix->Copy(*pMatrix);
599 m_pDisplayMatrix->Copy(*pMatrix);
600 }
601 m_Status = ToBeContinued; 596 m_Status = ToBeContinued;
602 Display(pPause); 597 Display(pPause);
603 } 598 }
604 void CPDF_ProgressiveReflowPageRender::Continue(IFX_Pause* pPause) 599 void CPDF_ProgressiveReflowPageRender::Continue(IFX_Pause* pPause)
605 { 600 {
606 Display(pPause); 601 Display(pPause);
607 } 602 }
608 void CPDF_ProgressiveReflowPageRender::SetDisplayColor(FX_COLORREF color) 603 void CPDF_ProgressiveReflowPageRender::SetDisplayColor(FX_COLORREF color)
609 { 604 {
610 m_DisplayColor = color; 605 m_DisplayColor = color;
611 } 606 }
612 void CPDF_ProgressiveReflowPageRender::Clear() 607 void CPDF_ProgressiveReflowPageRender::Clear()
613 { 608 {
614 if (m_pDisplayMatrix) { 609 if (m_pDisplayMatrix) {
615 delete m_pDisplayMatrix; 610 delete m_pDisplayMatrix;
616 } 611 }
617 m_pDisplayMatrix = NULL; 612 m_pDisplayMatrix = NULL;
618 m_pReflowPage = NULL; 613 m_pReflowPage = NULL;
619 m_pFXDevice = NULL; 614 m_pFXDevice = NULL;
620 m_CurrNum = 0; 615 m_CurrNum = 0;
621 m_Status = Ready; 616 m_Status = Ready;
622 } 617 }
OLDNEW
« no previous file with comments | « core/src/reflow/layoutprovider_taggedpdf.cpp ('k') | core/src/reflow/reflowedtextpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698