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

Side by Side Diff: fpdfsdk/src/fpdfview.cpp

Issue 1124423006: Better error from pdfium_test when page too big to render. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tabify Created 5 years, 7 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 | « no previous file | samples/pdfium_test.cc » ('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 "../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/fpdfview.h" 9 #include "../include/fpdfview.h"
10 #include "../include/fsdk_rendercontext.h" 10 #include "../include/fsdk_rendercontext.h"
11 #include "../include/fpdf_progressive.h" 11 #include "../include/fpdf_progressive.h"
12 #include "../include/fpdf_ext.h" 12 #include "../include/fpdf_ext.h"
13 #include "../../../core/src/fxcrt/fx_safe_types.h" 13 #include "../../../core/src/fxcrt/fx_safe_types.h"
14 #include "../../third_party/base/numerics/safe_conversions_impl.h" 14 #include "../../third_party/base/numerics/safe_conversions_impl.h"
15 #include "../../third_party/base/nonstd_unique_ptr.h"
Lei Zhang 2015/05/08 18:05:15 nit: alphabetical order.
Tom Sepez 2015/05/08 18:13:01 Done.
15 16
16 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess) 17 CPDF_CustomAccess::CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess)
17 { 18 {
18 if (pFileAccess) 19 if (pFileAccess)
19 m_FileAccess = *pFileAccess; 20 m_FileAccess = *pFileAccess;
20 } 21 }
21 22
22 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t si ze) 23 FX_BOOL CPDF_CustomAccess::ReadBlock(void* buffer, FX_FILESIZE offset, size_t si ze)
23 { 24 {
24 if (offset < 0) { 25 if (offset < 0) {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 591
591 FX_FLOAT device_x_f, device_y_f; 592 FX_FLOAT device_x_f, device_y_f;
592 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f , device_y_f); 593 page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f , device_y_f);
593 594
594 *device_x = FXSYS_round(device_x_f); 595 *device_x = FXSYS_round(device_x_f);
595 *device_y = FXSYS_round(device_y_f); 596 *device_y = FXSYS_round(device_y_f);
596 } 597 }
597 598
598 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha ) 599 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, int height, int alpha )
599 { 600 {
600 » CFX_DIBitmap* pBitmap = new CFX_DIBitmap; 601 » nonstd::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
Lei Zhang 2015/05/08 18:05:15 nit: Can we get rid of tabs in this entire functio
Tom Sepez 2015/05/08 18:13:01 Yes. The only thing worse than tabs in files are
601 » pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32); 602 » if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) {
602 » return pBitmap; 603 » » return NULL;
604 » }
605 » return pBitmap.release();
603 } 606 }
604 607
605 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for mat, void* first_scan, int stride) 608 DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, int height, int for mat, void* first_scan, int stride)
606 { 609 {
607 FXDIB_Format fx_format; 610 FXDIB_Format fx_format;
608 switch (format) { 611 switch (format) {
609 case FPDFBitmap_Gray: 612 case FPDFBitmap_Gray:
610 fx_format = FXDIB_8bppRgb; 613 fx_format = FXDIB_8bppRgb;
611 break; 614 break;
612 case FPDFBitmap_BGR: 615 case FPDFBitmap_BGR:
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (!buffer) { 867 if (!buffer) {
865 buflen = len; 868 buflen = len;
866 } else if (buflen >= len) { 869 } else if (buflen >= len) {
867 memcpy(buffer, utf16Name.c_str(), len); 870 memcpy(buffer, utf16Name.c_str(), len);
868 buflen = len; 871 buflen = len;
869 } else { 872 } else {
870 buflen = -1; 873 buflen = -1;
871 } 874 }
872 return (FPDF_DEST)pDestObj; 875 return (FPDF_DEST)pDestObj;
873 } 876 }
OLDNEW
« no previous file with comments | « no previous file | samples/pdfium_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698