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 <memory> |
| 10 |
9 #include "core/include/fxcodec/fx_codec.h" | 11 #include "core/include/fxcodec/fx_codec.h" |
10 #include "core/include/fxcrt/fx_safe_types.h" | 12 #include "core/include/fxcrt/fx_safe_types.h" |
11 #include "fpdfsdk/include/fsdk_define.h" | 13 #include "fpdfsdk/include/fsdk_define.h" |
12 #include "fpdfsdk/include/fsdk_mgr.h" | 14 #include "fpdfsdk/include/fsdk_mgr.h" |
13 #include "fpdfsdk/include/fsdk_rendercontext.h" | 15 #include "fpdfsdk/include/fsdk_rendercontext.h" |
14 #include "fpdfsdk/include/javascript/IJavaScript.h" | 16 #include "fpdfsdk/include/javascript/IJavaScript.h" |
15 #include "public/fpdf_ext.h" | 17 #include "public/fpdf_ext.h" |
16 #include "public/fpdf_progressive.h" | 18 #include "public/fpdf_progressive.h" |
17 #include "third_party/base/nonstd_unique_ptr.h" | |
18 #include "third_party/base/numerics/safe_conversions_impl.h" | 19 #include "third_party/base/numerics/safe_conversions_impl.h" |
19 | 20 |
20 #ifdef PDF_ENABLE_XFA | 21 #ifdef PDF_ENABLE_XFA |
21 #include "../include/fpdfxfa/fpdfxfa_app.h" | 22 #include "../include/fpdfxfa/fpdfxfa_app.h" |
22 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 23 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
23 #include "../include/fpdfxfa/fpdfxfa_page.h" | 24 #include "../include/fpdfxfa/fpdfxfa_page.h" |
24 #include "../include/fpdfxfa/fpdfxfa_util.h" | 25 #include "../include/fpdfxfa/fpdfxfa_util.h" |
25 #include "core/include/fpdfapi/fpdf_module.h" | 26 #include "core/include/fpdfapi/fpdf_module.h" |
26 #include "public/fpdf_formfill.h" | 27 #include "public/fpdf_formfill.h" |
27 #endif // PDF_ENABLE_XFA | 28 #endif // PDF_ENABLE_XFA |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, | 810 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, |
810 device_y_f); | 811 device_y_f); |
811 *device_x = FXSYS_round(device_x_f); | 812 *device_x = FXSYS_round(device_x_f); |
812 *device_y = FXSYS_round(device_y_f); | 813 *device_y = FXSYS_round(device_y_f); |
813 #endif // PDF_ENABLE_XFA | 814 #endif // PDF_ENABLE_XFA |
814 } | 815 } |
815 | 816 |
816 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, | 817 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, |
817 int height, | 818 int height, |
818 int alpha) { | 819 int alpha) { |
819 nonstd::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); | 820 std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); |
820 if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) { | 821 if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) { |
821 return NULL; | 822 return NULL; |
822 } | 823 } |
823 return pBitmap.release(); | 824 return pBitmap.release(); |
824 } | 825 } |
825 | 826 |
826 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, | 827 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, |
827 int height, | 828 int height, |
828 int format, | 829 int format, |
829 void* first_scan, | 830 void* first_scan, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 if (!buffer) { | 1180 if (!buffer) { |
1180 *buflen = len; | 1181 *buflen = len; |
1181 } else if (*buflen >= len) { | 1182 } else if (*buflen >= len) { |
1182 memcpy(buffer, utf16Name.c_str(), len); | 1183 memcpy(buffer, utf16Name.c_str(), len); |
1183 *buflen = len; | 1184 *buflen = len; |
1184 } else { | 1185 } else { |
1185 *buflen = -1; | 1186 *buflen = -1; |
1186 } | 1187 } |
1187 return (FPDF_DEST)pDestObj; | 1188 return (FPDF_DEST)pDestObj; |
1188 } | 1189 } |
OLD | NEW |