summaryrefslogtreecommitdiff
path: root/testing/resources
AgeCommit message (Collapse)Author
2018-10-24Be more particular about FX objects constructed from JSTom Sepez
This is back-filling some more error cases from the work from a few weeks ago. Replaces a lambda with a static CallHandler() method since the verbosity was increasing. It gets invoked if you try to make a new FXJS object from the javascript side, rather than the C++ side. Making such an object is a little tricky, since we don't give these functions names in V8, but they can be obtained via constructor property from an instance of the object. Change-Id: Ibca686e75338ac54d08a114f36f930cd424a1eb5 Reviewed-on: https://pdfium-review.googlesource.com/c/44534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-23Test color.convert() and equal() from JS (and fix comparison logic).Tom Sepez
Currently, color.equal(a, b) may not give the same result as color.equal(b, a) since arg1 is converted to be the type of arg2, and some of these conversions lose information. Instead promote to the type with the most components in the hope of preserving the most information. Better error message when there are the right number of parameters but the types are wrong. Change-Id: I1d93fa29db4fb65e0f7c07c3ba7d9ca87ebf7bc9 Reviewed-on: https://pdfium-review.googlesource.com/c/44413 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-23Split field.in into field_properties.in and field_methods.inTom Sepez
Matches the conventions of the other JavaScript tests. Change-Id: I9dc41e3964220db03f57b9ab30289e0c19b042da Reviewed-on: https://pdfium-review.googlesource.com/c/44531 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Modernize app.* JS method tests.chromium/3590Tom Sepez
Also add several missing cases. Change-Id: I38aa1fdacf839975249957267ffb121ad609aec5 Reviewed-on: https://pdfium-review.googlesource.com/c/44430 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Consolidate app_*.in tests into app_methods.inTom Sepez
One file per method is excessive. Change-Id: I02e3e9dffd2fc2d98f77f15a4669bd15c0119dd3 Reviewed-on: https://pdfium-review.googlesource.com/c/44412 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-22Add missing property to event_properties.inTom Sepez
Change-Id: I63c2f2c416d3270061fcffd0c9d0a82c10de88d2 Reviewed-on: https://pdfium-review.googlesource.com/c/44411 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Call last uncovered document methods.Tom Sepez
Test-only CL. Change-Id: Ica1613c42075adb5fedfef6d66d99095cef08655 Reviewed-on: https://pdfium-review.googlesource.com/c/44410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Add FPDFFormFillEmbeddertest.DocumentAActions.Tom Sepez
Provides coverage for CJS_EventContext::OnDoc_* methods. Change-Id: I65dff8fe5af4a9c11ac8fffabe209ad497586b1c Reviewed-on: https://pdfium-review.googlesource.com/c/44392 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Fix timezone inconsistency in document methods test.Tom Sepez
We do this by adding an override that forces GM time on everyone when run from the test harness. Generalize presubmit warnings so that the new function passes. De-duplicate lambda capture in place of static function. Change-Id: I15b34bea558baf1763476b36f0bca76614984107 Reviewed-on: https://pdfium-review.googlesource.com/c/44390 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-19Roll v8/ c623fabe5..604c50c84 (9 commits)Lei Zhang
https://chromium.googlesource.com/v8/v8.git/+log/c623fabe5643..604c50c84e67 Version 7.1.132 Update array_buffer JS test to adjust for https://chromium.googlesource.com/v8/v8/+/5cfe1a6b on Windows for 32-bit and ASAN builds. Change-Id: I7cfea684ab56d4a809989a7f029d7fc013eac372 Reviewed-on: https://pdfium-review.googlesource.com/c/44370 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-18Fully populate JS platform callbacks in pdfium_testTom Sepez
Adjust expected results accordingly. Order functions to match platform member order. Change-Id: I3d5f8e3ef8f532af0891b7fbbc1a8305d1922a75 Reviewed-on: https://pdfium-review.googlesource.com/c/44311 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Try assigning more kinds of values to doc propsTom Sepez
Change-Id: I99b28f5f047f9043bd95f76f17970d1979276d63 Reviewed-on: https://pdfium-review.googlesource.com/c/44310 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Expand CJS_Document::mail{Doc,Form}() parametersTom Sepez
Use ExpandKeywordParams() rather than ad-hoc processing. Add test case for {} argument. Change-Id: I1f60a87b3995d62f4bead79245a1f58fd31b102e Reviewed-on: https://pdfium-review.googlesource.com/c/44290 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Remove PrintParams object.Tom Sepez
The only way to theoretically get one is via doc.getPrintParams(), and it always returns in error. Even if one were returend to JS, there aren't any methods/callbacks to change its properties. Even if there were methods to change its properties, the information it stores doesn't align with what is in the JS spec for this object. Even if it were aligned with the JS spec, the way we check for its presence as the ninth parameter in CJS_Document::print() doesn't match the way its use is documented in the spec as the sole first parameter. Instead implement the older, simpler behaviour as spec'd prior to 6.0, and toss this enhancement altogether. Move function to check the result of ExpandKeywordParams() to js_define.h so other files can use it. Update comment in that file to remove reference to deprecated enum. Expand test for API and introduce callback to log parameters. Change-Id: I047e2be0d2afbad91d6b58c6c74bbea083fed330 Reviewed-on: https://pdfium-review.googlesource.com/c/44271 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Push/pop the graphics state stack when flattening.Lei Zhang
When FPDFPage_Flatten() manipulates a content stream, it replaces the content stream with a content stream array. The first element in the array is the original content stream and the second element in the array is the flattened annotations content. To make sure the original content stream's graphics state stack does not affect the flattened annotations, FPDFPage_Flatten() rewrites the original content stream to be: q $contents Q When FPDFPage_Flatten() manipulates a content stream array, it just appends the flattened annotations as a new element in the array. This may result in graphics state stack leaking out. To fix this, wrap the content stream array to be: ["q", $content1, ..., $contentN, "Q"] And then append the flattened annotations. BUG=chromium:896366 Change-Id: Ic6499e39eb4c9f1fe45d037622bf02be724b6cae Reviewed-on: https://pdfium-review.googlesource.com/c/44252 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-18Add JavaScript tests for event API.Tom Sepez
Change-Id: Ic62fd1c6e55e6db5864e124fe3ba50e05b0020e1 Reviewed-on: https://pdfium-review.googlesource.com/c/44210 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-18Add JavaScript public methods tests.Tom Sepez
Still very preliminary. Alphabetize table in .cpp file to match test. Bug: pdfium:1028 Change-Id: Ia3b646507e1a2ec384bf59893cd1d74c2a4b2456 Reviewed-on: https://pdfium-review.googlesource.com/c/43980 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-15Clone dict before iteration in CJS_Document::get_infoTom Sepez
Bug: 895152 Change-Id: I678350841892f88a5d580b58a33a639a1b6ec305 Reviewed-on: https://pdfium-review.googlesource.com/c/44050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add setters/getters for BleedBox and TrimBox.xlou
Since BleedBox and TrimBox are supported according to PDF specification, hence added setters and getters to get the value if exists. Bug:894655 Change-Id: I3c2600450f07665241a4724457a7cbc4282941ed Reviewed-on: https://pdfium-review.googlesource.com/c/43977 Commit-Queue: Shirleen Lou <xlou@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-12Beef up coverage in CJS_Field.Tom Sepez
Still a long way to go, but hit the easy ones first. Alphabetize property names in cjs_field.cpp file. Change-Id: I1ede770a1e159d464287775cf9e19cbaf9f2a62f Reviewed-on: https://pdfium-review.googlesource.com/c/43978 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Beef up CJS_Document method coverage.Tom Sepez
Also alphabetize mailDoc method position in .cpp file. Change-Id: Ifb53e9a6f5f165bb41b865d51dae15e3bc84c4c7 Reviewed-on: https://pdfium-review.googlesource.com/c/43972 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add test for CJS_Annot JS callbacks.Tom Sepez
Change-Id: I8ef9bb333e786e833faca75566730a5b441d63c2 Reviewed-on: https://pdfium-review.googlesource.com/c/43830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add test for CJS_Color properties.Tom Sepez
Return a more precise error in one case. Change-Id: I21e4ef6b30be5f44d35922640643bffb9cb4b5e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43950 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add tests for CJS_Console methods.Tom Sepez
Change-Id: Ie534b26d8241e889ad9cdca942e142cddca44bf4 Reviewed-on: https://pdfium-review.googlesource.com/c/43933 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-12Add minimal pixel test for a rendering bug.Lei Zhang
The test is suppressed because it currently renders incorrectly. BUG=pdfium:632 Change-Id: Ie780e2128ef3a0bcf5f7d57b164ae38f03b1e9fd Reviewed-on: https://pdfium-review.googlesource.com/c/43090 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
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-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-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 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-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-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-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-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-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-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-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-01Bounds check lineSrc in JBig2_Image.cpp.Tom Sepez
No matter how the dimensions might be determined, we know the hard end of the source line, and can use it for a bounds check. We expect the size is quantized to a multiple of m_stride, so as long as each block operates within an m_stride, the initial check should be sufficient. Bug: 867501 Change-Id: Iaf9936557b856f3eb09fef522f3e6738aa4f38f0 Reviewed-on: https://pdfium-review.googlesource.com/39310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>