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

Side by Side Diff: fpdfsdk/fpdf_flatten.cpp

Issue 2453683011: Remove FX_BOOL from fpdfsdk. (Closed)
Patch Set: Regenerate patch after rebase. Created 4 years, 1 month 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 | « fpdfsdk/fpdf_ext.cpp ('k') | fpdfsdk/fpdf_progressive.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 "public/fpdf_flatten.h" 7 #include "public/fpdf_flatten.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fpdfapi/page/cpdf_page.h" 11 #include "core/fpdfapi/page/cpdf_page.h"
12 #include "core/fpdfapi/page/cpdf_pageobject.h" 12 #include "core/fpdfapi/page/cpdf_pageobject.h"
13 #include "core/fpdfapi/parser/cpdf_array.h" 13 #include "core/fpdfapi/parser/cpdf_array.h"
14 #include "core/fpdfapi/parser/cpdf_document.h" 14 #include "core/fpdfapi/parser/cpdf_document.h"
15 #include "core/fpdfapi/parser/cpdf_number.h" 15 #include "core/fpdfapi/parser/cpdf_number.h"
16 #include "core/fpdfapi/parser/cpdf_stream.h" 16 #include "core/fpdfapi/parser/cpdf_stream.h"
17 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 17 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
18 #include "core/fpdfdoc/cpdf_annot.h" 18 #include "core/fpdfdoc/cpdf_annot.h"
19 #include "fpdfsdk/fsdk_define.h" 19 #include "fpdfsdk/fsdk_define.h"
20 #include "third_party/base/stl_util.h" 20 #include "third_party/base/stl_util.h"
21 21
22 typedef CFX_ArrayTemplate<CFX_FloatRect> CPDF_RectArray; 22 typedef CFX_ArrayTemplate<CFX_FloatRect> CPDF_RectArray;
23 23
24 enum FPDF_TYPE { MAX, MIN }; 24 enum FPDF_TYPE { MAX, MIN };
25 enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM }; 25 enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM };
26 26
27 namespace { 27 namespace {
28 28
29 FX_BOOL IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) { 29 bool IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) {
30 if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f) 30 if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f)
31 return FALSE; 31 return false;
32 32
33 if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f && 33 if (rect.left == 0.0f && rect.top == 0.0f && rect.right == 0.0f &&
34 rect.bottom == 0.0f) 34 rect.bottom == 0.0f)
35 return FALSE; 35 return false;
36 36
37 if (!rcPage.IsEmpty()) { 37 if (!rcPage.IsEmpty()) {
38 if (rect.left - rcPage.left < -10.000001f || 38 if (rect.left - rcPage.left < -10.000001f ||
39 rect.right - rcPage.right > 10.000001f || 39 rect.right - rcPage.right > 10.000001f ||
40 rect.top - rcPage.top > 10.000001f || 40 rect.top - rcPage.top > 10.000001f ||
41 rect.bottom - rcPage.bottom < -10.000001f) 41 rect.bottom - rcPage.bottom < -10.000001f)
42 return FALSE; 42 return false;
43 } 43 }
44 44
45 return TRUE; 45 return true;
46 } 46 }
47 47
48 void GetContentsRect(CPDF_Document* pDoc, 48 void GetContentsRect(CPDF_Document* pDoc,
49 CPDF_Dictionary* pDict, 49 CPDF_Dictionary* pDict,
50 CPDF_RectArray* pRectArray) { 50 CPDF_RectArray* pRectArray) {
51 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false)); 51 std::unique_ptr<CPDF_Page> pPDFPage(new CPDF_Page(pDoc, pDict, false));
52 pPDFPage->ParseContent(); 52 pPDFPage->ParseContent();
53 53
54 for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) { 54 for (const auto& pPageObject : *pPDFPage->GetPageObjectList()) {
55 CFX_FloatRect rc; 55 CFX_FloatRect rc;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, 449 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
450 sFormName.c_str()); 450 sFormName.c_str());
451 sStream += sTemp; 451 sStream += sTemp;
452 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength()); 452 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength());
453 } 453 }
454 pPageDict->RemoveFor("Annots"); 454 pPageDict->RemoveFor("Annots");
455 455
456 RectArray.RemoveAll(); 456 RectArray.RemoveAll();
457 return FLATTEN_SUCCESS; 457 return FLATTEN_SUCCESS;
458 } 458 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_ext.cpp ('k') | fpdfsdk/fpdf_progressive.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698