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

Side by Side Diff: core/src/reflow/autoreflow.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/fxge/android/fx_android_imp.cpp ('k') | core/src/reflow/layoutprocessor_reflow.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 "autoreflow.h" 7 #include "autoreflow.h"
8 #define approachto(a,b,c) (FXSYS_fabs((float)((a)-(b)))>(c) ? 0 : 1) 8 #define approachto(a,b,c) (FXSYS_fabs((float)((a)-(b)))>(c) ? 0 : 1)
9 int FPDF_ProcessInterObj(const CPDF_PageObject* pPrevObj, const CPDF_PageObject* pObj) 9 int FPDF_ProcessInterObj(const CPDF_PageObject* pPrevObj, const CPDF_PageObject* pObj)
10 { 10 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 pAppraceOrderObjs->GetNextObject(pos1); 93 pAppraceOrderObjs->GetNextObject(pos1);
94 } 94 }
95 break; 95 break;
96 } 96 }
97 } 97 }
98 pAppraceOrderObjs->InsertObject(pos1, pObj); 98 pAppraceOrderObjs->InsertObject(pos1, pObj);
99 } 99 }
100 } 100 }
101 IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_AutoReflow(CPDF_ PageObjects* pPage, FX_BOOL bReadOrder) 101 IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_AutoReflow(CPDF_ PageObjects* pPage, FX_BOOL bReadOrder)
102 { 102 {
103 return FX_NEW CPDF_AutoReflowLayoutProvider(pPage, bReadOrder); 103 return new CPDF_AutoReflowLayoutProvider(pPage, bReadOrder);
104 } 104 }
105 CPDF_AutoReflowElement::CPDF_AutoReflowElement(LayoutType layoutType , CPDF_Auto ReflowElement* pParent) 105 CPDF_AutoReflowElement::CPDF_AutoReflowElement(LayoutType layoutType , CPDF_Auto ReflowElement* pParent)
106 { 106 {
107 m_ElmType = layoutType; 107 m_ElmType = layoutType;
108 m_pParentElm = pParent; 108 m_pParentElm = pParent;
109 if(pParent) { 109 if(pParent) {
110 pParent->m_ChildArray.Add(this); 110 pParent->m_ChildArray.Add(this);
111 } 111 }
112 m_SpaceBefore = 0; 112 m_SpaceBefore = 0;
113 } 113 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 for(i = 0; i < count; i++) { 244 for(i = 0; i < count; i++) {
245 pCell = (CRF_CELL*)m_cellArray.GetAt(i); 245 pCell = (CRF_CELL*)m_cellArray.GetAt(i);
246 if(!pCell) { 246 if(!pCell) {
247 continue; 247 continue;
248 } 248 }
249 if(i < count - 1) { 249 if(i < count - 1) {
250 pNextCell = (CRF_CELL*)m_cellArray.GetAt(i + 1); 250 pNextCell = (CRF_CELL*)m_cellArray.GetAt(i + 1);
251 } else { 251 } else {
252 pNextCell = NULL; 252 pNextCell = NULL;
253 } 253 }
254 pCurrElm = NULL; 254 pCurrElm = new CPDF_AutoReflowElement(LayoutParagraph, pParent);
255 pCurrElm = FX_NEW CPDF_AutoReflowElement(LayoutParagraph, pParent);
256 if(pCurrElm->GetType() == LayoutParagraph && plastCell) { 255 if(pCurrElm->GetType() == LayoutParagraph && plastCell) {
257 int SpaceBefore = 0; 256 int SpaceBefore = 0;
258 if(pCell->m_CellWritingMode != plastCell->m_CellWritingMode ) { 257 if(pCell->m_CellWritingMode != plastCell->m_CellWritingMode ) {
259 SpaceBefore = 20; 258 SpaceBefore = 20;
260 } else if(pCell->m_CellWritingMode == WritingMode_LRTB) { 259 } else if(pCell->m_CellWritingMode == WritingMode_LRTB) {
261 SpaceBefore = plastCell->m_BBox.bottom - pCell->m_BBox.top; 260 SpaceBefore = plastCell->m_BBox.bottom - pCell->m_BBox.top;
262 } else if(pCell->m_CellWritingMode == WritingMode_TBRL) { 261 } else if(pCell->m_CellWritingMode == WritingMode_TBRL) {
263 SpaceBefore = plastCell->m_BBox.left - pCell->m_BBox.right; 262 SpaceBefore = plastCell->m_BBox.left - pCell->m_BBox.right;
264 } 263 }
265 if(SpaceBefore > 0) { 264 if(SpaceBefore > 0) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 553 }
555 } 554 }
556 } 555 }
557 } else { 556 } else {
558 m_WritingMode = WritingMode; 557 m_WritingMode = WritingMode;
559 } 558 }
560 } 559 }
561 pPerObj = pObj; 560 pPerObj = pObj;
562 if(bNewLine) { 561 if(bNewLine) {
563 int c = pCell ? pCell->m_ObjList.GetCount() : 0; 562 int c = pCell ? pCell->m_ObjList.GetCount() : 0;
564 pCell = FX_NEW CRF_CELL; 563 pCell = new CRF_CELL;
565 pCell->m_CellWritingMode = m_WritingMode; 564 pCell->m_CellWritingMode = m_WritingMode;
566 pCell->m_BBox = ObjBBox; 565 pCell->m_BBox = ObjBBox;
567 if(pObj->m_Type == PDFPAGE_TEXT) { 566 if(pObj->m_Type == PDFPAGE_TEXT) {
568 FX_FLOAT x = ((CPDF_TextObject*)pObj)->GetPosX(), y = ((CPDF_Tex tObject*)pObj)->GetPosY(); 567 FX_FLOAT x = ((CPDF_TextObject*)pObj)->GetPosX(), y = ((CPDF_Tex tObject*)pObj)->GetPosY();
569 m_PDFDisplayMatrix.Transform(x, y); 568 m_PDFDisplayMatrix.Transform(x, y);
570 if(x < ObjBBox.left) { 569 if(x < ObjBBox.left) {
571 pCell->m_BBox.left = (int)x; 570 pCell->m_BBox.left = (int)x;
572 } 571 }
573 } 572 }
574 pCell->m_ObjList.AddTail(pObj); 573 pCell->m_ObjList.AddTail(pObj);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 return WritingMode_TBRL; 711 return WritingMode_TBRL;
713 } 712 }
714 } 713 }
715 } 714 }
716 } 715 }
717 return WritingMode_UNKNOW; 716 return WritingMode_UNKNOW;
718 } 717 }
719 LayoutStatus CPDF_AutoReflowLayoutProvider::StartLoad(IFX_Pause* pPause) 718 LayoutStatus CPDF_AutoReflowLayoutProvider::StartLoad(IFX_Pause* pPause)
720 { 719 {
721 m_pPause = pPause; 720 m_pPause = pPause;
722 m_pRoot = FX_NEW CPDF_AutoReflowElement(LayoutDocument); 721 m_pRoot = new CPDF_AutoReflowElement(LayoutDocument);
723 if(!m_pRoot) {
724 return LayoutError;
725 }
726 m_Step = 0; 722 m_Step = 0;
727 return Continue(); 723 return Continue();
728 } 724 }
729 LayoutStatus CPDF_AutoReflowLayoutProvider::Continue() 725 LayoutStatus CPDF_AutoReflowLayoutProvider::Continue()
730 { 726 {
731 GenerateStructTree(); 727 GenerateStructTree();
732 return m_Status; 728 return m_Status;
733 } 729 }
734 int CPDF_AutoReflowLayoutProvider::GetPosition() 730 int CPDF_AutoReflowLayoutProvider::GetPosition()
735 { 731 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 pTextObj->GetItemInfo(i + 1, &Item); 768 pTextObj->GetItemInfo(i + 1, &Item);
773 return Item.m_OriginX; 769 return Item.m_OriginX;
774 } 770 }
775 } 771 }
776 return Item.m_OriginX; 772 return Item.m_OriginX;
777 } 773 }
778 CFX_AffineMatrix matrix; 774 CFX_AffineMatrix matrix;
779 FX_RECT rect = pObj->GetBBox(&matrix); 775 FX_RECT rect = pObj->GetBBox(&matrix);
780 return (FX_FLOAT)(rect.Width()); 776 return (FX_FLOAT)(rect.Width());
781 } 777 }
OLDNEW
« no previous file with comments | « core/src/fxge/android/fx_android_imp.cpp ('k') | core/src/reflow/layoutprocessor_reflow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698