| OLD | NEW |
| 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 "../../include/fsdk_define.h" | 7 #include "../../include/fsdk_define.h" |
| 8 #include "../../include/fsdk_mgr.h" | 8 #include "../../include/fsdk_mgr.h" |
| 9 #include "../../include/fpdfxfa/fpdfxfa_util.h" | 9 #include "../../include/fpdfxfa/fpdfxfa_util.h" |
| 10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 int rotate, | 178 int rotate, |
| 179 int device_x, | 179 int device_x, |
| 180 int device_y, | 180 int device_y, |
| 181 double* page_x, | 181 double* page_x, |
| 182 double* page_y) { | 182 double* page_y) { |
| 183 ASSERT(m_pDocument != NULL); | 183 ASSERT(m_pDocument != NULL); |
| 184 | 184 |
| 185 if (!m_pPDFPage && !m_pXFAPageView) | 185 if (!m_pPDFPage && !m_pXFAPageView) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 CPDF_Matrix page2device; | 188 CFX_Matrix page2device; |
| 189 CPDF_Matrix device2page; | 189 CFX_Matrix device2page; |
| 190 FX_FLOAT page_x_f, page_y_f; | 190 FX_FLOAT page_x_f, page_y_f; |
| 191 | 191 |
| 192 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); | 192 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); |
| 193 | 193 |
| 194 device2page.SetReverse(page2device); | 194 device2page.SetReverse(page2device); |
| 195 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, | 195 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, |
| 196 page_y_f); | 196 page_y_f); |
| 197 | 197 |
| 198 *page_x = (page_x_f); | 198 *page_x = (page_x_f); |
| 199 *page_y = (page_y_f); | 199 *page_y = (page_y_f); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void CPDFXFA_Page::PageToDevice(int start_x, | 202 void CPDFXFA_Page::PageToDevice(int start_x, |
| 203 int start_y, | 203 int start_y, |
| 204 int size_x, | 204 int size_x, |
| 205 int size_y, | 205 int size_y, |
| 206 int rotate, | 206 int rotate, |
| 207 double page_x, | 207 double page_x, |
| 208 double page_y, | 208 double page_y, |
| 209 int* device_x, | 209 int* device_x, |
| 210 int* device_y) { | 210 int* device_y) { |
| 211 if (!m_pPDFPage && !m_pXFAPageView) | 211 if (!m_pPDFPage && !m_pXFAPageView) |
| 212 return; | 212 return; |
| 213 | 213 |
| 214 CPDF_Matrix page2device; | 214 CFX_Matrix page2device; |
| 215 FX_FLOAT device_x_f, device_y_f; | 215 FX_FLOAT device_x_f, device_y_f; |
| 216 | 216 |
| 217 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); | 217 GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate); |
| 218 | 218 |
| 219 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, | 219 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, |
| 220 device_y_f); | 220 device_y_f); |
| 221 | 221 |
| 222 *device_x = FXSYS_round(device_x_f); | 222 *device_x = FXSYS_round(device_x_f); |
| 223 *device_y = FXSYS_round(device_y_f); | 223 *device_y = FXSYS_round(device_y_f); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void CPDFXFA_Page::GetDisplayMatrix(CFX_AffineMatrix& matrix, | 226 void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix, |
| 227 int xPos, | 227 int xPos, |
| 228 int yPos, | 228 int yPos, |
| 229 int xSize, | 229 int xSize, |
| 230 int ySize, | 230 int ySize, |
| 231 int iRotate) const { | 231 int iRotate) const { |
| 232 ASSERT(m_pDocument != NULL); | 232 ASSERT(m_pDocument != NULL); |
| 233 | 233 |
| 234 if (!m_pPDFPage && !m_pXFAPageView) | 234 if (!m_pPDFPage && !m_pXFAPageView) |
| 235 return; | 235 return; |
| 236 | 236 |
| 237 int nDocType = m_pDocument->GetDocType(); | 237 int nDocType = m_pDocument->GetDocType(); |
| 238 switch (nDocType) { | 238 switch (nDocType) { |
| 239 case DOCTYPE_DYNAMIC_XFA: { | 239 case DOCTYPE_DYNAMIC_XFA: { |
| 240 if (m_pXFAPageView) { | 240 if (m_pXFAPageView) { |
| 241 CFX_Rect rect; | 241 CFX_Rect rect; |
| 242 rect.Set(xPos, yPos, xSize, ySize); | 242 rect.Set(xPos, yPos, xSize, ySize); |
| 243 m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate); | 243 m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate); |
| 244 } | 244 } |
| 245 } break; | 245 } break; |
| 246 case DOCTYPE_PDF: | 246 case DOCTYPE_PDF: |
| 247 case DOCTYPE_STATIC_XFA: { | 247 case DOCTYPE_STATIC_XFA: { |
| 248 if (m_pPDFPage) { | 248 if (m_pPDFPage) { |
| 249 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); | 249 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); |
| 250 } | 250 } |
| 251 } break; | 251 } break; |
| 252 default: | 252 default: |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 } | 255 } |
| OLD | NEW |