summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
AgeCommit message (Collapse)Author
2015-08-06clang-format all pdfium code, again.Nico Weber
Also add a presubmit that checks for this so I don't have to keep doing it. No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i BUG=none R=thestig@chromium.org Review URL: https://codereview.chromium.org/1272653005 .
2015-08-05CPDF_Parser shouldnt be in the business of opening filesTom Sepez
Move that operation closer to the embedder's call. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1269073003 .
2015-08-04clang-format all pdfium code.Nico Weber
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
2015-07-27Revert "FX Bool considered harmful, part 3"Tom Sepez
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
2015-07-27FX Bool considered harmful, part 3Tom Sepez
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
2015-07-23Revert "FX_BOOL considered harmful, part 2."Tom Sepez
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
2015-07-23FX_BOOL considered harmful, part 2.Tom Sepez
Fully automatic change, execpt for cleanup in fx_system.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1254703002 .
2015-07-17Refactor progressive renderer class.chromium/2467chromium/2466chromium/2465chromium/2464chromium/2463chromium/2462chromium/2461Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1233453014 .
2015-07-15Kill Func_Renderpage global function pointer, it never changes.Tom Sepez
Kill some unused macros along the way, and put prototypes in header files. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1233203004 .
2015-06-19Cleanup: Do not check pointers before deleting them.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004.
2015-06-17Replace some Release() calls with virtual destructors.Tom Sepez
A virtual method that does |delete this| is an anti-pattern. Some classes can be de-virtualized instead. Throw in some unique_ptrs and delete dead code for good measure. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1192013002.
2015-06-15Do some IWYU cleanups.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1176333002.
2015-06-11Remove trailing whitespaces in fpdfsdk.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173343004.
2015-06-10Remove typdefs for pointer types in fx_system.h.Tom Sepez
This involves fixing some multiple variable per line declarations, as the textually-substituted "*" applies only to the first one. This involves moving some consts around following the substitution. This involves replacing some typedefs used as constructors with better code. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1171733003
2015-06-09Use stdint.h types throughout PDFium.Tom Sepez
It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002
2015-06-08Remove more cruft from fx_system.hTom Sepez
- include system headers first and alphabetize. - remove unsupported FX_WIN32_MOBILE symbol. - actually define a FX_WIN64 symbol and make consistent. - use final/override, not FX_FINAL. - let stdint.h resolve FX_WORDSIZE concerns. - unused FX_ERR and FX_SUCCESS() macros. - unused FX_LSB_FIRST macro. - outline FX type deprecation plan. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1169963003
2015-06-05Fix bad include path in fpdfview.cppTom Sepez
Caught by checkdeps rules. That this still compiled is probably due to some stray -I flag somewhere. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1149213008
2015-06-04Move fx_safe_types.h to include/ directory.Tom Sepez
Small bit of OCD here, since this file is included cross-library (i.e. from fpdfsk), it can't be in src/. In other words, the following should be empty: grep -R 'include.*core/src/' fpdfsdk Fix some IWYU in it at the same time. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1147353006
2015-05-12Make (and verify) public/ files compile under C.Tom Sepez
This involves adding some missing extern "C" { } declarations, using FPDF_ types instead of C++ types, and converting pass by reference arguments into pointers. Test this using fpdfview_embedertest for simplicity. BUG=pdfium:158 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1130843003
2015-05-11Create top-level public/ header directory.Tom Sepez
These are the only files that embedders of PDFium should be including. They are entirely self-contained, and compile cleanly against -Wall so as to not offend the code that may include them. Having done this, we can see that chromium is pulling in two additional files from the fpdfsdk/include/pdfwindow directory, which is not guaranteed to work. A few files are renamed, adding an "_" to make the names consistent. The exception is fpdfview, which is doc'd as such in the doc. Naturally, paths will need updating in a handful of files in chrome when this rolls in. BUG=pdfium:154 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135913002
2015-05-08Better error from pdfium_test when page too big to render.Tom Sepez
BUG=pdfium:114 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1124423006
2015-05-05Expose additional flags for rasterization.Scott Byer
These flags are unused in Chromium, but are needed for the Cloud Print conversion process, which takes PDF and produces a raster for low-end printers. Certain low-end printers (e.g., B&W laser printers) will turn anti-aliased text into a mess. The existing printing flag isn't sufficient, as other kinds of printers will still want some kinds of anti-aliasing to occur for best results. BUG=482253 TEST=none R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/1115513002 Patch from Scott Byer <scottbyer@chromium.org>.
2015-04-17Replace FX_NEW with new, remove tests from fpdfsdkTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1089823004
2015-04-14Kill CFX_Object.Tom Sepez
CFX_Object is a type that implements its own new operators that return NULL on error. There's no need for this given the |new (std::nothrow)| syntax; in fact, the current code can only work if there is no activity in the constructors. This may explain the pervasive lack of constructors and reliance on Init() methods throughout the codebase. The activity takes place in fx_memory.h, where FX_NEW is mapped onto the std::nothrow syntax. The rest is just cleanup. Down the road, we will simply throw and remove all the error-checking paths for new objects. Landing this patch first will at least show a simple path back to the old behaviour without having to re-introduce CFX_Object should someone want to do so in their own fork. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1088733002
2015-03-10Kill remaining sprintfsTom Sepez
I thought I had done this already, apart from the third-party libraries, but there were a couple remaining (the third-party libraries will still call this, they should be tweaked upstream as needed). R=thestig@chromium.org Review URL: https://codereview.chromium.org/999543002
2015-02-05Add namespace and-re-arrange PDFium's local copy of chromium /base.Tom Sepez
Any projects DEPS'd into chromium and requiring a /base subset should have a local copy of that subset in a separate namespace. This will avoid future naming conflicts. Re-arrange the directory structure to better identify what came from chromium's base, and to make drop-in replacement easier for files that contain hard-coded "base/" in their #include directives. R=jam@chromium.org Review URL: https://codereview.chromium.org/900753002
2015-02-04Prevent base::CheckedNumeric from leaking outside of pdfium.Tom Sepez
Headers in /include directories should be free of implementation details from third_party. Put the types into a new header outside of /include. Requires https://codereview.chromium.org/902443003/ before a version containing this patch is rolled into chromium. R=jam@chromium.org Review URL: https://codereview.chromium.org/896023003
2015-01-21Add tests for GetNamedDests() API.Tom Sepez
Follow-on work from patch at https://codereview.chromium.org/845643008. This incorporates that patch, plus adds tests for it and similar conditions. A few changes are introduced to correct expected behaviour. This also incoprorates Deepak's fix in https://codereview.chromium.org/845643008/ This incorporates a formerly unlanded tool to generate small valid PDF files from template input, which is needed to cover all the error cases here. See https://codereview.chromium.org/791993006/ BUG=450133 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/837723009
2015-01-21Use signed long for FPDF_GetNamedDest buffer length.Bo Xu
Need to have return value -1 indicating insufficient buffer. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/862163002
2015-01-21Simplify UTF16LE_Encode and add unittest.Bo Xu
Previously, UTF16LE_Encode take an optional flag to indicate if the returned byte string has trailing zeros. In fact, no where needs the flag to be false. So just get rid of it so callers won't misuse. The bug is found by https://codereview.chromium.org/837723009 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/860973002
2015-01-10Add APIs for getting bookmarks and named destinations.Bo Xu
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/834703002
2015-01-05In windows printing, convert src bitmap to dest bitmap using CompositeBitmap.Bo Xu
When dealing with transparency, the printing procedure will generate a bitmap first, then draw this bitmap in windows DC. The format of source bitmap is argb, but the destination bitmap is rgb. Simply doing memcpy will lose the alpha channel information, so CompositeBitmap function is needed. BUG=412908 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/826633002
2014-12-12Simplify PDFium by removing code that's not used in the open source repo.John Abd-El-Malek
-remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused R=tsepez@chromium.org Review URL: https://codereview.chromium.org/801913002
2014-09-24Lock page in LoadFXAnnot to prevent unintended page closingBo Xu
BUG=410326 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/594403003
2014-09-19Add FPDF_GetSecurityHandlerRevisionBo Xu
Security handler revision number is needed to interpret file permission. BUG=None R=thestig@chromium.org Review URL: https://codereview.chromium.org/589813002
2014-08-13Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.Tom Sepez
Should there be cases where this fails to compile, it indicates a mistake, either an incorrectly declared overrriden virtual method, or a method that should be declared non-virtual. The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(), and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere, and are removed. Two members are removed that are no longer needed once those methods are removed. R=jam@chromium.org, jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/454983003
2014-08-13Remove try/catch blockBo Xu
BUG=pdfium:28 R=thakis@chromium.org Review URL: https://codereview.chromium.org/472563002
2014-08-07Change '>=' back to '>' in extension.h due to bad fixchromium/2122chromium/2121chromium/2120chromium/2119chromium/2118Jun Fang
BUG=400662 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/445303002
2014-08-02Fix buffer size boundary check offset by 1chromium/2117chromium/2116chromium/2115chromium/2114chromium/2113Bo Xu
When newPos == file size, the current block will not be read or Get. If this block is a crucial part of the document (like m_pTrailer), the program will exit with parse error and the document will not be rendered. BUG=None R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/440563003
2014-07-30Fix the potential integer overflow from 'offset+size' in extension.h and ↵JUN FANG
fpdfview.cpp BUG=397258 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/419063002
2014-07-23Fix FPDF_RenderPage 2x zoom in when bBackgroundAlphaNeeded is trueBo Xu
BUG=179413 R=thestig@chromium.org Review URL: https://codereview.chromium.org/410073002
2014-07-18pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.Nico Weber
Calling `delete` on an object of a type that has virtual functions but not a virtual destructor is questionable: Since the object has virtual functions, it likely has subclasses, so if it's deleted through the base pointer and the destructor isn't virtual, the subclass destructor won't be called. In most cases, the classes getting deleted can just be marked final to tell the compiler that it can't possibly have subclasses (this also enables the compiler to generate better code). Two classes didn't have any sub- or superclasses but virtual functions - this doesn't make sense, so make all methods of these classes non-virtual. (Also delete an unused function on one of the two classes.) In one case, a class actually did have a subclass that needs to be deleted virtually, so mark one destructor as virtual. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/370853002
2014-07-14Add support to extract viewer preferenceBo Xu
This change adds the support to extract "NumCopies", "PrintPageRange", "Duplex" viewer preferences for printing. BUG=169120 R=bo_xu@foxitsoftware.com, vitalybuka@chromium.org Review URL: https://codereview.chromium.org/345123002
2014-07-09Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition (try 2)chromium/2095chromium/2094chromium/2093chromium/2092chromium/2091chromium/2090chromium/2089chromium/2088chromium/2087chromium/2086Lei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/377353002
2014-07-08Revert commit 95c018e2d15ecc3a5bd2a9aab18638316a6d3d46Lei Zhang
Fixes for re-enabling more MSVC level 4 warnings: pdfium/ edition BUG=81439 TBR=pkasting@chromium.org Review URL: https://codereview.chromium.org/376043003
2014-07-08Fixes for re-enabling more MSVC level 4 warnings: pdfium/ editionLei Zhang
This contains fixes for the following sorts of issues: * Nonstandard extension: unnamed struct/union This also changes the signature of FPDF_FillRect() to enable the cleanest possible changes in https://codereview.chromium.org/372273005 . BUG=81439 TEST=none Original patch by Peter Kasting <pkasting@chromium.org> Original code review: https://codereview.chromium.org/376003003/ R=pkasting@chromium.org Review URL: https://codereview.chromium.org/372383004
2014-07-08Remove custom memory managerBo Xu
BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003
2014-05-23Convert all line endings to LF.John Abd-El-Malek
2014-05-20Add some blank lines at the end of 3 files to remove the "no newlines at end ↵John Abd-El-Malek
of file" warning.
2014-05-17Initial commit.John Abd-El-Malek