chore(deps): update module github.com/go-gfx/gfx to v0.16.0 - autoclosed - #20
Closed
tannevaled wants to merge 1 commit into
Closed
chore(deps): update module github.com/go-gfx/gfx to v0.16.0 - autoclosed#20tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v0.1.0→v0.16.0Release Notes
go-gfx/gfx (github.com/go-gfx/gfx)
v0.16.0: — the registry writes tooCompare Source
codec.Encodewrites PNG, JPEG, GIF, TIFF and BMP, each through the same reference library that reads it. Nothing here encodes anything itself.The registry could read eleven formats and write none, so every consumer that had a picture and needed a file wrote its own encoder call — and a PDF toolkit that can draw a page could not offer "PDF to PNG".
Reading and writing are not symmetric, and the gap is not an oversight: a reference decoder exists in pure Go for every format
Sniffnames, a reference encoder for five of them. WEBP, ICO, ICNS, PNM, QOI, JP2 and JBIG2 returnErrCannotEncoderather than something in another format under the asked-for name.CanEncodesays which way a format goes without having to fail to find out.Alpha survives into PNG and TIFF. The other three do not, and what they are given is the image composited onto white — chosen here rather than left to the encoder, because an encoder that simply drops the channel puts the colour that was under the transparency into the file, and for a page drawn on transparent ground that is black.
100% statement coverage,
go vetand-raceclean, nine cross-compile targets, CGO-free.v0.15.0: — a JBIG2 decoder that reads real scansCompare Source
The JBIG2 decoder now comes from a fork carrying one fix, offered upstream as dkrisman/gobig2#2.
Upstream's per-symbol pixel cap defaults to 4 megapixels, on the reasoning that a real glyph is "tens of pixels per side". Real scanned documents disagree: some encoders emit a page-sized region as one symbol. Of 403 JBIG2 streams taken from the
/Maskand/SMaskentries of public Internet Archive scans, 7 are refused at that default — they need between 7 and 8 MP for a single symbol, and poppler reads all of them at its own defaults.A consumer could not simply raise it: the limits are process-global variables, so a library that raised them would raise them for everything else in the binary.
The fix defaults the per-symbol cap to the aggregate cap, which is charged for every symbol three statements later and so already bounds the work — a per-symbol cap below the aggregate forbids a shape, not an amount of work.
With it the same 403 streams decode 403 of 403, every one bit-exact with poppler's own decoder, compared by extracting the image rather than rendering the page.
The fork also ends this module's dependency on an untagged one. It is meant to end: the day upstream tags a release carrying the fix, this goes back.
100% statement coverage,
go vetand-raceclean, nine cross-compile targets, CGO-free.v0.14.0: — the JBIG2 a container embedsCompare Source
codec.DecodeEmbeddedJBIG2reads the headerless form of JBIG2 — segments and nothing else, with the shared ones handed in separately — which is what a PDF stores in a/JBIG2Decodestream.v0.13.0 added JBIG2 as a file. The embedded form carries no signature and its globals cannot be guessed from the stream, so it cannot be sniffed and sits outside
Decode's contract on purpose.It is here so that one package names the JBIG2 decoder. That matters more than usual for this format: the reference decoder's resource limits are process-global rather than per-decode, so a library cannot raise them without changing them for everything else in the binary, and it publishes no tagged version.
Globals that make no sense do not stop a stream that does not read them — which is nearly all of them. Of 403 JBIG2 streams in a corpus of scanned documents, none named a globals stream.
100% statement coverage,
go vetand-raceclean, nine cross-compile targets, CGO-free.v0.13.0: — JBIG2, the ink layer of a scanned pageCompare Source
codecreads JBIG2, the format a scanned page's ink is stored in. A modern scan is two images — a low-resolution colour background as JPEG 2000, and a high-resolution bitonal ink layer over it as JBIG2. v0.12.0 could read the background; this reads the ink.No decoder is reimplemented, as for every other format in the package. Choosing the reference was the work: four pure-Go candidates exist and all four advertise full segment coverage. 403 JBIG2 masks were extracted from real scanned documents and every pixel compared against poppler's own decoder.
The candidate that decodes the most is wrong nearly everywhere. Counting successes would have picked it; comparing pixels is what did not.
The headerless form a PDF embeds carries no signature and is deliberately not sniffed — a PDF consumer learns the format from the image dictionary.
TestTheEmbeddedFormCarriesNoSignatureholds that line.100% statement coverage,
go vetand-raceclean, nine cross-compile targets including big-endian s390x,CGO_ENABLED=0.v0.12.0: — JPEG 2000, which is what a scanned page is stored inCompare Source
JPEG 2000 — which is what a scanned page is stored in
This package reimplements no decoder. It sniffs a container and hands it to a pure-Go reference. JPEG 2000 was the one shape it did not know, and that mattered more than anyone had measured.
Extending the corpus to where a scanned page actually lives says so plainly. Per population, the share of documents carrying a JPEG 2000 image, and the pages that have nothing else on them at all:
The last two rows are why this was nearly not done. Measured over forms alone, JPEG 2000 looks like eleven files in sixteen hundred and not worth a decoder. That figure was about the corpus, not about the world.
Not written here, and not written at all
github.com/ajroetker/go-jpeg2000is 20 050 lines of pure Go — EBCOT, the wavelet transforms, the MQ coder, tag trees, packets, both the JP2 container and the bare codestream, decoder and encoder, with its own conformance suite and no cgo. Writing a second one would be the reference-library rule broken in its plainest case.Checked rather than assumed:
js/wasmands390xincluded, despite carrying a SIMD dependency;Two shapes, one picture
A JP2 file opens with the twelve-byte signature box. A PDF's
/JPXDecodestream is usually the bare codestream, which opens withSOCimmediately followed bySIZ.Sniffknows both, because in the wild almost every scanned page is one of them.A test that was wrong about the format
It asserted that half a codestream is refused. It is not, and should not be: JPEG 2000 is progressive by construction, so a codestream cut short is a coarser picture of the same size — the opposite of a Flate stream cut short. A decoder that refused it would throw away a page every other reader shows. The test now says that, and a separate one says that something which merely opens like a codestream and continues into nonsense is still refused.
100% statement coverage,
go vetand-raceclean, nine cross-compile targets.v0.11.0Compare Source
v0.10.0: — a stroke is one shapeCompare Source
A stroke was rasterised a piece at a time and the pieces combined by keeping the greater coverage of each pixel. That is not a union: where two pieces meet along a shared edge each covers part of the pixel that edge cuts, and the greater of two halves is a half. A curve cut into thousands of short segments — how every plotting program writes one — came out at about half the colour it was asked for, combed through with a lighter notch at every vertex.
Every piece now goes into one edge list, wound the same way round, filled once under the nonzero rule. Round ends and corners are stepped polygons within a hundredth of a pixel of the circle; a round join draws only the outside of the turn, a round cap only the half past the end.
Filling now sweeps an index of the edges instead of asking every edge about every scanline:
The stroke parity test compared against a reimplementation of the code being replaced, so it asserted the defect; it now compares against a definition — every point within half a width of the line — over 604 shape/width/clamp combinations.
Full details in #18.
v0.9.0Compare Source
v0.8.0Compare Source
v0.7.0Compare Source
v0.6.0Compare Source
v0.5.1Compare Source
color: inlinable, allocation-light HSV/HSL/HWB conversions (#9). Bit-identical fast paths (minMax3/absf, dropped no-op hue wrap, arithmetic Mod); inverse ~16% faster, zero-alloc unchanged. No API change.
v0.5.0Compare Source
v0.4.0Compare Source
v0.3.0Compare Source
v0.2.1Compare Source
v0.2.0Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.