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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2576893002: Return unique_ptr from CXFA_FFApp::CreateDoc. (Closed)
Patch Set: Created 4 years 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 | « no previous file | fpdfsdk/fpdfxfa/cpdfxfa_context.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/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f, 883 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f,
884 device_y_f); 884 device_y_f);
885 *device_x = FXSYS_round(device_x_f); 885 *device_x = FXSYS_round(device_x_f);
886 *device_y = FXSYS_round(device_y_f); 886 *device_y = FXSYS_round(device_y_f);
887 #endif // PDF_ENABLE_XFA 887 #endif // PDF_ENABLE_XFA
888 } 888 }
889 889
890 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, 890 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width,
891 int height, 891 int height,
892 int alpha) { 892 int alpha) {
893 std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap); 893 auto pBitmap = pdfium::MakeUnique<CFX_DIBitmap>();
894 if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) { 894 if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32))
895 return nullptr; 895 return nullptr;
896 } 896
897 return pBitmap.release(); 897 return pBitmap.release();
898 } 898 }
899 899
900 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, 900 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width,
901 int height, 901 int height,
902 int format, 902 int format,
903 void* first_scan, 903 void* first_scan,
904 int stride) { 904 int stride) {
905 FXDIB_Format fx_format; 905 FXDIB_Format fx_format;
906 switch (format) { 906 switch (format) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 if (!buffer) { 1222 if (!buffer) {
1223 *buflen = len; 1223 *buflen = len;
1224 } else if (len <= *buflen) { 1224 } else if (len <= *buflen) {
1225 memcpy(buffer, utf16Name.c_str(), len); 1225 memcpy(buffer, utf16Name.c_str(), len);
1226 *buflen = len; 1226 *buflen = len;
1227 } else { 1227 } else {
1228 *buflen = -1; 1228 *buflen = -1;
1229 } 1229 }
1230 return (FPDF_DEST)pDestObj; 1230 return (FPDF_DEST)pDestObj;
1231 } 1231 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698