feat(libcairo): implement cairo_in_fill #19529
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19529"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by maxperso on 2026-11-13T13:38:16Z.
What
Implements
cairo_in_fillin libcairo: whether a point is inside the current path under the context's fill rule.InFill.cppports the winding test of Cairo 1.18.0 (src/cairo-path-in-fill.c), its curve flattening (_cairo_spline_decomposeinsrc/cairo-spline.c) and its unclamped 24.8 conversion (_cairo_fixed_from_doubleinsrc/cairo-fixed-private.h), with the Cairo licence header as the other derived files carry it.cairo_in_fillinContext.cppfeeds it the stored path elements. It returns 0 for a null or failed context and for a path whose fill is empty (no curve and no line that moves), transforms the query with the current matrix and the target's device scale, ignores a pendingcairo_move_toas Cairo does, closes the last subpath, and answers 1 on an edge before reading the fill rule.NotImplemented_nid_no_patchand are recorded indocs/dev/debt/libcairo.md: a query whose device coordinates are not finite (Cairo skips the transform while it tracks its matrices as identity, a flag this context does not keep) and, off the edges, a fill rule other than winding and even-odd (Cairo reachesASSERT_NOT_REACHED).guest_cairo_in_fillonly uses public exports, so it can stay as a regression test for that port._cairo_in_fill_curve_toreturns when_cairo_spline_initfails), and the query wraps every 16777216 device units.Tested
macOS 26.6.2 on an Apple M3 Pro, full build for x86-64 run under Rosetta 2 (Apple clang 21.0.0, Release), at
main174899a5cc:ctest -R guest_cairo: 13 of 13 pass, including the newguest_cairo_in_fill. It checks hand-derived cases (edges, corners, ties of the 1/256 rounding, both fill rules, implicit closing, pending moves, lone points, the matrix and the device scale, curve apexes, the dropped curves, the two throwing inputs), 36000 probes on random polygons against an independent winding-number count (2285 inside, 21744 outside, 11971 on an edge) and 5293 probes on random curves against a 512-step flattening, skipping probes within 0.75 of the curve.public_headers,export_gapandprogress_reportpass.InFill.cppreturned the same edge flag and winding as a Python transliteration of the Cairo sources on 300000 random queries (coordinates up to the 32-bit limits, so integer wrap-around included) and the same fixed-point value on 75175 doubles. The same 12000 queries ran clean under AddressSanitizer and UndefinedBehaviorSanitizer.guest_cairo_in_fillfail.Not tested on Linux or Windows. Not compared with a native Cairo build or a console.
cairo_in_fillstays in the pending count of the progress report because of its two throwing inputs.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T05:07:02Z.
Review: APPROVED
Reviewed — looks good
The implementation and its regression test are coherent at the reviewed head; author-reported checks were not run in this review.
What I ran
Reviewed head
8d38a62c4518d905fbb2700eab6a19e816ab23f1. I read the prepared description, commits, manifest, diff, and the full text of changedInFill.cpp, plus relevantContext.hppandContext.cppcontext usingrepo_read.py. No test or build command was run. The author reports macOS tests and external comparisons in the PR description; these were not independently verified.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not read the full text of every changed file or run the reported checks. The included changed-file content for
Context.cppwas inspected around the implementation, andInFill.cppwas read in full. Other changed files, includingGuestCairoInFill.cpp, were inspected through the diff only. The manifest indicates the changed files are included;files.jsonwas not available through the reader. The author reports no Linux or Windows run, native Cairo comparison, or console measurement.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T15:23:21Z.
Review: COMMENTED
This head conflicts with current main in the cairo CMake target, context, export table, and inventory header. The current
cairo_in_fillexport still uses the stub, so the important integration is to move its binding to the new typed implementation while retaining the other cairo changes on main.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.