| 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 "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include "core/include/fxcodec/fx_codec.h" | 9 #include "core/include/fxcodec/fx_codec.h" |
| 10 #include "core/include/fxcrt/fx_safe_types.h" | 10 #include "core/include/fxcrt/fx_safe_types.h" |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 int device_y, | 763 int device_y, |
| 764 double* page_x, | 764 double* page_x, |
| 765 double* page_y) { | 765 double* page_y) { |
| 766 if (page == NULL || page_x == NULL || page_y == NULL) | 766 if (page == NULL || page_x == NULL || page_y == NULL) |
| 767 return; | 767 return; |
| 768 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 768 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 769 #ifdef PDF_ENABLE_XFA | 769 #ifdef PDF_ENABLE_XFA |
| 770 pPage->DeviceToPage(start_x, start_y, size_x, size_y, rotate, device_x, | 770 pPage->DeviceToPage(start_x, start_y, size_x, size_y, rotate, device_x, |
| 771 device_y, page_x, page_y); | 771 device_y, page_x, page_y); |
| 772 #else // PDF_ENABLE_XFA | 772 #else // PDF_ENABLE_XFA |
| 773 CPDF_Matrix page2device; | 773 CFX_Matrix page2device; |
| 774 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, | 774 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, |
| 775 rotate); | 775 rotate); |
| 776 CPDF_Matrix device2page; | 776 CFX_Matrix device2page; |
| 777 device2page.SetReverse(page2device); | 777 device2page.SetReverse(page2device); |
| 778 FX_FLOAT page_x_f, page_y_f; | 778 FX_FLOAT page_x_f, page_y_f; |
| 779 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, | 779 device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f, |
| 780 page_y_f); | 780 page_y_f); |
| 781 *page_x = (page_x_f); | 781 *page_x = (page_x_f); |
| 782 *page_y = (page_y_f); | 782 *page_y = (page_y_f); |
| 783 #endif // PDF_ENABLE_XFA | 783 #endif // PDF_ENABLE_XFA |
| 784 } | 784 } |
| 785 | 785 |
| 786 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, | 786 DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, |
| 787 int start_x, | 787 int start_x, |
| 788 int start_y, | 788 int start_y, |
| 789 int size_x, | 789 int size_x, |
| 790 int size_y, | 790 int size_y, |
| 791 int rotate, | 791 int rotate, |
| 792 double page_x, | 792 double page_x, |
| 793 double page_y, | 793 double page_y, |
| 794 int* device_x, | 794 int* device_x, |
| 795 int* device_y) { | 795 int* device_y) { |
| 796 if (!device_x || !device_y) | 796 if (!device_x || !device_y) |
| 797 return; | 797 return; |
| 798 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); | 798 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); |
| 799 if (!pPage) | 799 if (!pPage) |
| 800 return; | 800 return; |
| 801 #ifdef PDF_ENABLE_XFA | 801 #ifdef PDF_ENABLE_XFA |
| 802 pPage->PageToDevice(start_x, start_y, size_x, size_y, rotate, page_x, page_y, | 802 pPage->PageToDevice(start_x, start_y, size_x, size_y, rotate, page_x, page_y, |
| 803 device_x, device_y); | 803 device_x, device_y); |
| 804 #else // PDF_ENABLE_XFA | 804 #else // PDF_ENABLE_XFA |
| 805 CPDF_Matrix page2device; | 805 CFX_Matrix page2device; |
| 806 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, | 806 pPage->GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, |
| 807 rotate); | 807 rotate); |
| 808 FX_FLOAT device_x_f, device_y_f; | 808 FX_FLOAT device_x_f, device_y_f; |
| 809 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, | 809 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, |
| 810 device_y_f); | 810 device_y_f); |
| 811 *device_x = FXSYS_round(device_x_f); | 811 *device_x = FXSYS_round(device_x_f); |
| 812 *device_y = FXSYS_round(device_y_f); | 812 *device_y = FXSYS_round(device_y_f); |
| 813 #endif // PDF_ENABLE_XFA | 813 #endif // PDF_ENABLE_XFA |
| 814 } | 814 } |
| 815 | 815 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 pContext->m_pOptions->m_ColorMode = RENDER_COLOR_GRAY; | 938 pContext->m_pOptions->m_ColorMode = RENDER_COLOR_GRAY; |
| 939 pContext->m_pOptions->m_ForeColor = 0; | 939 pContext->m_pOptions->m_ForeColor = 0; |
| 940 pContext->m_pOptions->m_BackColor = 0xffffff; | 940 pContext->m_pOptions->m_BackColor = 0xffffff; |
| 941 } | 941 } |
| 942 const CPDF_OCContext::UsageType usage = | 942 const CPDF_OCContext::UsageType usage = |
| 943 (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View; | 943 (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View; |
| 944 pContext->m_pOptions->m_AddFlags = flags >> 8; | 944 pContext->m_pOptions->m_AddFlags = flags >> 8; |
| 945 pContext->m_pOptions->m_pOCContext = | 945 pContext->m_pOptions->m_pOCContext = |
| 946 new CPDF_OCContext(pPage->m_pDocument, usage); | 946 new CPDF_OCContext(pPage->m_pDocument, usage); |
| 947 | 947 |
| 948 CFX_AffineMatrix matrix; | 948 CFX_Matrix matrix; |
| 949 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); | 949 pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); |
| 950 | 950 |
| 951 FX_RECT clip; | 951 FX_RECT clip; |
| 952 clip.left = start_x; | 952 clip.left = start_x; |
| 953 clip.right = start_x + size_x; | 953 clip.right = start_x + size_x; |
| 954 clip.top = start_y; | 954 clip.top = start_y; |
| 955 clip.bottom = start_y + size_y; | 955 clip.bottom = start_y + size_y; |
| 956 pContext->m_pDevice->SaveState(); | 956 pContext->m_pDevice->SaveState(); |
| 957 pContext->m_pDevice->SetClip_Rect(&clip); | 957 pContext->m_pDevice->SetClip_Rect(&clip); |
| 958 | 958 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 if (!buffer) { | 1188 if (!buffer) { |
| 1189 *buflen = len; | 1189 *buflen = len; |
| 1190 } else if (*buflen >= len) { | 1190 } else if (*buflen >= len) { |
| 1191 memcpy(buffer, utf16Name.c_str(), len); | 1191 memcpy(buffer, utf16Name.c_str(), len); |
| 1192 *buflen = len; | 1192 *buflen = len; |
| 1193 } else { | 1193 } else { |
| 1194 *buflen = -1; | 1194 *buflen = -1; |
| 1195 } | 1195 } |
| 1196 return (FPDF_DEST)pDestObj; | 1196 return (FPDF_DEST)pDestObj; |
| 1197 } | 1197 } |
| OLD | NEW |