summaryrefslogtreecommitdiff
path: root/testing
AgeCommit message (Collapse)Author
2018-10-11Add functions to get/set ArtBox.chromium/3578xlou
There are PDFs that use ArtBox. In some use cases, user may scale a page, scale up/down MediaBox and CropBox. So if ArtBox exists, it needs to be scaled as well. Bug:409670 Change-Id: I78ac7afa66942352277f856514bdd9b15dda270b Reviewed-on: https://pdfium-review.googlesource.com/c/43931 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Shirleen Lou <xlou@chromium.org>
2018-10-11Enable jumbo support for PDFium fuzzers.Lei Zhang
Make fuzzer helpers that are mutually exclusive use the same name for their global variables. If any target tries to include both, the jumbo build will likely fail. BUG=pdfium:964 Change-Id: Idadbc86ff990bf1e8c7cfb3500f1f191a96432db Reviewed-on: https://pdfium-review.googlesource.com/c/43850 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-11Fix double V8 initialization with fuzzers.Lei Zhang
Commit 95860d7 added some new fuzzers, but they try to use both the generic fuzzer's initialization code, as well as their own custom initialization code. Add a new "pdfium_public_fuzzer" GN template for these new fuzzers, so they use their own initialization code rather than the generic one. BUG=chromium:894053 TBR=tsepez@chromium.org Change-Id: I6110a199e1c64d7c0632f9966e146fd316b757ae Reviewed-on: https://pdfium-review.googlesource.com/c/43832 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-10Use optipng to optimize expected .pngs when regenerating them.Henrique Nakashima
Bug: pdfium:1127 Change-Id: I5371ecf6f704761320a021fbee07a79839fb80b7 Reviewed-on: https://pdfium-review.googlesource.com/c/43810 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-10-10Create embeddertests for other kinds of actions.Tom Sepez
Change-Id: Ia4619be65e2ab8ee4bf19ba9608c1cc94594ba89 Reviewed-on: https://pdfium-review.googlesource.com/c/43812 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-10Catch SSL errors when fetching Gold JSON data.Lei Zhang
Also increase timeout value when retrying. Change-Id: I14dd3f76fd1a7555c3a5e1bd8c7bf8f214bc8ec0 Reviewed-on: https://pdfium-review.googlesource.com/c/43616 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for retain_ptr.h and unowned_ptr.hLei Zhang
Change-Id: I2897feee27f80c85f0328f0b220ae5be93686170 Reviewed-on: https://pdfium-review.googlesource.com/c/43610 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Copy some fuzzer code from Chromium into PDFium.Lei Zhang
These came from Chromium's pdf/pdfium/fuzzer directory. The code has been modified to be buildable in standalone PDFium and modernized. Change-Id: Ia4ddad4a164f798689af4b9f92d41d635901dccb Reviewed-on: https://pdfium-review.googlesource.com/c/43530 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-04Change |virtual ~Foo(){}| to |virtual ~Foo()=default;|chromium/3571Tom Sepez
Otherwise code coverage flags the empty body as unreachable. Change-Id: Iee1d9a876d68276529c70d9b8c7a28276f271767 Reviewed-on: https://pdfium-review.googlesource.com/c/43514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Reland "Make potentially dangerous Actions require a user click."Henrique Nakashima
This is a reland of 9d784c291714b703b16185e69860a3797de85b6c https://chromium-review.googlesource.com/c/chromium/src/+/1244367 was submitted changing the test that broke with this CL to not depend on PDF OpenActions anymore. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> Bug: 851821 Change-Id: Iaf9c399059590f0f1a050ac450e08ee60a8d5a38 Reviewed-on: https://pdfium-review.googlesource.com/43410 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-02Remove unneeded cfgas_fontmgr.h includes.Lei Zhang
Fix IWYU issues in affected files. Change-Id: I92c145348549d2d0f0e066e134e649b3b958e068 Reviewed-on: https://pdfium-review.googlesource.com/c/43313 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-02Remove ability to delete annot in CJS_Document::removeField()Tom Sepez
This path has only been present under XFA, and has resulted in several bugs, including the referenced one. There is a breakage in some XFA functionality, but I'm not confident we can do this without re-engineering all of fpdfsdk widget ownership. Bug: 891210 Change-Id: I5aa158fa5359b1c8338046eefb25fb25df9ace48 Reviewed-on: https://pdfium-review.googlesource.com/c/43311 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-02Fix nits in gold.py.Lei Zhang
Change-Id: I4a47a3d7c7a66de08217dc33d5f6f324e3e6a41c Reviewed-on: https://pdfium-review.googlesource.com/43312 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-02Retry fetching Gold JSON data.Lei Zhang
It occasionally times out on the bots. Change-Id: Ie33d77c0e07f932c374c2ca670f982faeed29659 Reviewed-on: https://pdfium-review.googlesource.com/c/43310 Commit-Queue: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-02Normalize widget bounding boxes when flattening.Lei Zhang
BUG=chromium:890322 Change-Id: I11050b84cf440f8d6bb00c661360de4e389dc031 Reviewed-on: https://pdfium-review.googlesource.com/c/43290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-01Add XFA BMP pixel testchromium/3569Ryan Harrison
This adds a test case where a simple red square BMP image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of BMPs is working. Displaying BMPs is currently broken, https://crbug.com/pdfium/1168, so this test is currently suppressed. BUG=pdfium:1163 Change-Id: I3ef006a7aa16717ad9cdbca1d423613f17246a5e Reviewed-on: https://pdfium-review.googlesource.com/43132 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-01Add XFA TIFF Deflate pixel testRyan Harrison
This adds a test case where a simple red square TIFF, using Deflate compression, image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of Deflate TIFFs is working. Change-Id: Ibe1b9f2a367ca3ceba6e08461f392e659459f7b8 Reviewed-on: https://pdfium-review.googlesource.com/43250 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-01Add XFA TIFF PackBits pixel testRyan Harrison
This adds a test case where a simple red square TIFF, using PackBits compression, image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of PackBits TIFFs is working. Change-Id: I01723a4ac8192b357b5a8480e7709ac6a0dce945 Reviewed-on: https://pdfium-review.googlesource.com/43270 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-01Add XFA TIFF LZW pixel testRyan Harrison
This adds a test case where a simple red square TIFF, using LZW compression, image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of LZW TIFFs is working. Change-Id: Iecaef68e7eb4b1e822737f3faf4837699261e28b Reviewed-on: https://pdfium-review.googlesource.com/43230 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-01Add XFA PNG pixel testRyan Harrison
This adds a test case where a simple red square PNG image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of PNGs is working. Change-Id: I8b04c5b0e85f7163e22dcf98593e6c88d5395ebb Reviewed-on: https://pdfium-review.googlesource.com/43130 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-01Add XFA TIFF pixel testRyan Harrison
This adds a test case where a simple red square TIFF image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of TIFFs is working. Change-Id: Ida61ed4bd49a58c432bde017832fa80187dc58d6 Reviewed-on: https://pdfium-review.googlesource.com/43134 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-10-01Add XFA JPG pixel testRyan Harrison
This adds a test case where a simple red square JPG image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of JPGs is working. Change-Id: Ife2f334c4c2a77a551d7c0b6f31c36f6cf42fcee Reviewed-on: https://pdfium-review.googlesource.com/43133 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-01Add XFA GIF pixel testRyan Harrison
This adds a test case where a simple red square GIF image is embedded into an XFA document. This exercises that <image> tags work correctly and that end to end rendering of GIFs is working. Displaying GIFs is currently broken, https://crbug.com/pdfium/1167, so this test is currently suppressed. BUG=pdfium:904 Change-Id: I400a2a287c24726bc811dacfabe30ddc77f38b9c Reviewed-on: https://pdfium-review.googlesource.com/43131 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-24Revert "Make potentially dangerous Actions require a user click."Henrique Nakashima
This reverts commit 9d784c291714b703b16185e69860a3797de85b6c. Reason for revert: Roll into chromium is stuck, this is a potential culprit. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 851821 Change-Id: I6f1bc0a02f65a24fbd49d53526b985f8a4ea0b4f Reviewed-on: https://pdfium-review.googlesource.com/42990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-20Make potentially dangerous Actions require a user click.Henrique Nakashima
URI and SubmitForm actions are only handled if the event was ButtonUp or ButtonDown. Bug: 851821 Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d Reviewed-on: https://pdfium-review.googlesource.com/42731 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Make some methods const in XFAJSEmbedderTestchromium/3560chromium/3559chromium/3558Nicolas Pena
This CL addresses the published draft comment from https://pdfium-review.googlesource.com/c/pdfium/+/5691/ Change-Id: I7a2cd9aa5dbdde18cadb82cbef70f0e8820cc276 Reviewed-on: https://pdfium-review.googlesource.com/42871 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-09-17Fix final/protected conflicts.Tom Sepez
Classes marked |final| should not have |protected| members. In turn, "private field m_dwEncryptObjNum is not used" warning is produced. Change-Id: I51a96aca5a5f499381a6764d892962f7f2dc0327 Reviewed-on: https://pdfium-review.googlesource.com/42611 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-12Set correct stream index when parsing is done in several steps.Henrique Nakashima
When parsing happens in several steps (in pages with > 100 page objects), the position is reset to 0 and the start pointer is advanced. This breaks the calculation of which stream an object belongs to. Passing in the base pointer separately from the start offset allows the correct position to be calculated and the correct stream to be identified. Change-Id: Ic0d5f59f437609158aa97b3c8a18dbd48cd3b0d4 Reviewed-on: https://pdfium-review.googlesource.com/42270 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-10Remove check for clean branch from safetynet_job.py.chromium/3549Henrique Nakashima
Branches can be dirty when a library sync'ed with gclient sync is removed from DEPS and from .gitignore. The library will be removed by "gclient sync --force". Change-Id: I19fa4a3f13989edb41cd671fd412cc67e67819eb Reviewed-on: https://pdfium-review.googlesource.com/42211 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-07Force gclient sync in safetynet_compare.py.chromium/3548chromium/3547chromium/3546Henrique Nakashima
This overwrites deps that are dirty, fixing an issue with deps that are removed in the "after" branch but not in the "before" branch. Change-Id: I1c905dc46522455ad160a6fd57fbab979c42162e Reviewed-on: https://pdfium-review.googlesource.com/42191 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-07Revert "Discard deps that are not sync'ed anymore in safetynet_compare.py."Henrique Nakashima
This reverts commit aaff8f8b902ac3058b44b0f11a236df606082383. Reason for revert: does not fix the problem, I'll fix in another way Original change's description: > Discard deps that are not sync'ed anymore in safetynet_compare.py. > > The job is currently blocked by the tools/gyp directory, which is being > downloaded in the "before" branch, but is not ignored anymore in the > "after" branch, making it an uncommited change. > > Change-Id: I9aca33e2046fbbe2626431febcbbdbebe1937f3b > Reviewed-on: https://pdfium-review.googlesource.com/42110 > Reviewed-by: Ryan Harrison <rharrison@chromium.org> > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I840004d0d9c8d83340fdd0b4d701859cc628f9e6 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://pdfium-review.googlesource.com/42190 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-06Discard deps that are not sync'ed anymore in safetynet_compare.py.chromium/3545Henrique Nakashima
The job is currently blocked by the tools/gyp directory, which is being downloaded in the "before" branch, but is not ignored anymore in the "after" branch, making it an uncommited change. Change-Id: I9aca33e2046fbbe2626431febcbbdbebe1937f3b Reviewed-on: https://pdfium-review.googlesource.com/42110 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-31Test for radial shading when start is a point on border of end circle.Henrique Nakashima
Bug: pdfium:1140 Change-Id: I306b7be5ea2732742e90e416f58c11bcaf8cbaf6 Reviewed-on: https://pdfium-review.googlesource.com/41770 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-31Fix radial shading when start circle is a point in the center of end circle.Henrique Nakashima
The bug also requires end circle to be tiny (radius of < 0.01). Bug: pdfium:1140 Change-Id: I2b355f44f0383334b8988fe41f82cb3f587e9909 Reviewed-on: https://pdfium-review.googlesource.com/41672 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-30Add unit test for AutoRestorer<> on smart pointer types.Tom Sepez
Test UnownedPtr<> and RetainPtr<>. We cannot operate against std::unique_ptr<> because we need a copyable type. Add test for self-reassignment on going out of scope. Move one test helper class to testing/ so it can be shared among unit tests. Allow it to recognize if it ever gets "destroyed", otherwise we can't be sure Retain/Release applied in the correct order. Change-Id: I13056094c70079f7283cbc7600948f81a64874b4 Reviewed-on: https://pdfium-review.googlesource.com/41690 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-30Use pdfium::span<> arg in A85 and RLE encoder methodsTom Sepez
Change-Id: Iff900bc3e1cd9c9dd6b023230c1feba78759581c Reviewed-on: https://pdfium-review.googlesource.com/41710 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use pdfium::span<> in more image modulesTom Sepez
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3 Reviewed-on: https://pdfium-review.googlesource.com/41550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-28Handle non-printing characters at beginning of extraction regionRyan Harrison
Currently if a text extraction region begins on a non-printing character then "" will be returned. This is the incorrect behaviour, instead the call should scan ahead until a printing character is found and start extracting from there. Also proactively adds a similar check and scan for the end of the extraction region. BUG=pdfium:1139 Change-Id: Ia2001ac89740f3d31d2bb69e8000773f8b01091b Reviewed-on: https://pdfium-review.googlesource.com/41532 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
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-27Roll v8/ 9cf8abb7c..ff6b34b46 (689 commits)Lei Zhang
https://chromium.googlesource.com/v8/v8.git/+log/9cf8abb7ce7e..ff6b34b468c1 This updates V8 to 6.8.44. There has been changes to how JS handles timezones. [1] Update the test expectations to match the new behavior, even though it deviates from Acrobat, which still has the old behavior. BUG=pdfium:1075 [1] https://github.com/tc39/ecma262/pull/778 Change-Id: I63f0df9cd423ceee5b8d1008ba12a47ca84bbd6d Reviewed-on: https://pdfium-review.googlesource.com/41450 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-24Fix a bug in make_expected.sh.Lei Zhang
$SEND_EVENTS should not have been put in quotes. Change-Id: Ia6bf7d1ac463c320c0afccf819becbb0cebf13ab Reviewed-on: https://pdfium-review.googlesource.com/41330 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@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-08-22Properly handle language markers in decoded textRyan Harrison
In text like document title 0x001B is used as a marker for the beginning/end of a language metadata section. Currently PDFium does nothing with this data, but when returning the 'decoded' text it needs to be stripped out. The existing code assumed that the two bytes following a marker would be the data to be removed and did nothing to track if it was in/out of one of these regions. This led to a situation where it would always strip the two bytes following the region, since it assumed the end marker was the beginning of a new region. This CL corrects the detection and handling of these regions, and adds a regression test for the reported bug. BUG=pdfium:182 Change-Id: I92ddba5666274a8986fed03f502a0331f150f7ac Reviewed-on: https://pdfium-review.googlesource.com/41070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-21Remove excessive padding above and below PDF417 barcodes.Henrique Nakashima
Bug: pdfium:1135 Change-Id: Iea16a65a5eebcb914192eb49de17a2c4eda83320 Reviewed-on: https://pdfium-review.googlesource.com/40690 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-21Optimize rendering of two dimensional barcodes: defer upscale.Henrique Nakashima
Defer upscaling as late as possible so that intermediary data structures are smaller. Made a couple of changes along the way to preserve the barcode correctness and fix some padding issues. For my example, this is a ~21x improvement in rendering time, down from ~190ms per barcode to ~9ms. Bug: 872907, pdfium:1135 Change-Id: If532e0f168f02fea9c31d473f34c0009da4f4612 Reviewed-on: https://pdfium-review.googlesource.com/40010 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-16Add a way to save a barcode generated bitmap to a .png.Henrique Nakashima
This is useful for debugging and validation purposes. The hashes that are in BarcodeTest are not necessarily for valid outputs. This CL refactors the code in embedder_test.png that already does this, moving it to testing/utils where unit tests can access it too. Bug: pdfium:1135 Change-Id: I6f1d70a4e133f8f04dbe52646087f99c448e95f8 Reviewed-on: https://pdfium-review.googlesource.com/40152 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-16Optimize rendering of two dimensional barcodes: deduplicate regions.Henrique Nakashima
Reduce the logical size of the barcode by removing unnecessary region duplication. As far as I can tell, the line thickness is useless and the aspect ratio causes arbitrary changes in rounding, but ultimately the dimensions of a barcode are defined by its width and height, rather than by this ratio. The improvement with this CL is from ~580ms to ~390ms per barcode, so about 1.5x. Combined with https://pdfium-review.googlesource.com/c/pdfium/+/40010 the improvement is to ~15ms, which is about 39x. This also fixes the rendering of the barcode in the pixel and corpus tests. You can verify this pointing a barcode reader app at the screen. It does not however fix every case, as the unit test is still unreadable. Bug: 872907, pdfium:1135 Change-Id: Ic28e60f54719552cfe69ace7ebc3f730c338a129 Reviewed-on: https://pdfium-review.googlesource.com/40030 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-14Remove CFX_BufferSeekableReadStream.Lei Zhang
Replace it with CFX_ReadOnlyMemoryStream, which does the same thing. Take some checks from CFX_BufferSeekableReadStream and add them CFX_ReadOnlyMemoryStream. Change-Id: I25554c3aec3ec96967f8df16ca68a64dba121b6f Reviewed-on: https://pdfium-review.googlesource.com/40070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>