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

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp

Issue 1720043003: Remove foo != NULL outside of xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 10 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 | « fpdfsdk/src/formfiller/FFL_IFormFiller.cpp ('k') | fpdfsdk/src/fsdk_annothandler.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 "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 7 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
10 #include "fpdfsdk/include/fsdk_define.h" 10 #include "fpdfsdk/include/fsdk_define.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 delete m_pPDFPage; 111 delete m_pPDFPage;
112 112
113 m_pPDFPage = new CPDF_Page(); 113 m_pPDFPage = new CPDF_Page();
114 m_pPDFPage->Load(m_pDocument->GetPDFDoc(), pageDict); 114 m_pPDFPage->Load(m_pDocument->GetPDFDoc(), pageDict);
115 m_pPDFPage->ParseContent(nullptr); 115 m_pPDFPage->ParseContent(nullptr);
116 116
117 return TRUE; 117 return TRUE;
118 } 118 }
119 119
120 FX_FLOAT CPDFXFA_Page::GetPageWidth() { 120 FX_FLOAT CPDFXFA_Page::GetPageWidth() {
121 ASSERT(m_pDocument != NULL);
122
123 if (!m_pPDFPage && !m_pXFAPageView) 121 if (!m_pPDFPage && !m_pXFAPageView)
124 return 0.0f; 122 return 0.0f;
125 123
126 int nDocType = m_pDocument->GetDocType(); 124 int nDocType = m_pDocument->GetDocType();
127 switch (nDocType) { 125 switch (nDocType) {
128 case DOCTYPE_DYNAMIC_XFA: { 126 case DOCTYPE_DYNAMIC_XFA: {
129 if (m_pXFAPageView) { 127 if (m_pXFAPageView) {
130 CFX_RectF rect; 128 CFX_RectF rect;
131 m_pXFAPageView->GetPageViewRect(rect); 129 m_pXFAPageView->GetPageViewRect(rect);
132 return rect.width; 130 return rect.width;
133 } 131 }
134 } break; 132 } break;
135 case DOCTYPE_STATIC_XFA: 133 case DOCTYPE_STATIC_XFA:
136 case DOCTYPE_PDF: { 134 case DOCTYPE_PDF: {
137 if (m_pPDFPage) 135 if (m_pPDFPage)
138 return m_pPDFPage->GetPageWidth(); 136 return m_pPDFPage->GetPageWidth();
139 } break; 137 } break;
140 default: 138 default:
141 return 0.0f; 139 return 0.0f;
142 } 140 }
143 141
144 return 0.0f; 142 return 0.0f;
145 } 143 }
146 144
147 FX_FLOAT CPDFXFA_Page::GetPageHeight() { 145 FX_FLOAT CPDFXFA_Page::GetPageHeight() {
148 ASSERT(m_pDocument != NULL);
149
150 if (!m_pPDFPage && !m_pXFAPageView) 146 if (!m_pPDFPage && !m_pXFAPageView)
151 return 0.0f; 147 return 0.0f;
152 148
153 int nDocType = m_pDocument->GetDocType(); 149 int nDocType = m_pDocument->GetDocType();
154 switch (nDocType) { 150 switch (nDocType) {
155 case DOCTYPE_PDF: 151 case DOCTYPE_PDF:
156 case DOCTYPE_STATIC_XFA: { 152 case DOCTYPE_STATIC_XFA: {
157 if (m_pPDFPage) 153 if (m_pPDFPage)
158 return m_pPDFPage->GetPageHeight(); 154 return m_pPDFPage->GetPageHeight();
159 } break; 155 } break;
(...skipping 13 matching lines...) Expand all
173 169
174 void CPDFXFA_Page::DeviceToPage(int start_x, 170 void CPDFXFA_Page::DeviceToPage(int start_x,
175 int start_y, 171 int start_y,
176 int size_x, 172 int size_x,
177 int size_y, 173 int size_y,
178 int rotate, 174 int rotate,
179 int device_x, 175 int device_x,
180 int device_y, 176 int device_y,
181 double* page_x, 177 double* page_x,
182 double* page_y) { 178 double* page_y) {
183 ASSERT(m_pDocument != NULL);
184
185 if (!m_pPDFPage && !m_pXFAPageView) 179 if (!m_pPDFPage && !m_pXFAPageView)
186 return; 180 return;
187 181
188 CFX_Matrix page2device; 182 CFX_Matrix page2device;
189 CFX_Matrix device2page; 183 CFX_Matrix device2page;
190 FX_FLOAT page_x_f, page_y_f; 184 FX_FLOAT page_x_f, page_y_f;
191 185
192 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); 186 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate);
193 187
194 device2page.SetReverse(page2device); 188 device2page.SetReverse(page2device);
(...skipping 27 matching lines...) Expand all
222 *device_x = FXSYS_round(device_x_f); 216 *device_x = FXSYS_round(device_x_f);
223 *device_y = FXSYS_round(device_y_f); 217 *device_y = FXSYS_round(device_y_f);
224 } 218 }
225 219
226 void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix, 220 void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix,
227 int xPos, 221 int xPos,
228 int yPos, 222 int yPos,
229 int xSize, 223 int xSize,
230 int ySize, 224 int ySize,
231 int iRotate) const { 225 int iRotate) const {
232 ASSERT(m_pDocument != NULL);
233
234 if (!m_pPDFPage && !m_pXFAPageView) 226 if (!m_pPDFPage && !m_pXFAPageView)
235 return; 227 return;
236 228
237 int nDocType = m_pDocument->GetDocType(); 229 int nDocType = m_pDocument->GetDocType();
238 switch (nDocType) { 230 switch (nDocType) {
239 case DOCTYPE_DYNAMIC_XFA: { 231 case DOCTYPE_DYNAMIC_XFA: {
240 if (m_pXFAPageView) { 232 if (m_pXFAPageView) {
241 CFX_Rect rect; 233 CFX_Rect rect;
242 rect.Set(xPos, yPos, xSize, ySize); 234 rect.Set(xPos, yPos, xSize, ySize);
243 m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate); 235 m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate);
244 } 236 }
245 } break; 237 } break;
246 case DOCTYPE_PDF: 238 case DOCTYPE_PDF:
247 case DOCTYPE_STATIC_XFA: { 239 case DOCTYPE_STATIC_XFA: {
248 if (m_pPDFPage) { 240 if (m_pPDFPage) {
249 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); 241 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate);
250 } 242 }
251 } break; 243 } break;
252 default: 244 default:
253 return; 245 return;
254 } 246 }
255 } 247 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_IFormFiller.cpp ('k') | fpdfsdk/src/fsdk_annothandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698