summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-11-08Fix FPDF_SaveAsCopy for linearized PDFs.Henrique Nakashima
Only the last trailer was written to the new PDF. In linearized PDFs, this means Info and Root were not copied to the newly written PDF. This CL makes CPDF_Parser remember the Root and provide that to CPDF_Creator. Bug: pdfium:614 Change-Id: Ia61f5f6a337f7de3010ee0ed39b022c1b2732ea2 Reviewed-on: https://pdfium-review.googlesource.com/17987 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-11-08Make sure that iterator stays in bounds during IsHypenRyan Harrison
BUG=chromium:782596,chromium:781804 Change-Id: I020be3cf813221bb8314f045d83014a25cb9a950 Reviewed-on: https://pdfium-review.googlesource.com/18070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-08Use MaybeOwned in CPDF_ContentParserNicolas Pena
Change-Id: I7e5daeafd70ef29bcc9bdebbae004fa4b946b83d Reviewed-on: https://pdfium-review.googlesource.com/18019 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Revert cleanup of IsHyphen and reimplementRyan Harrison
The original version of this code was landed in https://pdfium-review.googlesource.com/c/pdfium/+/13690/. A corner case has been found that breaks. In this CL I have reverted the changes in IsHyphen and implemented a less aggressive cleanup that I have tested works as expected. BUG=chromium:781804 Change-Id: I3b36f420834081fdd9e1ae17efc234b561b4df41 Reviewed-on: https://pdfium-review.googlesource.com/17950 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Use MaybeOwned in CJBig2_ImageNicolas Pena
Change-Id: Id53cbb8c95f6eb929f6e4eb57333daa24f1b776f Reviewed-on: https://pdfium-review.googlesource.com/18010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Remove m_bFlagExact from CFX_SubstFontNicolas Pena
This CL removes the single use case from |m_bFlagExact|. This flag allows the PDF viewer to treat a substitute font with a matching name as if it was actually an embedded font, which is wrong. For all substitute fonts, it is important to follow the longer process of first obtaining the unicode from the charcode to then obtain the glyph in the substitute font that corresponds to that unicode. Bug: chromium:781785 Change-Id: Ie5958b43914e0e46334b89b7c2c55c02d0da0c11 Reviewed-on: https://pdfium-review.googlesource.com/17859 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Simplify CPDF_ContentParser.Lei Zhang
Do more work in the ctor instead of a separate Start() method. Adjust callers and member variables accordingly. Change-Id: I310f27b3102a89e8e7b7ad31affd174f1fbbe500 Reviewed-on: https://pdfium-review.googlesource.com/17793 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07More FX_SAFE_INT32 in CJBig2_TRDProcNicolas Pena
Bug: chromium:781780 Change-Id: Ie92d8b570c37e9b3364d1ff4502f444a275ee6c2 Reviewed-on: https://pdfium-review.googlesource.com/17910 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Change CPDF_PSProc::AddOperator() to do binary search.Lei Zhang
Change-Id: If64a8410c992d5c7bd6504367f11ce946c1ef6aa Reviewed-on: https://pdfium-review.googlesource.com/17871 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Remove unused parameter from ByteString::FormatFloat().Lei Zhang
Nobody sets |precision| and the method does not read it either. Change-Id: I0f45fe953c005f817d331cbf73e38f7b15a77b81 Reviewed-on: https://pdfium-review.googlesource.com/17890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-06Add a CPDF_PSEngine test.Lei Zhang
Change-Id: Ia267f40dc4ebe9e1d28b6a333eddcff749414ffa Reviewed-on: https://pdfium-review.googlesource.com/17870 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Improve ByteString{View}::operator<().Lei Zhang
Make it possible to compare: 1) const char* < ByteStringView 2) ByteString < const char* 3) ByteString < ByteStringView 4) const char* < ByteString Do the same for WideString{View}. With new unit test cases. Change-Id: I31da526b1ab78b8d51ec1c99bf29046fe13754d5 Reviewed-on: https://pdfium-review.googlesource.com/17872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-06Mark string pointers as const in string unit tests.Lei Zhang
Change-Id: I4895ee9c0cbe1aaf1fe9913d39ce11e6ad855dd3 Reviewed-on: https://pdfium-review.googlesource.com/17873 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Remove C-style casts in CPDF_PSEngine.Lei Zhang
Fix a few other nits. Change-Id: I12f79b3f83d1695957ba067291f2ee03a7d189ca Reviewed-on: https://pdfium-review.googlesource.com/17810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Revert "Simplify CPDF_HintsTable."dsinclair
This reverts commit 33591752d2cb14f2e07726ca52afce6efbdc07c9. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=781529 Original change's description: > Simplify CPDF_HintsTable. > > Use CPDF_LinearizedHeader directly. > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > Reviewed-on: https://pdfium-review.googlesource.com/15770 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Idaf8d4c91e869d92b44211cfe48f162037ed7327 Reviewed-on: https://pdfium-review.googlesource.com/17830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Pack struct FXCMAP_CMap more densely to save 1 KB.Lei Zhang
Change-Id: Ida9738f4ad7ef266c2edb794f12dcf49b64fc590 Reviewed-on: https://pdfium-review.googlesource.com/17750 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-06Mark some CPDF_StreamContentParser members as const.Lei Zhang
Change-Id: I6c4ee5400307c8321f2558287f4d7571c373fcaa Reviewed-on: https://pdfium-review.googlesource.com/17795 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-04Simplify CPDF_HintsTable.Artem Strygin
Use CPDF_LinearizedHeader directly. Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa Reviewed-on: https://pdfium-review.googlesource.com/15770 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03Remove C-style casts in cpdf_colorspace.cpp.Lei Zhang
Change-Id: Icce0751713dc39d2b3f3c3f23f7ed45df3d4952f Reviewed-on: https://pdfium-review.googlesource.com/17771 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03Remove flags param from FXMEM_DefaultAlloc() and friends.Lei Zhang
Change-Id: I24404be0065156a1cfdec31bafdf72c27fa70142 Reviewed-on: https://pdfium-review.googlesource.com/17792 Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03Check for NULL pointer in _TIFFfree().chromium/3258Lei Zhang
PartitionAlloc does not handle free(NULL), so _TIFFfree() needs to do the check, just like png_free_default() and _cmsFree() for other third party code. BUG=chromium:780709 Change-Id: I4e2ff0ba642c66e4a73e151c9ab42ebb42d34a5b Reviewed-on: https://pdfium-review.googlesource.com/17791 Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03Simplify CPDF_SecurityHandler.Lei Zhang
Remove unused method params, impossible code, and mark methods const. Change-Id: Iee95c7b931461e2aadcf2422650a0cd48c8f7696 Reviewed-on: https://pdfium-review.googlesource.com/17790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03The component count in CPDF_IndexedCS should be unsigned.Lei Zhang
Since the source of the component count is unsigned. Adjust related variables to also be unsigned. In CPDF_IndexedCS::GetRGB(), switch integer overflow code to use FX_SAFE_SIZE_T, and write to the out params correctly on failure. Change-Id: If7405b4c5e9022ba1992fff2be2bcc1a7826adf4 Reviewed-on: https://pdfium-review.googlesource.com/17770 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Move parsing logic from FPDF_DataAvail into CPDF_DataAvail.Artem Strygin
Change-Id: Iacae9723e88eeae52154276b2478e4fd8c309c2d Reviewed-on: https://pdfium-review.googlesource.com/15512 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-02Encapsulate CPDF_FormObject members.Lei Zhang
Also remove a conditional in the CPDF_Form ctor that cannot be true. Change-Id: Icd00233969cea33e9c63d0d6a9d07226c2b173f2 Reviewed-on: https://pdfium-review.googlesource.com/17070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Remove useless code.Artem Strygin
Change-Id: Id355fd03da476674181bae479ccebe50059dfa4f Reviewed-on: https://pdfium-review.googlesource.com/15511 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-02Refactoring of cross refs availability check.Artem Strygin
Use CPDF_CrossRefAvail to check crossrefs. Change-Id: Ia333cff4e86eaab5bad17424c1bb8ef9bdbca8ff Reviewed-on: https://pdfium-review.googlesource.com/15510 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-02Rename Transparency to iTransparency.Lei Zhang
Fix a mismatched parameter name in cpdf_renderstatus.h too. Change-Id: I9765838e6ab93db37791fc282e553b6cb9c51ec5 Reviewed-on: https://pdfium-review.googlesource.com/17050 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Remove some C-style const char* casts.Lei Zhang
Change-Id: I4785dd277b9da072ee3c55e2aaeb688bbf02852e Reviewed-on: https://pdfium-review.googlesource.com/17391 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Remove some redundent code in CPDF_DIBSource::StartLoadDIBSource().Lei Zhang
Do the same for CPDF_DIBSource::ContinueLoadDIBSource(). Change-Id: I5c826967bf2595e2dcadfa6cae7edfe07ab17012 Reviewed-on: https://pdfium-review.googlesource.com/5252 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Simplify some CMap code.Lei Zhang
Change-Id: Ie7eb2605a789d2c841cb1dc123509f473c4c5a5e Reviewed-on: https://pdfium-review.googlesource.com/17410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-02Unify CPDF_DataAvail::Check[Header/End].chromium/3257Artem Strygin
Use CPDF_Parser instead of CPDF_SyntaxParser for parse File Header and tail. Change-Id: I9ca22b927519a6ea280e249ef43721c230faa6ab Bug: Reviewed-on: https://pdfium-review.googlesource.com/13970 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-02Improve readability for CPDF_Parser::StartParseInternalArtem Strygin
Change-Id: Id250aeeb131d344d79f41c93d4c71b42e266195d Reviewed-on: https://pdfium-review.googlesource.com/13930 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-02Unify parsing of linearized header.Artem Strygin
Change-Id: I3b55b1331ee97af254c248d4ac91b627c9603b59 Reviewed-on: https://pdfium-review.googlesource.com/13831 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-30Remove useless code.Artem Strygin
Change-Id: I5fa9472eecc176d25213fd446a4abc06e815a48b Reviewed-on: https://pdfium-review.googlesource.com/15592 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-30Use CPDF_PageDataAvail to check page availability.Artem Strygin
Change-Id: Iad67de5881481684fee605f48f9349a3be21f70b Reviewed-on: https://pdfium-review.googlesource.com/15591 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-30Use CPDF_PageDataAvail to check page resources availability.Artem Strygin
Change-Id: Idbb30122c113ffce421c8d471551f619f4ab7576 Reviewed-on: https://pdfium-review.googlesource.com/15590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-30Use CPDF_PageDataAvail to check form availability.Artem Strygin
Change-Id: I31c0a74322a2299f2d0cd1f42669b1bf447a9958 Reviewed-on: https://pdfium-review.googlesource.com/13530 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-30More safe ints in CJBig2_TRDProcNicolas Pena
Bug: chromium:778961 Change-Id: I1d08b3282304931276c24e50392c10b21780dcde Reviewed-on: https://pdfium-review.googlesource.com/16971 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-30Add test for CPDF_HintsTable.Artem Strygin
Change-Id: Ibda8e140791215faec52e6dbc33adea732373f6c Reviewed-on: https://pdfium-review.googlesource.com/15810 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-27Revert "Revert "Reland "Remove ContrastAdjust()."""chromium/3253chromium/3252Henrique Nakashima
This reverts commit 978ba20ffd0d2b37bf02b9d86828fa701c0c02fa. Reason for revert: I now have the new expected files for the chrome test ready in https://chromium-review.googlesource.com/c/chromium/src/+/742061 Landing this again and will immediately add a manual pdfium roll to cl 742061 to unblock the deps roller. Original change's description: > Revert "Reland "Remove ContrastAdjust()."" > > This reverts commit d5ec7ab0cd0663184d6056bc6fc87c86ec345342. > > Reason for revert: Did not mean to reland, just create the reland CL. > > Original change's description: > > Reland "Remove ContrastAdjust()." > > > > Original change's description: > > > Revert "Remove ContrastAdjust()." > > > > > > This reverts commit 53d443f042b590ae2d920def16bc9daf66f8427d. > > > > > > Reason for revert: Breaks PDFToPWGRasterBrowserTest > > > > > > Original change's description: > > > > Remove ContrastAdjust(). > > > > > > > > This post-processing increased the contrast of scaled-down features - > > > > mainly lines and fonts, relative to the background. The effect does not > > > > improved readability and in some cases makes the scaled-down version > > > > look like a different document at a glance. Text that is normal > > > > weight appears bold when scaled down in these cases. > > > > > > > > Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 > > > > Reviewed-on: https://pdfium-review.googlesource.com/15471 > > > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > > > Reviewed-by: dsinclair <dsinclair@chromium.org> > > > > > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > > > Change-Id: I7f61650bc6d917b3c6640da60f3f740ef4498de0 > > > Reviewed-on: https://pdfium-review.googlesource.com/16970 > > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > > > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > > > Change-Id: I77d4377d30908d1e2d4dc842300a761072a5fbd4 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Reviewed-on: https://pdfium-review.googlesource.com/16990 > > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > Change-Id: Ie2e91662a1e82c0a793952aab47c2acbde1596d4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://pdfium-review.googlesource.com/16991 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: Iaae451131043ee69052809680922fdac06a69458 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/16992 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-27Revert "Reland "Remove ContrastAdjust().""Henrique Nakashima
This reverts commit d5ec7ab0cd0663184d6056bc6fc87c86ec345342. Reason for revert: Did not mean to reland, just create the reland CL. Original change's description: > Reland "Remove ContrastAdjust()." > > Original change's description: > > Revert "Remove ContrastAdjust()." > > > > This reverts commit 53d443f042b590ae2d920def16bc9daf66f8427d. > > > > Reason for revert: Breaks PDFToPWGRasterBrowserTest > > > > Original change's description: > > > Remove ContrastAdjust(). > > > > > > This post-processing increased the contrast of scaled-down features - > > > mainly lines and fonts, relative to the background. The effect does not > > > improved readability and in some cases makes the scaled-down version > > > look like a different document at a glance. Text that is normal > > > weight appears bold when scaled down in these cases. > > > > > > Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 > > > Reviewed-on: https://pdfium-review.googlesource.com/15471 > > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > > Reviewed-by: dsinclair <dsinclair@chromium.org> > > > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > > > # Not skipping CQ checks because original CL landed > 1 day ago. > > > > Change-Id: I7f61650bc6d917b3c6640da60f3f740ef4498de0 > > Reviewed-on: https://pdfium-review.googlesource.com/16970 > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > Change-Id: I77d4377d30908d1e2d4dc842300a761072a5fbd4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://pdfium-review.googlesource.com/16990 > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: Ie2e91662a1e82c0a793952aab47c2acbde1596d4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/16991 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-27Reland "Remove ContrastAdjust()."Henrique Nakashima
Original change's description: > Revert "Remove ContrastAdjust()." > > This reverts commit 53d443f042b590ae2d920def16bc9daf66f8427d. > > Reason for revert: Breaks PDFToPWGRasterBrowserTest > > Original change's description: > > Remove ContrastAdjust(). > > > > This post-processing increased the contrast of scaled-down features - > > mainly lines and fonts, relative to the background. The effect does not > > improved readability and in some cases makes the scaled-down version > > look like a different document at a glance. Text that is normal > > weight appears bold when scaled down in these cases. > > > > Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 > > Reviewed-on: https://pdfium-review.googlesource.com/15471 > > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > > Reviewed-by: dsinclair <dsinclair@chromium.org> > > TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Change-Id: I7f61650bc6d917b3c6640da60f3f740ef4498de0 > Reviewed-on: https://pdfium-review.googlesource.com/16970 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org Change-Id: I77d4377d30908d1e2d4dc842300a761072a5fbd4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/16990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-10-27Revert "Remove ContrastAdjust()."Henrique Nakashima
This reverts commit 53d443f042b590ae2d920def16bc9daf66f8427d. Reason for revert: Breaks PDFToPWGRasterBrowserTest Original change's description: > Remove ContrastAdjust(). > > This post-processing increased the contrast of scaled-down features - > mainly lines and fonts, relative to the background. The effect does not > improved readability and in some cases makes the scaled-down version > look like a different document at a glance. Text that is normal > weight appears bold when scaled down in these cases. > > Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 > Reviewed-on: https://pdfium-review.googlesource.com/15471 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: dsinclair <dsinclair@chromium.org> TBR=bungeman@chromium.org,dsinclair@chromium.org,hnakashima@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I7f61650bc6d917b3c6640da60f3f740ef4498de0 Reviewed-on: https://pdfium-review.googlesource.com/16970 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-10-26Remove ContrastAdjust().Henrique Nakashima
This post-processing increased the contrast of scaled-down features - mainly lines and fonts, relative to the background. The effect does not improved readability and in some cases makes the scaled-down version look like a different document at a glance. Text that is normal weight appears bold when scaled down in these cases. Change-Id: I2544d45e2bcec25d6742d2a60c1316d8df08cce1 Reviewed-on: https://pdfium-review.googlesource.com/15471 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-25Enforce end of data in CJBig2_ArithDecoderNicolas Pena
Quoting the JBIG2 spec: "If B is a 0xFF byte, then B1 (the byte pointed to by BP+1) is tested. If B1 exceeds 0x8F, then B1 must be one of the marker codes. The marker code is interpreted as required, and the buffer pointer remains pointed to the 0xFF prefix of the marker code which terminates the arithmetically compressed data. 1-bits are then fed to the decoder until the decoding is complete. This is shown by adding 0xFF00 to the C-register and setting the bit counter CT to 8." Our implementation is the alternative (faster for software according to the spec), where only CT is changed to 8. Reaching this part of the code means we will never read from stream again so we should be wrapping up the decoding. To ensure this, the |m_Complete| attribute is set to true if we reach this code again, which will result in bailing out next time DECODE is called. Bug: 767156 Change-Id: I434d46bc7914713a065f0e4da079bbc9b5dd216c Reviewed-on: https://pdfium-review.googlesource.com/16791 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-10-23Fix some integer overflows in CJBig2_TRDProcNicolas Pena
Bug: 649278 Change-Id: Ib9084f6d9bb7dc7bf3713faa22d3a26822a96681 Reviewed-on: https://pdfium-review.googlesource.com/16550 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-10-23Return error when attempting to load frame with 0 heightRyan Harrison
A frame with 0 height will have no data, so there is not point in attempting to load it. Additionally some of the loading code assumes a non-zero height implicitly. BUG=chromium:770470 Change-Id: I38b222b46b43ce5d47924526913285510be40603 Reviewed-on: https://pdfium-review.googlesource.com/16551 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-23Fix cpdf_textpage so it doesn't omit spaces.Andrew Weintraub
Bug: pdfium:921 Change-Id: I8864fd2ebdccc5f94aaf70cd8295068bf4db8b68 Reviewed-on: https://pdfium-review.googlesource.com/16492 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-23Cleanup some javascript color codeDan Sinclair
This CL changes the color conversion methods to return their result instead of taking an out param. Change-Id: I19ca2b395145866533c7f93cbad80cdf4d7df05d Reviewed-on: https://pdfium-review.googlesource.com/16530 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>