summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2018-01-17Fix behavior of FPDF_RenderPageBitmapWithMatrixHenrique Nakashima
This functional part of this CL is mostly a revert of "Change behaviour of FPDF_RenderPageBitmapWithMatrix" 24b0733a72bbc4013bff8628f198b0aea807aa06 Besides the revert, the parameters passed to pPage->GetDisplayMatrix() are changed to fix a bug with the previous implementation: the page was scaled to fit inside the clipping_rect, instead of clipped. Bug: pdfium:849 Change-Id: I95d0a303a979c998026a3bd6963c8684a1209f03 Reviewed-on: https://pdfium-review.googlesource.com/22931 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-12Move some RetainPtr getters/setters out of headers.Lei Zhang
RetainPtr operations are not trivial. Change-Id: Ic106ada69d1c023a8132a2a59db17d550fd81fa0 Reviewed-on: https://pdfium-review.googlesource.com/22911 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-09Expose marked content IDs for images and alt text.Julian Lunger
- Adds two new public bits of API: - StructElement_GetMCID(STRUCTELEMENT) to return the marked content ID of the struct element. - IMAGEOBJ_METADATA.mcid to contain the marked content ID of the image. - Restores ContentMark::GetMCID, which was removed with other dead code in https://pdfium-review.googlesource.com/c/pdfium/+/19170. - Adds a couple calls to tests, including a simple new PDF to test the struct tree marked content ID. Bug:pdfium:957 Change-Id: I92856e43d741df989e53a575a08258da19a39f22 Reviewed-on: https://pdfium-review.googlesource.com/20632 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-08Encapsulate CPDF_ShadingObject members.Lei Zhang
Change-Id: I9b878c8df4a6208fb1908bad09eb1c699970163f Reviewed-on: https://pdfium-review.googlesource.com/21690 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-08Make SharedCopyOnWrite use RetainablesDan Sinclair
This CL removes the CountedObject from SharedCopyOnWrite and instead converts the items being shared into Retainable subclasses. BUG: chromium:792372 Change-Id: I9570a521f2fc2434013c3ccb103273bdd2440bb8 Reviewed-on: https://pdfium-review.googlesource.com/22010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-12-22Only set CPDF_ColorSpace component count on successful load.chromium/3310chromium/3309chromium/3308chromium/3307chromium/3306chromium/3305chromium/3304chromium/3303chromium/3302Lei Zhang
Make sure all CPDF_ColorSpace instances consistently call v_Load(). Change-Id: I15c1608c36781a03131884abceff1ecc4a9a1eb1 Reviewed-on: https://pdfium-review.googlesource.com/21911 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-21Clean up CPDF_Color.chromium/3301Lei Zhang
- Add IsPatternInternal(). - Mark some method parameters const. - Explain relationship between member variables. Change-Id: I650e18012341199985a4537e08c787e46cf8fef7 Reviewed-on: https://pdfium-review.googlesource.com/21912 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-21Fix various nits in color code.Lei Zhang
Change-Id: Idf2af2dd613d0e2bed5ef9bba4f8c50cd5bc1bc5 Reviewed-on: https://pdfium-review.googlesource.com/21851 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-20Avoid default arguments in EmbedderTest::OpenDocument().chromium/3300Lei Zhang
Default arguments are banned on virtual functions. Remove default arguments and rename OpenDocument() to OpenDocumentWithOptions(). Add wrappers for OpenDocumentWithOptions() to call it with sensible options. Change-Id: I4955d88cf77a7eab1771692ea3d6a18260b52900 Reviewed-on: https://pdfium-review.googlesource.com/21891 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-20Combine operator< and ByteString::Compare().Lei Zhang
Fix or optimize some ByteString::Compare() callers. Change-Id: I0fde91afc3d17fe160b46d00a441ad05e56377e7 Reviewed-on: https://pdfium-review.googlesource.com/20851 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-19Add parameter validation to CPDF_ShadingPattern.Henrique Nakashima
Check if the ColorSpace and the Function params are valid for the shading type. Bug: chromium:794990 Change-Id: I022e976e5489a6b325d95ad16eab056235a8944d Reviewed-on: https://pdfium-review.googlesource.com/21450 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-12-19Remove some dead code.Lei Zhang
Change-Id: I8edb14c024860c66b5e6c014136393e71e38387d Reviewed-on: https://pdfium-review.googlesource.com/21570 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-19Require valid color space for shading pattern.Henrique Nakashima
Bug: chromium:795889 Change-Id: If29a0f6f7d95bedf014464239da1f8b56e55c9b6 Reviewed-on: https://pdfium-review.googlesource.com/21750 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-12-19Change pattern creation checks in CPDF_DocPageData::GetPattern().Lei Zhang
Do them in the right places, instead of having a catch-all at the end. Change-Id: Ie26f06dbd1c50d5b5bf57aa1f9993d5d19f74c02 Reviewed-on: https://pdfium-review.googlesource.com/21670 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-16Fix null-dereference in CPDF_ShadingPattern::Load().chromium/3298chromium/3297Lei Zhang
BUG=chromium:795490 TBR=hnakashima@chromium.org Change-Id: Ic9f12c1c709c148f7294ab2aaf65fcc695960835 Reviewed-on: https://pdfium-review.googlesource.com/21530 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-15Validate base color space of Indexed color spaces.chromium/3296Henrique Nakashima
Change-Id: I2c1dbf4fe08396130d2fcecd70e175233316579b Reviewed-on: https://pdfium-review.googlesource.com/21430 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-15Validate shading pattern's ColorSpace. It cannot be a Pattern CS.Henrique Nakashima
Bug: chromium:795251 Change-Id: I6c4fd75a5afd16ced499d031f9b535f8c6828854 Reviewed-on: https://pdfium-review.googlesource.com/21410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-14Add restrictions to alternate color spaces.chromium/3295Henrique Nakashima
- ICC color spaces cannot have a Pattern color space as Alternate - Separation and DeviceN color spaces cannot have a special color space as Alternate. Special color spaces are {Separation, DeviceN, Indexed and Pattern}. Bug: chromium:794492 Change-Id: Ia2199382c759d8d1d13c605c22d6495e935265ad Reviewed-on: https://pdfium-review.googlesource.com/21310 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-12Use early returns in pdf_parser_decode.cpp.Lei Zhang
Also add a GetUnicodeFromBytes() helper function and use FX_INVALID_OFFSET more often. Change-Id: I3b0954e0cad31a600b0a990360ab370186c792d6 Reviewed-on: https://pdfium-review.googlesource.com/20850 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-11Remove default arguments to CPDF_StreamAcc::LoadAllData().Lei Zhang
Add LoadAllDataFiltered() and LoadAllDataRaw() and update callers. Change-Id: I9b80ee34a358db204968acdc8b1adc9db0b6b83f Reviewed-on: https://pdfium-review.googlesource.com/20810 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-11Slightly simplify CPDF_StreamAcc::LoadAllData().Lei Zhang
Also initialize members in the header. Change-Id: Ic1cda7f9ef4c69e26604c706678aed24bf4e8ee3 Reviewed-on: https://pdfium-review.googlesource.com/20790 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-11Move some GetDict() calls out of header files.Lei Zhang
Change-Id: I13b297ddb080b478a30a959889941b46feb363b3 Reviewed-on: https://pdfium-review.googlesource.com/20770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-08Fix build when using different sysroots.chromium/3289Andrew Weintraub
Bug: Change-Id: I86b4c72343288d83d51f493d3d888aad45baed5a Reviewed-on: https://pdfium-review.googlesource.com/20610 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-06Move m_CharCodes to local for crash investigationBruce Dawson
m_CharCodes is getting corrupted and it's difficult to tell why. This moves it to a local variable before it is destroyed so that the corruption - which should be copied over - will be stored in the crash dump. Bug: 782215 Change-Id: Ifd09b21396bf28bca69f2b4082c61cbc4782e209 Reviewed-on: https://pdfium-review.googlesource.com/20530 Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-06Fix nits on some font code.Lei Zhang
Change-Id: I80be0de1a7d9ba502b4468bc13a4595566f8fb30 Reviewed-on: https://pdfium-review.googlesource.com/20432 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-05Replace uses of bsearch().chromium/3286Lei Zhang
Either switch to std::lower_bound(), or brute force when the search space is very small. Change-Id: I54db346aeb6f2e8000e95a6a9c8fbdd512df500a Reviewed-on: https://pdfium-review.googlesource.com/20431 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-05Replace bsearch() in FPDFAPI_CIDFromCharCode().Lei Zhang
Use std::lower_bound() instead. Change-Id: I0bed2a90f3aa427a283cd86a050a027ec7a64358 Reviewed-on: https://pdfium-review.googlesource.com/20430 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-05Remove redundant field in struct FXCMAP_CMap.Lei Zhang
Change-Id: Ibac6398b5849820562830bb8ed95c3428496f7ef Reviewed-on: https://pdfium-review.googlesource.com/20410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Add text unit to glyph unit conversion to CPDF_Type3Char.Lei Zhang
Use it in type 3 font code. Change-Id: I8b0eb462cc0308f1700d21a62efc929babae8e20 Reviewed-on: https://pdfium-review.googlesource.com/20215 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Fix nits in CPDF_Type3Font.Lei Zhang
Change-Id: Ib922184ee844e66a0b29f49025e83e13eb81fdb8 Reviewed-on: https://pdfium-review.googlesource.com/20214 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Remove unneded structs from CFX_CTTGSUBTable part 2Nicolas Pena
This CL continues removing structs from CFX_CTTGSUBTable Change-Id: I1ede1e3e736f87292b6119406fd5f12a0bb7e7cb Reviewed-on: https://pdfium-review.googlesource.com/20170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-12-01Encapsulate CPDF_Type3Char members.Lei Zhang
Change-Id: Iec4e999d76dabc9b6cd00323881c5c87afc5f629 Reviewed-on: https://pdfium-review.googlesource.com/19930 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-30Fix GBK2K-H CMap usage.Lei Zhang
The data used is clearly a CID Range, but the code was interpreting it as single CID values. Change-Id: Ibb68f5ca2150d74b007a64ef5daa412fd542cecd Reviewed-on: https://pdfium-review.googlesource.com/17650 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-30Use initializer list in CPDF_DataAvail ctor.Lei Zhang
Or initialize members in the header. Also make m_dwFileLen member const. Change-Id: Iaaeab9a93e18e4ab313437362c0012d729b01647 Reviewed-on: https://pdfium-review.googlesource.com/9970 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-29Remove unneded structs from CFX_CTTGSUBTable part 1Nicolas Pena
This CL removes some useless structs from CFX_CTTGSUBTable. Change-Id: Iaf8b58d70b36d77fea73946c6b4279b15f5726e8 Reviewed-on: https://pdfium-review.googlesource.com/19710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-27Remove CollectionSize from CPDF_RenderStatusDan Sinclair
Bug: pdfium:774 Change-Id: I4996f5526884c33d92df964045bd5467c392df5e Reviewed-on: https://pdfium-review.googlesource.com/19490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_CharPosListDan Sinclair
Bug: pdfium:774 Change-Id: I7ebbcb17374b4117f92b94edbd8bcba18efe6313 Reviewed-on: https://pdfium-review.googlesource.com/19470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from FPDF_DataDecodeDan Sinclair
Bug: pdfium:774 Change-Id: I3fcde6fba46d21affa63d79fab2d83f47c9c5f84 Reviewed-on: https://pdfium-review.googlesource.com/19450 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CPDF_TextObject to not use CollectionSizeDan Sinclair
This CL updates various methods in CPDF_TextObject to return or received size_t values. Callers have been updated as needed. Bug: pdfium:774 Change-Id: Id72511bc74637c6261add39f5414c9a4b8390b82 Reviewed-on: https://pdfium-review.googlesource.com/19430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Convert CPDF_ClipPath::Get{Path|Text}Count to size_tDan Sinclair
This CL updates the various call sites to use size_t instead of other types. Bug: pdfium:774 Change-Id: Id8b75728b61c0ca1b15bc815831c885d33374f7b Reviewed-on: https://pdfium-review.googlesource.com/19410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Remove use of CollectionSize from CPDF_CMapParserDan Sinclair
Bug: pdfium:774 Change-Id: Ie24d0741f8c8d7988166aeb4b9ce87491993d30c Reviewed-on: https://pdfium-review.googlesource.com/19390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-22Change CPDF_ContentMark to return size_t for counts.Lei Zhang
Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove dead CPDF_ContentMark code.Lei Zhang
Change-Id: Ic552a652856ca231f3d2077c76a20d5916adb3c1 Reviewed-on: https://pdfium-review.googlesource.com/19170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove some pointless assignments to "".Lei Zhang
Or change them to clear(). Change-Id: Ia9e3e1f0d74b948cec3f8df85d205f830ac9216c Reviewed-on: https://pdfium-review.googlesource.com/19172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Avoid passing pointers by reference in core.Lei Zhang
This gets rid of most core/ non-const ref passing, either by passing by pointer-to-pointer instead, or by returning std::pair. Change-Id: Id7bdc355a1a725a05f9fa2f1e982ca8c975beef1 Reviewed-on: https://pdfium-review.googlesource.com/19030 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-13Check first page number in IsLinearizedHeaderValid().Lei Zhang
This should allow https://pdfium-review.googlesource.com/15770 to safely reland. BUG=chromium:781529 Change-Id: Id0c1bde3280fb72125d8e74751b9a1cb35302b6f Reviewed-on: https://pdfium-review.googlesource.com/18170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-10Stop using m_SavedPage in embedder tests.chromium/3265Henrique Nakashima
Change-Id: Id53f57085fecfe331c8cbfa6bb372b5ea5044442 Reviewed-on: https://pdfium-review.googlesource.com/18332 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-11-08Make most CPDF_LinearizedHeader members const.chromium/3263Lei Zhang
Change-Id: I82907ad725861b9ccd6299f5dfe20ddb9d238178 Reviewed-on: https://pdfium-review.googlesource.com/17796 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>