feat(libcairo): retain solid and surface source patterns #15681

Closed
hyvvs wants to merge 12 commits from upstream-pr/15681 into main
hyvvs commented 2026-11-04 04:10:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-04T04:10:18Z.


What

Implement five formerly throwing guest-callable libcairo source-pattern exports: cairo_set_source_rgb, cairo_set_source_rgba, cairo_set_source, cairo_set_source_surface, and cairo_pattern_create_for_surface. Adds native-style opaque black default context source, clamped solid RGBA and retained surface patterns, user-space offsets as pattern matrices, saved/restored pattern ownership, and sticky source errors. Supports the existing gradient patterns (from #15208), so a caller can pass linear/radial sources to cairo_set_source. Parent #15317 provides context/state; its image-surface parent supplies surface lifetimes. The branch explicitly merges the two independent open PR heads, so their cumulative exports must not be counted as newly introduced by this PR.

Exactly five new callable exports beyond parents #15317 and #15208. No paint, mask, fill, stroke or rasterization is claimed; those stay throwing, and no PS5 console behavior has been verified.

Tested

  • Windows MinGW GCC 15.2, complete CMake build and 3 CTest suites: guest_cairo_graphics_state, guest_cairo_patterns, guest_cairo_source, all pass.
  • Ubuntu WSL GCC + AddressSanitizer, UndefinedBehaviorSanitizer and leak detection, source-linked guest source tests pass.
  • Native Cairo 1.18.0 on Ubuntu: opaque black source, color clamping, saved/restored RGBA, source-pattern type/extend/filter, surface offset matrix under CTM changes, null/invalid image error statuses and reference counts checked against the host oracle.
  • Regression negative control: deliberately reversing surface-source offset in an isolated temporary Context.cpp causes checked-in source tests to abort; production source remains unmutated.
  • Static assertions check all five typed guest System V signatures; inventory/public headers and CMake targets verified; no unsupported path silently succeeds.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #14327, #15315, #15317, #15208
  • Fixes: none
  • Unblocks: source-pattern consumers; not a renderer
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5148707786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15681). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-11-04T04:10:18Z. --- ### What Implement five formerly throwing guest-callable `libcairo` source-pattern exports: `cairo_set_source_rgb`, `cairo_set_source_rgba`, `cairo_set_source`, `cairo_set_source_surface`, and `cairo_pattern_create_for_surface`. Adds native-style opaque black default context source, clamped solid RGBA and retained surface patterns, user-space offsets as pattern matrices, saved/restored pattern ownership, and sticky source errors. Supports the existing gradient patterns (from #15208), so a caller can pass linear/radial sources to `cairo_set_source`. Parent #15317 provides context/state; its image-surface parent supplies surface lifetimes. The branch explicitly merges the two independent open PR heads, so their cumulative exports must not be counted as newly introduced by this PR. **Exactly five new callable exports** beyond parents #15317 and #15208. No paint, mask, fill, stroke or rasterization is claimed; those stay throwing, and no PS5 console behavior has been verified. ### Tested - Windows MinGW GCC 15.2, complete CMake build and 3 CTest suites: `guest_cairo_graphics_state`, `guest_cairo_patterns`, `guest_cairo_source`, all pass. - Ubuntu WSL GCC + AddressSanitizer, UndefinedBehaviorSanitizer and leak detection, source-linked guest source tests pass. - Native Cairo 1.18.0 on Ubuntu: opaque black source, color clamping, saved/restored RGBA, source-pattern type/extend/filter, surface offset matrix under CTM changes, null/invalid image error statuses and reference counts checked against the host oracle. - Regression negative control: deliberately reversing surface-source offset in an isolated temporary Context.cpp causes checked-in source tests to abort; production source remains unmutated. - Static assertions check all five typed guest System V signatures; inventory/public headers and CMake targets verified; no unsupported path silently succeeds. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #14327, #15315, #15317, #15208 - [x] Fixes: none - [x] Unblocks: source-pattern consumers; not a renderer - [x] GPUs tested: n/a - [x] AI-assisted: yes

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15681
No description provided.