Commit Graph

1537 Commits

Author SHA1 Message Date
Jason Nelson
1ef2e127a6
Improve Code Quality (#818)
* Make AdobeFontMetricsLigature a struct

* Make AdobeFontMetricsCharacterSize a struct

* Eliminate allocation in CompactFontFormatData

* Pass TransformationMatrix  by reference

* Seal Encoding classes

* Make SubTableHeaderEntry a readonly struct

* Introduce StringSplitter and eliminate various allocations in GlyphListFactory

* Eliminate a few substring allocations

* Use char overload on StringBuilder

* Eliminate virtual calls on stringIndex

* Optimize ReadHelper ReadLong and ReadInt methods

* Add additional readonly annotations to PdfRectangle

* Optimize NameTokenizer

* Eliminate allocation in TrueTypeGlyphTableSubsetter

* Use empty arrays

* Eliminate allocations in OperationWriteHelper.WriteHex

* Use simplified DecryptCbc method on .NET 6+

* Fix windows-1252 encoding not working on net6.0 and 8.0

* Update int buffers to exact unsigned max length and eliminate additional byte allocation

* Fix typo

* Remove unused constant
2024-04-18 19:58:40 +01:00
Jason Nelson
0f7077b257 Improve stream overrides 2024-04-12 07:42:19 +01:00
Jason Nelson
90e07bc639 Eliminate allocations in PatternParser, PdfFunctionParser, and ShadingParser 2024-04-12 07:42:19 +01:00
Jason Nelson
c3a2e8c08f Rename TryGetMemory -> TryGetBytesAsMemory 2024-04-12 07:42:19 +01:00
Jason Nelson
fc1a41ffbb Remove unused StreamHelper methods 2024-04-12 07:42:19 +01:00
Jason Nelson
a5e9b438cc Eliminate allocation in BasePageFactory 2024-04-12 07:42:19 +01:00
Jason Nelson
215e12543c Format ImageHeader 2024-04-12 07:42:19 +01:00
Jason Nelson
a68febfa95 React to IPdfImage change 2024-04-12 07:42:19 +01:00
Jason Nelson
49c155cca2 Add IPdfImage.RawBytes 2024-04-12 07:42:19 +01:00
Jason Nelson
bd95adf4bc Optimize RunLengthFilter 2024-04-12 07:42:19 +01:00
Jason Nelson
b498f5a076 Eliminate allocation in AsciiHexDecodeFilter 2024-04-12 07:42:19 +01:00
Jason Nelson
d85ea4f95d Update Filters to operate over Spans 2024-04-12 07:42:19 +01:00
Jason Nelson
0efa68a8e4 Optimize Crc32 calculations 2024-04-12 07:42:19 +01:00
Jason Nelson
4ad6bfc74e [Fonts] Add Encoding.GetString(ReadOnlySpan<byte>) polyfill 2024-04-12 07:42:19 +01:00
Jason Nelson
ce5dc7c1a1 Eliminate byte[] allocation in RC4 2024-04-12 07:42:19 +01:00
Jason Nelson
fba5b60718 [Fonts] Add Stream.Write(Span<byte>) polyfill 2024-04-12 07:42:19 +01:00
Jason Nelson
e01bf5e849 Spanify IInputBytes 2024-04-12 07:42:19 +01:00
Jason Nelson
775d1343ae Spanify PngBuilder 2024-04-12 07:42:19 +01:00
Jason Nelson
435da86a25 Make QuadPointsQuadrilateral a readonly struct 2024-04-12 07:42:19 +01:00
Jason Nelson
8babdfdda5 Reduce ColorSpaceDetails virtual calls 2024-04-12 07:42:19 +01:00
Jason Nelson
4fcc5c6c57 Eliminate a few allocations in ColorSpace transformers 2024-04-12 07:42:19 +01:00
Jason Nelson
6d54355754 Spanify filters 2024-04-12 07:42:19 +01:00
BobLd
2d6cb1aa0c Properly implement Quadtratic and Cubic bezier-curves and use Quadtratic in CalculatePath to fix #625 2024-04-05 11:33:59 +01:00
Jason Nelson
f62929eb7c
Spanify work 1 (#812)
* Add GetString(ReadOnlySpan<byte>) polyfill

* Add ArrayPoolBufferWriter

* Use Utf8.IsValid & char.IsAsciiHexDigit on NET8.0+

* Optimize HexTokenizer

* Eliminate various Tuple allocations

* Eliminate List allocation in CrossReferenceTable

* Eliminate various allocations in Ascii85Filter

* Spanify HexToken

* Spanify Palette

* Spanify various Cmap & font methods

* Spanify Type1Charstring classes

* Spanify PdfDocEncoding.TryConvertBytesToString

* Spanify OctalHelpers.FromOctalDigits

* Add missing braces

* React to HexToken.Byte type changes

* Cleanup

* [Tests] React to span changes

* Add ArgumentNullException check back to Type1CharstringDecryptedBytes

* Remove unsafe code

* Seal HexToken

* Avoid allocation when passing an empty span
2024-04-01 09:18:01 +01:00
BobLd
e789691100
Fix #807 (#808) 2024-03-23 19:25:40 +00:00
Jason Nelson
69e2b7bb08
Improve Code Quality 3 (#805)
* Throw when trying to inverse a matrix with a determinant of 0

* Optimize Hex.GetString on .NET

* Updates tests for Matrix3x3.Inverse() change

* Eliminate allocation in InternalStringExtensions

* Use vectorized Span.Fill method

* Eliminate various string allocations when parsing numbers

* Remove unused using statements

* Fix Matrix3x3 Equals nullability
2024-03-17 21:13:32 +00:00
Jason Nelson
a412a239be
Enable nullable annotations (#803)
* Enable nullable annotations

* Remove unused Jetbrain annotations

* Ensure system using statements are first

* Improve nullability annotations

* Annotate encryptionDictionary is non-null when IsEncrypted is true

* Disable nullable for PdfTokenScanner.Get

* Improve nullability annotations for ObjectLocationProvider.TryGetCached

* Revert changes to RGBWorkingSpace

* Update UglyToad.PdfPig.Package with new framework targets (fixes nightly builds)
2024-03-17 18:51:40 +00:00
BobLd
bf6c519483 Make AnnotationProvider public 2024-03-16 12:50:26 +00:00
BobLd
8163d9ff89 Update run_integration_tests.yml 2024-03-16 12:44:03 +00:00
Jason Nelson
95f0459900 Prefer is null to == null
ensures that an equals overload isn't use, and we don't compare structs
2024-03-16 12:37:51 +00:00
Jason Nelson
d19e6ad510 Use collection expressions 2024-03-16 12:37:51 +00:00
Jason Nelson
524b235502 Enable nullable annotations 2024-03-16 12:37:51 +00:00
Jason Nelson
9859c2672b Use switch expressions 2024-03-16 12:37:51 +00:00
Jason Nelson
dca11253a0 Spanify Crc32 2024-03-16 12:37:51 +00:00
Jason Nelson
77705bbd67 Spanify Adler32Checksum 2024-03-16 12:37:51 +00:00
Ian McCubbin
9056d2bdff Removed mistaken bracket in text replace operation 2024-03-16 07:58:32 +00:00
Jason Nelson
321f321e53 Replace obsolete netcoreapp test target with net471 2024-03-16 07:40:17 +00:00
Jason Nelson
1d2777d59a [Tests] Enable implict usings 2024-03-16 07:40:17 +00:00
Jason Nelson
4e1c7930b7 Update xunit 2024-03-16 07:40:17 +00:00
Jason Nelson
d413d24d96 Drop net6.0 from tests 2024-03-15 13:10:25 +00:00
Jason Nelson
f1ebaab26d [CI] Update windows to 2022, and install net8.0 (part 2) 2024-03-15 13:10:25 +00:00
Jason Nelson
247303983a Use BinaryPrimitives 2024-03-15 13:10:25 +00:00
Jason Nelson
03fd2832ac [CI] Install net8.0 2024-03-15 13:10:25 +00:00
Jason Nelson
a97ee27030 Use vectorized SequenceEqual method 2024-03-15 13:10:25 +00:00
Jason Nelson
907181d5ce Bump .net4.7 target to .net4.7.1 and eliminate System.ValueTuple depedency 2024-03-15 13:10:25 +00:00
Jason Nelson
0f01f7b8ca Add net8.0 to test project 2024-03-15 13:10:25 +00:00
Jason Nelson
f88611ca4a Replace concat with collection expressions 2024-03-15 13:10:25 +00:00
Jason Nelson
c2541b815a Use HashCode.Combine 2024-03-15 13:10:25 +00:00
Jason Nelson
3eb01a1e0c Add missing braces 2024-03-15 13:10:25 +00:00
Jason Nelson
834fb350a3 Use Array.Empty 2024-03-15 13:10:25 +00:00