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

Side by Side Diff: fpdfsdk/fpdf_flatten.cpp

Issue 2066043002: Simplify CPDF_TextPage::FindTextlineFlowOrientation(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: less loops Created 4 years, 6 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/fpdftext/fpdf_text_int.cpp ('k') | no next file » | 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 "public/fpdf_flatten.h" 7 #include "public/fpdf_flatten.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 return TRUE; 42 return TRUE;
43 } 43 }
44 44
45 void GetContentsRect(CPDF_Document* pDoc, 45 void GetContentsRect(CPDF_Document* pDoc,
46 CPDF_Dictionary* pDict, 46 CPDF_Dictionary* pDict,
47 CPDF_RectArray* pRectArray) { 47 CPDF_RectArray* pRectArray) {
48 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false)); 48 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false));
49 pPDFPage->ParseContent(); 49 pPDFPage->ParseContent();
50 50
51 for (auto& pPageObject : *pPDFPage->GetPageObjectList()) { 51 for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) {
52 if (!pPageObject)
53 continue;
54
55 CFX_FloatRect rc; 52 CFX_FloatRect rc;
56 rc.left = pPageObject->m_Left; 53 rc.left = pPageObject->m_Left;
57 rc.right = pPageObject->m_Right; 54 rc.right = pPageObject->m_Right;
58 rc.bottom = pPageObject->m_Bottom; 55 rc.bottom = pPageObject->m_Bottom;
59 rc.top = pPageObject->m_Top; 56 rc.top = pPageObject->m_Top;
60 if (IsValiableRect(rc, pDict->GetRectBy("MediaBox"))) 57 if (IsValiableRect(rc, pDict->GetRectBy("MediaBox")))
61 pRectArray->Add(rc); 58 pRectArray->Add(rc);
62 } 59 }
63 } 60 }
64 61
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 sStream += sTemp; 507 sStream += sTemp;
511 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength(), FALSE, FALSE); 508 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength(), FALSE, FALSE);
512 } 509 }
513 pPageDict->RemoveAt("Annots"); 510 pPageDict->RemoveAt("Annots");
514 511
515 ObjectArray.RemoveAll(); 512 ObjectArray.RemoveAll();
516 RectArray.RemoveAll(); 513 RectArray.RemoveAll();
517 514
518 return FLATTEN_SUCCESS; 515 return FLATTEN_SUCCESS;
519 } 516 }
OLDNEW
« no previous file with comments | « core/fpdftext/fpdf_text_int.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698