Age | Commit message (Collapse) | Author |
|
Make CBC_Writer::SetWideNarrowRatio() virtual instead. Do the same for
SetStartChar(), SetEndChar(), and SetErrorCorrectionLevel().
Change-Id: I70e87c0e9f8b772331105e57dd26075db3cfcb95
Reviewed-on: https://pdfium-review.googlesource.com/42602
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Make CBC_Writer::SetTextLocation() virtual instead.
Change-Id: I9ac06affe35f3c7bebc2f5ff0917e7146cfe89cc
Reviewed-on: https://pdfium-review.googlesource.com/42601
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
Do the same for a few other CBC_CodeBase methods, instead of trying to
implement virtual methods manually using memory pointers.
Change-Id: Iec0e3a4f8eabc54962c7ac0a00a1b80b192ff474
Reviewed-on: https://pdfium-review.googlesource.com/42600
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Iaeb7f43e442ace403f1522268e63b1a59f223a9d
Reviewed-on: https://pdfium-review.googlesource.com/42599
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Ia165095864ffe2865a5e433d09d0bccad1164d2c
Reviewed-on: https://pdfium-review.googlesource.com/42453
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
FX_CreateFontEncodingEx() always passes FXFM_ENCODING_NONE. Just get rid
of it instead.
Change-Id: I417f84d8ae2f10ba874265a92576d3ef8481a9d6
Reviewed-on: https://pdfium-review.googlesource.com/42460
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I096ba8681d779bb0cc1d7aaaedcd9f68020d5b37
Reviewed-on: https://pdfium-review.googlesource.com/42452
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Rearrange them as well.
Change-Id: I8653004cd06a4054e32d0148adc1400029ceb34e
Reviewed-on: https://pdfium-review.googlesource.com/42459
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Currently ClusterFuzz is timing out when running cases that cause a
large number of calls to this method. Looking at the cases, I believe
these to be valid calls, so this CL attempts to lower the cost of
making each individual call.
Adds in pre-allocation of a vector that has a fixed size and uses a
const-ref for passing in |msg| to avoid copying.
BUG=chromium:881678
Change-Id: I61ec4dc96e79c84def5b10102cc58a96773ce07f
Reviewed-on: https://pdfium-review.googlesource.com/42230
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
Change-Id: I12893784321f92e5cac2b80653897007b6e63c7e
Reviewed-on: https://pdfium-review.googlesource.com/41111
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I74f3a147914c6483e7d443cff70e09115c424ca5
Reviewed-on: https://pdfium-review.googlesource.com/41091
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
They should appear in the order that they are necessarily called.
Change-Id: I6901d384122003f72b0c43bf1df6260e2e196a7d
Reviewed-on: https://pdfium-review.googlesource.com/41050
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
The flag is unused.
Change-Id: I15eb3e20e6a632ae2aa2afc19cb09d2402e607e0
Reviewed-on: https://pdfium-review.googlesource.com/41031
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I2003d32f3f6972c0102b37ad545316a76b09fd1f
Reviewed-on: https://pdfium-review.googlesource.com/41030
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Change-Id: Icd66f42c240984df6821c2bae640bbfacfa62ad2
Reviewed-on: https://pdfium-review.googlesource.com/41010
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Id15088a40fd308ba91317e95a6fa8075e7306608
Reviewed-on: https://pdfium-review.googlesource.com/40992
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
The value passed was always 0. This also prevented the scaling
from being executed, so that can be removed.
Change-Id: I143a9ed31b231d3b9fa297b0bf9dcc0fa6072889
Reviewed-on: https://pdfium-review.googlesource.com/40990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: I01c83d96f07eac776e8269b7d1e06b2b07ca75ea
Reviewed-on: https://pdfium-review.googlesource.com/40932
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: Ie22666217b040872e576d58d0afa77138bca3870
Reviewed-on: https://pdfium-review.googlesource.com/40931
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
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>
|
|
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>
|
|
This is a ~2x improvement in rendering time, taking my example
down from ~390ms per barcode to ~190ms.
Bug: 872907
Change-Id: Iecddc30edf92ad943765d4382b332e00d493c320
Reviewed-on: https://pdfium-review.googlesource.com/40533
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
The way it was working before is:
Look at the width and height provided for the barcode. If the maximum
number of codewords to fit in that space was within the spec limits
(1 <= cols <= 30 and 3 <= rows <= 90), cram as many codewords as
possible. The unused space was filled with padding.
With this CL, instead look at the amount of content that needs to fit
into the barcode and favor fewer codewords rather than as many as
possible.
Bug: pdfium:1135
Change-Id: Ia96be82ec7c5f4f920cff58def1a44000bf04761
Reviewed-on: https://pdfium-review.googlesource.com/40350
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
By using mincols as fallback, the exact opposite is done. Maxcols
should be used instead to minimize the size.
This is important so the next fix
(https://pdfium-review.googlesource.com/c/pdfium/+/40350)
does not break a test that was working well by coincidence.
Bug: pdfium:1135
Change-Id: I95ddc547654966f655e2556c1796503a5456fb8f
Reviewed-on: https://pdfium-review.googlesource.com/40330
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
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>
|
|
Turns out that "FromUnicode" is misleading in that, on linux, it simply
removes any characters beyond 0xFF and passes the rest unchanged, so
no unicode decoding actually takes place. On Windows, it passes it into
the system function specifying FX_CODEPAGE_DefANSI, converting it into
the so-called "default ANSI code plane", passing some characters,
converting others to '?' and still others to 'A'. Either way, nothing
resembling UTF8 comes out of this, so pick a better name.
These now immediately look suspicious, so a follow-up CL will see
which ones should really be WideString::UTF8Encode() instead.
Making this a normal method on a widestring rather than a static
method on a bytestring feels more natural; this is parallel to
the UTF8Encode and UTF16LE_Encode functions.
Add a test that shows these conversions.
Change-Id: Ia7551b47199eba61b5c328a97bfe9176ac8e583c
Reviewed-on: https://pdfium-review.googlesource.com/39690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This changes the implementation for the specific bug listed and
proactively fixes it in the other overrides. The general bug here is
that if you concat a WideString in a tight loop without first
reserving space, each call will cause an allocation size change and
memcpy. This is very expensive and causes ClusterFuzz cases to
timeout.
BUG=chromium:863295
Change-Id: I6c1d900a31b98cd9ddcf91d1ec0f3973c9cdfa26
Reviewed-on: https://pdfium-review.googlesource.com/38110
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Other cleanups:
Remove unused method.
Fold Init() into constructor.
Return span<> where possible.
Change-Id: Ie38d32efb6e63d86ae24e93684903a6dd900810f
Reviewed-on: https://pdfium-review.googlesource.com/36810
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Remove some string copies in barcode that were noticed whilst
looking for moves.
Change-Id: Ieda34d00f633576ba1f0dca283dcdabfb36f236c
Reviewed-on: https://pdfium-review.googlesource.com/35410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Because its a code smell of a sort.
Change-Id: Id1c1b124f539e31a929701fb9486da9d396d3563
Reviewed-on: https://pdfium-review.googlesource.com/34695
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This fixes a number of instances where a value is written out to a
variable, but never used in the barcode. There are three different
types of fixes employed in this CL. If the non-use is a bug, then
rewrite the code to actually use the value. If it is an assignment
with no side effects, then just remove the entire line. Finally if it
is an assignment of a function return value, cast it to void instead
to clearly mark that the return is being ignored.
Issues found with Clang Static Analyzer.
Change-Id: If13a3684cb2db81592cce9a798788a26fcdb4c6d
Reviewed-on: https://pdfium-review.googlesource.com/33771
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
During encoding, the code is going to walk through every character in
m_msg and determine what values need to be added to m_codewords. The
ceiling on the number of characters being added to m_codewords is the
length of m_msg, so reserving enought space in advance. This prevents
thrash related to incrementing the string and thus resizing in a tight
loop.
BUG=chromium:846027
Change-Id: Icefd6955933f8068feeeee6243e430f60c50d747
Reviewed-on: https://pdfium-review.googlesource.com/32990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Get rid of a few more fxbarcode exception codes.
Change-Id: Ia9c9cdcef581174e25be8dc2fba181915dc6d729
Reviewed-on: https://pdfium-review.googlesource.com/32471
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Rolling two iterations over the input into one, and reserving the
maximum possibly output size to avoid memory thrash when
appending. Under Valgrind this reduces the instruction count by ~200x
BUG=chromium:837610
Change-Id: If12a3b98048b41906a4401d4dcc9470b513e28d2
Reviewed-on: https://pdfium-review.googlesource.com/31731
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Another couple of examples where the slow down in the barcode code
can be fixed by reserving and thus pre-allocating the buffer that
backs the Widestring. Doing += in a tight loop caused reallocation
thrashing.
BUG=chromium:834630
Change-Id: I48a802225351bcaf992c324732fddf81639b4898
Reviewed-on: https://pdfium-review.googlesource.com/31230
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Follow up to request in
https://pdfium-review.googlesource.com/c/pdfium/+/30190
BUG=chromium:802242
Change-Id: I8fddd78d235a195c9782c3f6ced428de965e85eb
Reviewed-on: https://pdfium-review.googlesource.com/30250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
In the test case from the bug, the majority of the time is being spent
resizing Widestring internal buffers, since += is being called in a
tight loop. Since the size of the input being mutated and stored is
known, this CL reserves the space before hand to lower thrashing. This
substantially improves runtime of this test case locally.
BUG=chromium:802242
Change-Id: I5176dabc94634b4d6bc3e9425fe6469a5bf35a41
Reviewed-on: https://pdfium-review.googlesource.com/30190
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
It currently takes const FX_RECT*, but the pointer is never nullptr.
Change-Id: I571e9e8dd04756bc4daa25a61a5af8d1f902914b
Reviewed-on: https://pdfium-review.googlesource.com/30052
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
This might make the memory tools more effective in finding OOBs.
Change-Id: Id093bb0a88c37954c80d612ac00b5a168e75bdbf
Reviewed-on: https://pdfium-review.googlesource.com/29550
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ic1260417e7d1475dd518655b2ab08f0184955d88
Reviewed-on: https://pdfium-review.googlesource.com/27170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Get things out of the .data section.
Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683
Reviewed-on: https://pdfium-review.googlesource.com/27130
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Bug: 806612
Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1
Reviewed-on: https://pdfium-review.googlesource.com/24410
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This is a follow-up to comments from
https://pdfium-review.googlesource.com/c/pdfium/+/22870
Change-Id: Ide35ea5b27ea12d480d979241801c7676b94fe74
Reviewed-on: https://pdfium-review.googlesource.com/22932
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=pdfium:964
Change-Id: Ic306a374bc9b710e2ac043eebe43504e5bd75926
Reviewed-on: https://pdfium-review.googlesource.com/22870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
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>
|
|
Found by GCC.
Change-Id: Ia403c21b1906ba6782b5a763c67a19a56de01716
Reviewed-on: https://pdfium-review.googlesource.com/19810
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Remove unused defines; Move to .cpp files where possible; Fixup values.
Change-Id: I88cd5deb04b14ab8e9f8097a695c3d0b52d64b4c
Reviewed-on: https://pdfium-review.googlesource.com/15130
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This CL simplifies the OS == WIN{32|64} checks to be PLATFORM == WINDOWS
checks.
Change-Id: I1493d316dd457b0228e4ef39db4cf1d2b8abf97d
Reviewed-on: https://pdfium-review.googlesource.com/14870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|