feat(libcairo): implement eleven owned path-data and current-point exports #15324
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15324"
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 hyvvs on 2026-11-02T23:58:47Z.
What
Implement 11 Cairo path-data lifecycle/current-point exports, guest-visible owned path ABI, fixed-point quantization and error propagation. Merge after #15317, not a renderer.
Tested
Windows MinGW C++20 -DNDEBUG DLL-linked guest path PASS (2,048 loops); Ubuntu WSL -DNDEBUG ASan+UBSan/leak check PASS; 1,024 randomized native Cairo1.18 path sequences PASS; headers/progress/conventions PASS. Full integrated CMake/CTest and PS5 console not tested.
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)Detailed implementation and verification notes
Summary
Implement eleven additional real Cairo path-data exports: cairo_new_path, new_sub_path, move_to, line_to, curve_to, close_path, has_current_point, get_current_point, copy_path, append_path and path_destroy.
This is device-space 24.8 fixed-grid path storage, with Cairo-compatible move/line/cubic/close records, current/subpath points, real guest-visible CairoPath/CairoPathData layout and owned arrays. cairo_copy_path converts device points through the current inverse CTM; cairo_append_path applies the destination CTM. cairo_save/restore does not rewind the path.
Independent native Cairo 1.18.0 review identified and prompted fixes for nonfinite/saturated fixed-point conversion, redundant line/degenerate cubic canonicalization, extended path record lengths, propagation of incoming error path status and get_current_point on errored contexts. These are now covered by focused guest regression tests.
Verification
Dependency order
#14327 (surfaces) -> #15315 (context/CTM) -> #15317 (graphics state) -> this PR (path data); #14258 matrix has already merged. This branch includes ancestor commits; refresh review/merge base after parents land. Existing #14328/#14329 Cairo font options/regions and another contributor's #15208 gradient patterns share Export/inventory/CMake/debt and may need coordinated merge, but no path exports are duplicated.
Actual rendering, fill/stroke, clipping, arc/rectangle, path extents, and firmware hardware differential remain unimplemented. No claim of a finished Cairo rasterizer or upstream coverage before merge.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T01:17:55Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The exact-head review confirms two Cairo path-behavior mismatches: device scaling is omitted from path/current-point conversions, and consecutive forward-collinear lines are not coalesced.
What I ran
Reviewed all 14 changed files at head
6c786800814b5d4cc2e07c65e5e3554069d5f367against PR base5cb015caaaaf83f8ee431414ee6a457b5b307d49. The exact-head preview against currentmain(7feb37ee3e30e10139b483fb4df689d5b5b69ab8) is clean. Environment: Debian Linux x86_64, Python 3.11.2, GCC 12.2.0; native Cairo runtime 1.16.0. No AnyPS5 build was run.Results
Commands and unedited output
The precheck's ABI and test-quality helper invocations failed because those optional scripts are absent from its isolated snapshot. I ran the ABI audit and test-quality heuristic from the workspace separately; I manually checked the reported test registration flags against the PR's CMake entries.
Negative control
The native Cairo runtime calls are reference-behavior checks, not negative controls for the PR implementation.
Findings
Blocking
DevicePointapplies onlystate->matrix, whilecairo_surface_set_device_scalestores a separate scale on the target.cairo_get_current_pointandcairo_copy_pathinvert only the context matrix as well. With identity CTM, scale 2 andmove_to(0.1, 0.1), native Cairo returns0.099609375from both APIs; the PR's current conversion rounds0.1directly to0.1015625. Apply the target device transform consistently when recording points and its inverse when returning/copying/appending them, or reject non-default device transforms until supported. Add a non-unit-scale regression test.AppendLineadds a second line formove_to(0,0); line_to(1,1); line_to(2,2), while Cairo stores onlyM(0,0), L(2,2). It also retains a degenerate first line formove_to(0,0); line_to(0,0); line_to(1,1), while Cairo replaces it withM(0,0), L(1,1). Implement and test Cairo's forward-collinear merge and degenerate-line replacement rules. If either behavior remains intentionally unsupported, state that gap in the libcairo debt entry; it is not currently recorded there.Non-blocking
The PR is stacked after #14327, #14328, #14329, #15315 and #15317. The current-main preview is clean; preserve that landing order and revisit integration when the dependency heads settle.
Sources
Not verified
I did not build AnyPS5, run its CTest suites, test on other host operating systems, or test console behavior. I did not run Cairo 1.18.6 locally; its pinned implementation source was read, and the runtime reproduction used installed Cairo 1.16.0. The PR's hosted checks were pending. GPU/console behavior is not relevant to this CPU-side Cairo change.
To get this to a good state
Address both path mismatches with regression coverage, or explicitly record the intentionally unsupported behavior in the debt entry. After the next head, I will rerun the exact-head precheck, diff/convention and ABI audits, the focused Cairo tests when an applicable built test environment is available, and the hosted-check refresh.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T06:23:42Z.
Review: CHANGES_REQUESTED
Re-checked — new head, changes requested
The two earlier path-behavior findings are addressed, but the exact-head Windows CTest run still fails at startup in the new
guest_cairo_surfacetarget.What I ran
The open PR is at head
35a1879fab9e1ff9ebc3c9e3cfb57075b6ab41a7against PR base5cb015caaaaf83f8ee431414ee6a457b5b307d49. My previous full review read all 14 changed files at6c786800814b5d4cc2e07c65e5e3554069d5f367; this re-check compared that head with the current one and inspected all six files changed since then, including the path-scale/canonicalization changes and their tests. A fresh stack preview against currentmaind1ae628bc2f62459cce1e9872ba5632c938c71f2is clean. Environment: Debian Linux 6.1 x86_64, Python 3.11.2, Git 2.39.5 and GCC 12.2.0; no local AnyPS5 build was run.Results
guest_cairo_surfaceexits with0xc0000135; the other four Cairo tests pass.Full precheck table and selected unedited output
git diff --check 5cb015caaaaf83f8ee431414ee6a457b5b307d49...35a1879fab9e1ff9ebc3c9e3cfb57075b6ab41a7/usr/bin/python3 tools/check_conventions.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head 35a1879fab9e1ff9ebc3c9e3cfb57075b6ab41a7 --title feat(libcairo): implement eleven owned path-data and current-point exports --body /tmp/anyps5-pr-precheck/15324-session-20261103/pr-body.md/usr/bin/python3 tools/pr_abi_audit.py --base 5cb015caaaaf83f8ee431414ee6a457b5b307d49 --head 35a1879fab9e1ff9ebc3c9e3cfb57075b6ab41a7 --json(the helper is absent in the isolated snapshot; I ran it separately from the workspace)tools/module has a sibling Python unit-test suite.test_*.pyfiles./usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 15324 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/15324-session-20261103/stackThe precheck reported the stable exact head/base and conventions result:
The manual ABI audit result was:
The overlap helper's exact error was:
Windows CTest excerpts from the exact-head job:
The current check summary is:
Negative control
Not run. The failing surface test exits before its assertions execute, and no local build was run to test a mutation.
Findings
Blocking
The
guest_cairo_surfaceCTest target links the sharedlibclibrary but does not add its runtime directory toPATHon Windows. It exits immediately with0xc0000135; the neighboring tests configure a DLL search path. Please add the required runtime directory to this test's Windows environment (for example,$<TARGET_FILE_DIR:libc>). I attached a line-level CMake suggestion.Non-blocking
#14327 → #14328 → #14329 → #15315 → #15317 → #15324. The stack checker reports clean individual previews, but says the current #14328/#14329 heads are not included by dependent #15315; preserve the landing order and refresh integration checks after those dependencies advance.Sources
libcshared target and subdirectoryNot verified
I did not run a local build or CTest, Linux execution or PS5 console behavior. The repository's Linux and specialized hosted jobs were skipped. The AMD report is a posted result, not a run I performed. The full PR-overlap scan remains unverified because the helper returned malformed JSON.
To get this to a good state
Add the missing Windows DLL search path for
guest_cairo_surface, then rerun the Windows test job and the required checks on the new head. I will repeat the exact-head precheck and review the updated results.