summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_ppo.cpp
AgeCommit message (Collapse)Author
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-07-13Fix FPDF_ImportNPagesToOne() documentation.Lei Zhang
FPDF_ImportNPagesToOne() has width/height parameters to indicate the dimensions of pages in the returned PDF. PDF is not a raster-based format, so pixels are not the right unit for page dimensions. Change-Id: Iff5b373a5a020b5822aaa29d2b44f1dbf7a75b13 Reviewed-on: https://pdfium-review.googlesource.com/37810 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-06-29Revert "Simplify CPDF_PageOrganizer::UpdateReference method."Lei Zhang
This reverts commit 35ab1bd0328a244cc2f6dcde2822c8117738b01d. Reason for revert: Causing crashes and bad flattening. BUG=chromium:858921,chromium:858952 Original change's description: > Simplify CPDF_PageOrganizer::UpdateReference method. > > Change-Id: I52fe66472bdc2a61d7074f77627a3ee1d5646255 > Reviewed-on: https://pdfium-review.googlesource.com/35611 > Reviewed-by: dsinclair <dsinclair@chromium.org> > Commit-Queue: Art Snake <art-snake@yandex-team.ru> TBR=dsinclair@chromium.org,art-snake@yandex-team.ru Change-Id: I9a3635140867793e7109c15b64d66ec1d1a8b1f9 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/36550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-28Simplify CPDF_PageOrganizer::UpdateReference method.Artem Strygin
Change-Id: I52fe66472bdc2a61d7074f77627a3ee1d5646255 Reviewed-on: https://pdfium-review.googlesource.com/35611 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-11Implement CPDF_Object::MakeReference method.chromium/3456Artem Strygin
Change-Id: I153747ef587a184eaef58ff09dbf8f214c9ddfb3 Reviewed-on: https://pdfium-review.googlesource.com/17230 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2018-06-08Add constants for PDF 1.7 spec, table 3.27.Lei Zhang
BUG=pdfium:1049 Change-Id: Ie8bdb893d2af8d63420027a7ef95baf58cd97aa6 Reviewed-on: https://pdfium-review.googlesource.com/34691 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-04Revert "Make CPDF_Document cache CPDF_Pages"Tom Sepez
This reverts commit f0d9d28a034fe3650c3c2d662090c1e8687ddb16. Reason for revert: avoid parsing page. Change-Id: Id3478f7e38f1cbe95d098e00158b1d7d9dc6f76e Reviewed-on: https://pdfium-review.googlesource.com/33750 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-30Make CPDF_Document cache CPDF_PagesTom Sepez
We cache pages not by page number, which can bounce around as pages are inserted or removed, but by page dictionary's object number. Since the page may be created under one function and used under another, we can't take the shortcut of not instantiating a render cache nor not parsing the page. Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a Reviewed-on: https://pdfium-review.googlesource.com/32830 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-25Make CPDF_Page retainable.Tom Sepez
Small step to reducing the differences between XFA and non-XFA. We still use the RetainPtr pretty much as if it were an unique_ptr, in that we're not yet caching pages and handing out multiple pointers to the same page in the non-XFA case. The one change is in page view cleanup, where we no longer need a boolean and can take (sufficient) page ownership with a RetainPtr. Tidy up some document.h -> page.h -> document.h circular inclusion while we're at it. NOTE: Wait for imminent branch to pass before landing. We'll want this to bake a while. Change-Id: I64a2f12ac3424ece1063d40583995b834117cf34 Reviewed-on: https://pdfium-review.googlesource.com/32790 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-05-09Add proper const/non-const versions of CPDF_Array methods.Lei Zhang
Instead of having const methods that return non-const pointers. BUG=pdfium:234 Change-Id: I61495543f67229500dfcf2248e93468e9a9b23cf Reviewed-on: https://pdfium-review.googlesource.com/32183 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-09Add proper const/non-const versions of CPDF_Object methods.Lei Zhang
Instead of having const methods that return non-const pointers. BUG=pdfium:234 Change-Id: I598e9b4f267f702e2e71001cfe3aa3c9e9d8c12f Reviewed-on: https://pdfium-review.googlesource.com/32182 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-05-08Rename CPDF_Document::GetPage() to GetPageDictionary().Tom Sepez
Avoids a conflict should we wish to have the document actually track pages, with a GetPage() that returns CPDF_Page. Do the same thing to CPDF_DataAvail along the way. Add some missing consts as well. Change-Id: I2cb2213cc4c0649662fceab80407ee4a3f4cf30e Reviewed-on: https://pdfium-review.googlesource.com/32158 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-25Introduce ScopedFPDF types in public/cpp/fpdf_scopers.hTom Sepez
Applies std::remove_ptr to the public API types so that we can deduce a correct unique ptr type no matter how that API might change away from void* usage. Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...> Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86 Reviewed-on: https://pdfium-review.googlesource.com/31292 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-03-28Rename some fsdk files to cpdfsdkDan Sinclair
This CL renames fsdk_common and fsdk_define to cpdfsdk_common and cpdfsdk_helpers respectively. Change-Id: I8ee7a308561f1ff2f510954444f953b0c8fed788 Reviewed-on: https://pdfium-review.googlesource.com/29371 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-16Fix methods that have definition with different parameter names.Lei Zhang
Found by ClangTidy. BUG=pdfium:1039 Change-Id: I2bb9256a63d5459e959c1a3228418073245d7a86 Reviewed-on: https://pdfium-review.googlesource.com/28731 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-12Mark some CPDF_Dictionary pointers as const.Lei Zhang
This makes it obvious if they are dictionaries that are only read from, or if they are being modified. Also clarify some page dictionary variables names to make it obvious that they are the source or destination page. Change-Id: I1d3c769c9940296b8f159b454bde32e595a95cac Reviewed-on: https://pdfium-review.googlesource.com/26330 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-12Remove a parameter from CPDF_NPageToOneExporter::MakeXObject().Lei Zhang
It's always the same member variable. Also make a CPDF_NPageToOneExporter::FinishPage() parameter const-ref. Change-Id: Id2550115259177d72b814bf6d4afe5fb775f6b86 Reviewed-on: https://pdfium-review.googlesource.com/26290 Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-09Use CPDF_Dictionary::SetRectFor() when appropriate.Lei Zhang
Change-Id: I4ced221fb5691927485deceb7002dac880c2c210 Reviewed-on: https://pdfium-review.googlesource.com/26110 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-09Use CFX_Size in CPDF_Page and fpdf_ppo.cpp.Lei Zhang
Instead of having separate floats for width and height. Also remove some out parameters and just return them instead. Change-Id: I798b1453910c89477d422dcb7c0805b90823bf98 Reviewed-on: https://pdfium-review.googlesource.com/26090 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-02-09Fix nits in ParsePageRangeString().Lei Zhang
- Fix typos. - Do not pass by value. - Return early if the page range string is empty after removing spaces. - Simplify and rearrange bits of the implementation. Change-Id: Ia4c4f43c2ca18383ad1edc8233969a7013e34722 Reviewed-on: https://pdfium-review.googlesource.com/24290 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-02-08Split CPDF_PageOrganizer into multiple classes.chromium/3345Lei Zhang
Retain CPDF_PageOrganizer as a base class. Add CPDF_PageExporter and CPDF_NPageToOneExporter sub-classes. The sub-classes only do one type of exporting. Therefore it is much easier to understand what part of the original combined CPDF_PageOrganizer is used where. Change-Id: I424ef9c32b101d23e8397fc9a656d9b0b5da6a27 Reviewed-on: https://pdfium-review.googlesource.com/26011 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-02-08Add document getters in CPDF_PageOrganizer.Lei Zhang
This is to prepare for splitting CPDF_PageOrganizer into multiple classes. Change-Id: Ibf54342096aeb66465fd24dc1ba40c73112fb4c9 Reviewed-on: https://pdfium-review.googlesource.com/26010 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-07More GetPageNumbers() clean up in fpdf_ppo.cpp.Lei Zhang
- Pass by const ref. - Simplify logic. - Return page number vector directly. Change-Id: If68c89437380b871ca6635f2355049dd19a9e512 Reviewed-on: https://pdfium-review.googlesource.com/24270 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-02-06Change MakeXObject to update reference from the root of the source page.xlou
The code changes include two parts: 1. Only updating resources' reference caused font not to clone properly. Hence changing to update reference from the root of the source page dictionary. 2. Since PDF objects are at document level, pObjNumberMap needs to be defined before pages are created to avoid same object being copied more than one times with different object numbers. Change-Id: I6f90aff2e3901cee73ce09fe550ad79add6be7eb Reviewed-on: https://pdfium-review.googlesource.com/25190 Commit-Queue: Shirleen Lou <xlou@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-02Fix IWYU errors in fpdfppo.cpp.Lei Zhang
Also rename the file to fpdf_ppo.cpp so it is consistent with the public header file name. This makes the linter happy. Change-Id: Ib3608c78111842579898c55f1399982ab2549310 Reviewed-on: https://pdfium-review.googlesource.com/24970 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>