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

Side by Side Diff: fpdfsdk/fpdf_transformpage.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_sysfontinfo.cpp ('k') | fpdfsdk/fpdfdoc.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_transformpage.h" 7 #include "public/fpdf_transformpage.h"
8 8
9 #include "core/fpdfapi/page/cpdf_clippath.h" 9 #include "core/fpdfapi/page/cpdf_clippath.h"
10 #include "core/fpdfapi/page/cpdf_page.h" 10 #include "core/fpdfapi/page/cpdf_page.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 float* top) { 93 float* top) {
94 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 94 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
95 return pPage && GetBoundingBox(pPage, "CropBox", left, bottom, right, top); 95 return pPage && GetBoundingBox(pPage, "CropBox", left, bottom, right, top);
96 } 96 }
97 97
98 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, 98 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
99 FS_MATRIX* matrix, 99 FS_MATRIX* matrix,
100 FS_RECTF* clipRect) { 100 FS_RECTF* clipRect) {
101 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 101 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
102 if (!pPage) 102 if (!pPage)
103 return FALSE; 103 return false;
104 104
105 CFX_ByteTextBuf textBuf; 105 CFX_ByteTextBuf textBuf;
106 textBuf << "q "; 106 textBuf << "q ";
107 CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right, 107 CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right,
108 clipRect->top); 108 clipRect->top);
109 rect.Normalize(); 109 rect.Normalize();
110 CFX_ByteString bsClipping; 110 CFX_ByteString bsClipping;
111 bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom, 111 bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom,
112 rect.Width(), rect.Height()); 112 rect.Width(), rect.Height());
113 textBuf << bsClipping; 113 textBuf << bsClipping;
114 114
115 CFX_ByteString bsMatix; 115 CFX_ByteString bsMatix;
116 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c, 116 bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c,
117 matrix->d, matrix->e, matrix->f); 117 matrix->d, matrix->e, matrix->f);
118 textBuf << bsMatix; 118 textBuf << bsMatix;
119 119
120 CPDF_Dictionary* pPageDic = pPage->m_pFormDict; 120 CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
121 CPDF_Object* pContentObj = 121 CPDF_Object* pContentObj =
122 pPageDic ? pPageDic->GetObjectFor("Contents") : nullptr; 122 pPageDic ? pPageDic->GetObjectFor("Contents") : nullptr;
123 if (!pContentObj) 123 if (!pContentObj)
124 pContentObj = pPageDic ? pPageDic->GetArrayFor("Contents") : nullptr; 124 pContentObj = pPageDic ? pPageDic->GetArrayFor("Contents") : nullptr;
125 if (!pContentObj) 125 if (!pContentObj)
126 return FALSE; 126 return false;
127 127
128 CPDF_Document* pDoc = pPage->m_pDocument; 128 CPDF_Document* pDoc = pPage->m_pDocument;
129 if (!pDoc) 129 if (!pDoc)
130 return FALSE; 130 return false;
131 131
132 CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool()); 132 CPDF_Dictionary* pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
133 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic); 133 CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, pDic);
134 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize()); 134 pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize());
135 pDoc->AddIndirectObject(pStream); 135 pDoc->AddIndirectObject(pStream);
136 pDic = new CPDF_Dictionary(pDoc->GetByteStringPool()); 136 pDic = new CPDF_Dictionary(pDoc->GetByteStringPool());
137 137
138 CPDF_Stream* pEndStream = new CPDF_Stream(nullptr, 0, pDic); 138 CPDF_Stream* pEndStream = new CPDF_Stream(nullptr, 0, pDic);
139 pEndStream->SetData((const uint8_t*)" Q", 2); 139 pEndStream->SetData((const uint8_t*)" Q", 2);
140 pDoc->AddIndirectObject(pEndStream); 140 pDoc->AddIndirectObject(pEndStream);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 continue; 185 continue;
186 186
187 CFX_Matrix m = pDict->GetMatrixFor("Matrix"); 187 CFX_Matrix m = pDict->GetMatrixFor("Matrix");
188 CFX_Matrix t = *(CFX_Matrix*)matrix; 188 CFX_Matrix t = *(CFX_Matrix*)matrix;
189 m.Concat(t); 189 m.Concat(t);
190 pDict->SetMatrixFor("Matrix", m); 190 pDict->SetMatrixFor("Matrix", m);
191 } 191 }
192 } 192 }
193 } 193 }
194 194
195 return TRUE; 195 return true;
196 } 196 }
197 197
198 DLLEXPORT void STDCALL 198 DLLEXPORT void STDCALL
199 FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, 199 FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
200 double a, 200 double a,
201 double b, 201 double b,
202 double c, 202 double c,
203 double d, 203 double d,
204 double e, 204 double e,
205 double f) { 205 double f) {
(...skipping 11 matching lines...) Expand all
217 } 217 }
218 218
219 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, 219 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left,
220 float bottom, 220 float bottom,
221 float right, 221 float right,
222 float top) { 222 float top) {
223 CPDF_Path Path; 223 CPDF_Path Path;
224 Path.AppendRect(left, bottom, right, top); 224 Path.AppendRect(left, bottom, right, top);
225 225
226 CPDF_ClipPath* pNewClipPath = new CPDF_ClipPath(); 226 CPDF_ClipPath* pNewClipPath = new CPDF_ClipPath();
227 pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, FALSE); 227 pNewClipPath->AppendPath(Path, FXFILL_ALTERNATE, false);
228 return pNewClipPath; 228 return pNewClipPath;
229 } 229 }
230 230
231 DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath) { 231 DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath) {
232 delete (CPDF_ClipPath*)clipPath; 232 delete (CPDF_ClipPath*)clipPath;
233 } 233 }
234 234
235 void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) { 235 void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) {
236 const CFX_PathData* pPathData = path.GetObject(); 236 const CFX_PathData* pPathData = path.GetObject();
237 if (!pPathData) 237 if (!pPathData)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } else if (pDirectObj->IsStream()) { 327 } else if (pDirectObj->IsStream()) {
328 pContentArray = new CPDF_Array(); 328 pContentArray = new CPDF_Array();
329 pContentArray->AddReference(pDoc, pStream->GetObjNum()); 329 pContentArray->AddReference(pDoc, pStream->GetObjNum());
330 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); 330 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum());
331 pPageDic->SetReferenceFor("Contents", pDoc, 331 pPageDic->SetReferenceFor("Contents", pDoc,
332 pDoc->AddIndirectObject(pContentArray)); 332 pDoc->AddIndirectObject(pContentArray));
333 } 333 }
334 } 334 }
335 } 335 }
336 } 336 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_sysfontinfo.cpp ('k') | fpdfsdk/fpdfdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698