feat(libSceNKWebKit): implement the cairo GraphicsContext core #24980

Open
momgaroganuchi-crypto wants to merge 9 commits from upstream-pr/24980 into main
momgaroganuchi-crypto commented 2026-11-21 14:07:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by momgaroganuchi-crypto on 2026-11-21T14:07:29Z.


What

Implements 33 libSceNKWebKit exports that throw on main today: the cairo immediate-mode WebCore::GraphicsContext core and the WebCore::GraphicsContextState lifecycle.

GraphicsContext(PlatformContextCairo*) wraps the cairo context at PlatformContextCairo +0. Implemented operations are construction and destruction, save, restore, translate, scale, applyDeviceScaleFactor, clip, fillRect (state color and explicit color), clearRect, fillPath, strokePath, strokeRect, drawNativeImage, the fill/stroke color and stroke thickness setters, setShouldAntialias, setShouldSmoothFonts, setImageInterpolationQuality, setShadow, clearShadow, drawLineForText, hasPlatformContext, platformContext and getCTM, plus GraphicsContextState construction and destruction. fillPath/strokePath read the Path cairo context at +0, so they work with the Path implementation from #24965 without depending on it. drawNativeImage scales the source rectangle onto the destination with the cairo CTM and cairo_set_source_surface; it supports every blend mode, the default orientation and default interpolation quality, and throws for other orientations and interpolation qualities. Its per-draw ImagePaintingOptions blend mode maps to the cairo operator, with PlusDarker and PlusLighter falling back to OVER as WebKit's cairo backend does, and the CompositeOperator values map from WebCore to cairo: DestinationOver through DestinationAtop shift by one because cairo reserves operator 6 for DEST, XOR maps to 11, PlusDarker to DARKEN, PlusLighter to ADD and Difference to DIFFERENCE. The context-level compositeOperator and blendMode are stored in the state but not applied to fills and strokes, because setCompositeOperation is unimplemented here; global alpha multiplies the source alpha of fillRect, fillPath, strokePath, strokeRect and the drawLineForText underlines.

Layouts: GraphicsContextState is the 96-byte 2020 source layout and GraphicsContext is 144 bytes; both are asserted in src/GraphicsContextAbi.hpp. GraphicsContext keeps a host state stack in its private object and mirrors the cairo save/restore stack.

The 33 exports are declared once in include/GraphicsContextExports.hpp; the duplicate placeholders are removed from include/LegacyExports.hpp, include/InventoryExports.hpp and src/GraphicsContextAbi.hpp. Cairo calls go through the internal _nid_no_patch helpers in libcairo/include/Bridge.hpp and libcairo/Bridge.cpp, the same mechanism as the existing CairoSurfaceDestroy_nid_no_patch, because the NID patcher rewrites libcairo exports but leaves non-SCE imports of a system library unchanged.

Known gaps, recorded in the debt fragment: setShadow records the offset, blur and color but cairo drawing does not paint or blur a shadow; setShouldSmoothFonts and setImageInterpolationQuality only record their value; drawNativeImage rejects non-default orientation and interpolation values; the context-level composite operator and blend mode are not applied because setCompositeOperation is unimplemented; gradient and pattern pointers are not reference counted because Gradient and Pattern are unimplemented; the GraphicsContextImpl factory constructor remains throwing.

New files: include/GraphicsContextExports.hpp, src/GraphicsContextAbi.hpp, src/GraphicsContext.cpp, tests/GraphicsContext.cpp, libcairo/include/Bridge.hpp, libcairo/Bridge.cpp. The debt fragment adds the Functional entry and removes the four inventory rows.

Overlap: the libcairo _nid_no_patch bridge files are also added by the independent #24965; both copies are identical, so whichever merges first, the other rebases without a semantic conflict.

Tested

Windows 11, MinGW-w64 GCC 16.2, Release:

  • nkwebkit_graphicscontext passes. It draws into a cairo image surface and checks pixels for fillRect, explicit-color fills, clearRect, save/restore with translation and scaling, clipping, fillPath, strokePath, strokeRect, drawNativeImage with the default and DestinationOver/XOR operators, drawNativeImage with Multiply and a rejected unknown blend mode, single and double text underlines, 50% global alpha on both fillRect overloads compared against a direct cairo fill of the same alpha, a half-transparent underline, getCTM, the platform-context queries, a null platform context, shadow state and the default GraphicsContextState values.
  • The full NKWebKit suite passes (290/290).
  • public_headers, all 65 public_headers_compile_* tests and patched_libraries pass.
  • tools/check_conventions.py --base origin/main passes. tools/debt_fold.py --check passes for this fragment; the repository's unrelated feat-libwebrtc-rnn-vad.md fragment fails on its own, so it was moved aside for the check.
  • Not compared with a console module.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5428692610 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980). Originally posted by [momgaroganuchi-crypto](https://github.com/momgaroganuchi-crypto) on 2026-11-21T14:07:29Z. --- ### What Implements 33 `libSceNKWebKit` exports that throw on `main` today: the cairo immediate-mode `WebCore::GraphicsContext` core and the `WebCore::GraphicsContextState` lifecycle. `GraphicsContext(PlatformContextCairo*)` wraps the cairo context at `PlatformContextCairo` +0. Implemented operations are construction and destruction, `save`, `restore`, `translate`, `scale`, `applyDeviceScaleFactor`, `clip`, `fillRect` (state color and explicit color), `clearRect`, `fillPath`, `strokePath`, `strokeRect`, `drawNativeImage`, the fill/stroke color and stroke thickness setters, `setShouldAntialias`, `setShouldSmoothFonts`, `setImageInterpolationQuality`, `setShadow`, `clearShadow`, `drawLineForText`, `hasPlatformContext`, `platformContext` and `getCTM`, plus `GraphicsContextState` construction and destruction. `fillPath`/`strokePath` read the `Path` cairo context at +0, so they work with the Path implementation from #24965 without depending on it. `drawNativeImage` scales the source rectangle onto the destination with the cairo CTM and `cairo_set_source_surface`; it supports every blend mode, the default orientation and default interpolation quality, and throws for other orientations and interpolation qualities. Its per-draw `ImagePaintingOptions` blend mode maps to the cairo operator, with `PlusDarker` and `PlusLighter` falling back to `OVER` as WebKit's cairo backend does, and the `CompositeOperator` values map from WebCore to cairo: `DestinationOver` through `DestinationAtop` shift by one because cairo reserves operator 6 for `DEST`, `XOR` maps to 11, `PlusDarker` to `DARKEN`, `PlusLighter` to `ADD` and `Difference` to `DIFFERENCE`. The context-level `compositeOperator` and `blendMode` are stored in the state but not applied to fills and strokes, because `setCompositeOperation` is unimplemented here; global `alpha` multiplies the source alpha of `fillRect`, `fillPath`, `strokePath`, `strokeRect` and the `drawLineForText` underlines. Layouts: `GraphicsContextState` is the 96-byte 2020 source layout and `GraphicsContext` is 144 bytes; both are asserted in `src/GraphicsContextAbi.hpp`. `GraphicsContext` keeps a host state stack in its private object and mirrors the cairo save/restore stack. The 33 exports are declared once in `include/GraphicsContextExports.hpp`; the duplicate placeholders are removed from `include/LegacyExports.hpp`, `include/InventoryExports.hpp` and `src/GraphicsContextAbi.hpp`. Cairo calls go through the internal `_nid_no_patch` helpers in `libcairo/include/Bridge.hpp` and `libcairo/Bridge.cpp`, the same mechanism as the existing `CairoSurfaceDestroy_nid_no_patch`, because the NID patcher rewrites libcairo exports but leaves non-SCE imports of a system library unchanged. Known gaps, recorded in the debt fragment: `setShadow` records the offset, blur and color but cairo drawing does not paint or blur a shadow; `setShouldSmoothFonts` and `setImageInterpolationQuality` only record their value; `drawNativeImage` rejects non-default orientation and interpolation values; the context-level composite operator and blend mode are not applied because `setCompositeOperation` is unimplemented; gradient and pattern pointers are not reference counted because `Gradient` and `Pattern` are unimplemented; the `GraphicsContextImpl` factory constructor remains throwing. New files: `include/GraphicsContextExports.hpp`, `src/GraphicsContextAbi.hpp`, `src/GraphicsContext.cpp`, `tests/GraphicsContext.cpp`, `libcairo/include/Bridge.hpp`, `libcairo/Bridge.cpp`. The debt fragment adds the Functional entry and removes the four inventory rows. Overlap: the libcairo `_nid_no_patch` bridge files are also added by the independent #24965; both copies are identical, so whichever merges first, the other rebases without a semantic conflict. ### Tested Windows 11, MinGW-w64 GCC 16.2, Release: - `nkwebkit_graphicscontext` passes. It draws into a cairo image surface and checks pixels for `fillRect`, explicit-color fills, `clearRect`, save/restore with translation and scaling, clipping, `fillPath`, `strokePath`, `strokeRect`, `drawNativeImage` with the default and `DestinationOver`/`XOR` operators, `drawNativeImage` with `Multiply` and a rejected unknown blend mode, single and double text underlines, 50% global alpha on both `fillRect` overloads compared against a direct cairo fill of the same alpha, a half-transparent underline, `getCTM`, the platform-context queries, a null platform context, shadow state and the default `GraphicsContextState` values. - The full NKWebKit suite passes (290/290). - `public_headers`, all 65 `public_headers_compile_*` tests and `patched_libraries` pass. - `tools/check_conventions.py --base origin/main` passes. `tools/debt_fold.py --check` passes for this fragment; the repository's unrelated `feat-libwebrtc-rnn-vad.md` fragment fails on its own, so it was moved aside for the check. - Not compared with a console module. ### Checklist - [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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-21 15:01:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T15:01:08Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 34560c3411:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_graphicscontext_tests built cleanly.
  • CTest (nkwebkit_graphicscontext):
    1/1 Test #4818: nkwebkit_graphicscontext .........   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4818: nkwebkit_graphicscontext .........***Failed    0.02 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/GraphicsContextAbi.hpp: verified standard-layout assertions, alignments, member offsets, and size constraints (State: 96 bytes, Context: 144 bytes, PlatformContext: 8 bytes, ImagePaintingOptions: 12 bytes) against WebKit 2020 layout.
    • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: checked null-pointer validations on self, platform, rect, color, scale, and path parameters across all exported functions, ensuring std::invalid_argument is thrown where required.
    • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified color unpacking, OutOfLineFlag handling, and RGBA conversion math in SetSource for fillRect, fillPath, strokePath, and strokeRect.
    • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified cairo_save/cairo_restore nesting and stack state mirroring across GraphicsContext lifecycle, save(), restore(), clearRect(), and drawNativeImage().
    • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified getCTM affine transform extraction from cairo_matrix_t (xx, yx, xy, yy, x0, y0) into WebCore::AffineTransform.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:137: CairoOperator directly returns compositeOperator for values <= 10. In WebCore, WebCore::CompositeOperator values 6 through 10 correspond to DestinationOver (6), DestinationIn (7), DestinationOut (8), DestinationAtop (9), and XOR (10). In libcairo, value 6 is CAIRO_OPERATOR_DEST (which retains destination and discards the source surface), while CAIRO_OPERATOR_DEST_OVER is 7, CAIRO_OPERATOR_DEST_IN is 8, CAIRO_OPERATOR_DEST_OUT is 9, CAIRO_OPERATOR_DEST_ATOP is 10, and CAIRO_OPERATOR_XOR is 11. When drawNativeImage is invoked with ImagePaintingOptions::compositeOperator = 6 (CompositeOperator::DestinationOver), cairo_set_operator receives CAIRO_OPERATOR_DEST (6), discarding the native image instead of compositing it under the destination. Additionally, all operators 6-10 are off-by-one and CAIRO_OPERATOR_XOR (11) is unreachable.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6006157879 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6006157879). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T15:01:08Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `34560c3411`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_graphicscontext_tests` built cleanly. - **CTest** (`nkwebkit_graphicscontext`): ``` 1/1 Test #4818: nkwebkit_graphicscontext ......... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4818: nkwebkit_graphicscontext .........***Failed 0.02 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/GraphicsContextAbi.hpp: verified standard-layout assertions, alignments, member offsets, and size constraints (State: 96 bytes, Context: 144 bytes, PlatformContext: 8 bytes, ImagePaintingOptions: 12 bytes) against WebKit 2020 layout. - core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: checked null-pointer validations on self, platform, rect, color, scale, and path parameters across all exported functions, ensuring std::invalid_argument is thrown where required. - core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified color unpacking, OutOfLineFlag handling, and RGBA conversion math in SetSource for fillRect, fillPath, strokePath, and strokeRect. - core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified cairo_save/cairo_restore nesting and stack state mirroring across GraphicsContext lifecycle, save(), restore(), clearRect(), and drawNativeImage(). - core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp: verified getCTM affine transform extraction from cairo_matrix_t (xx, yx, xy, yy, x0, y0) into WebCore::AffineTransform. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:137: CairoOperator directly returns compositeOperator for values <= 10. In WebCore, WebCore::CompositeOperator values 6 through 10 correspond to DestinationOver (6), DestinationIn (7), DestinationOut (8), DestinationAtop (9), and XOR (10). In libcairo, value 6 is CAIRO_OPERATOR_DEST (which retains destination and discards the source surface), while CAIRO_OPERATOR_DEST_OVER is 7, CAIRO_OPERATOR_DEST_IN is 8, CAIRO_OPERATOR_DEST_OUT is 9, CAIRO_OPERATOR_DEST_ATOP is 10, and CAIRO_OPERATOR_XOR is 11. When drawNativeImage is invoked with ImagePaintingOptions::compositeOperator = 6 (CompositeOperator::DestinationOver), cairo_set_operator receives CAIRO_OPERATOR_DEST (6), discarding the native image instead of compositing it under the destination. Additionally, all operators 6-10 are off-by-one and CAIRO_OPERATOR_XOR (11) is unreachable. Requesting changes for the points above.
PrivacyOnion commented 2026-11-21 16:33:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T16:33:23Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 173385b1d7:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_graphicscontext_tests built cleanly.
  • CTest (nkwebkit_graphicscontext):
    1/1 Test #4821: nkwebkit_graphicscontext .........   Passed    0.03 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp, core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp, core/libs/prx/libcairo/Bridge.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #4821: nkwebkit_graphicscontext .........***Failed    0.02 sec
    0% tests passed, 1 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified CairoOperator mapping in core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp correctly remaps WebCore::CompositeOperator 6-10 to libcairo CAIRO_OPERATOR_DEST_OVER (7) through CAIRO_OPERATOR_XOR (11), fixing the previous off-by-one destination operator defect.
    • Verified ABI layout, size (State 96 bytes, Context 144 bytes, ImagePaintingOptions 12 bytes), and member offsets in core/libs/prx/libSceNKWebKit/src/GraphicsContextAbi.hpp against WebKit 2020 specifications via static assertions.
    • Verified null pointer validations in Checked() and drawing entry points (Checked, SetSource, AppendPath, setShadow) throwing std::invalid_argument on null context, path, offset, or color pointers.
    • Verified color bit unpacking, OutOfLineFlag detection, and normalized RGBA channel mapping in SetSource without integer overflow or signedness issues.
    • Verified cairo_save and cairo_restore stack mirroring in GraphicsContextPrivate correctly tracks GraphicsContextState lifecycle and cleans up host state on destruction.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6006593364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6006593364). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T16:33:23Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `173385b1d7`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_graphicscontext_tests` built cleanly. - **CTest** (`nkwebkit_graphicscontext`): ``` 1/1 Test #4821: nkwebkit_graphicscontext ......... Passed 0.03 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp`, `core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp`, `core/libs/prx/libcairo/Bridge.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/1 Test #4821: nkwebkit_graphicscontext .........***Failed 0.02 sec 0% tests passed, 1 tests failed out of 1 ``` Restoring the change makes it pass again. - **Code reading**: - Verified CairoOperator mapping in core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp correctly remaps WebCore::CompositeOperator 6-10 to libcairo CAIRO_OPERATOR_DEST_OVER (7) through CAIRO_OPERATOR_XOR (11), fixing the previous off-by-one destination operator defect. - Verified ABI layout, size (State 96 bytes, Context 144 bytes, ImagePaintingOptions 12 bytes), and member offsets in core/libs/prx/libSceNKWebKit/src/GraphicsContextAbi.hpp against WebKit 2020 specifications via static assertions. - Verified null pointer validations in Checked() and drawing entry points (Checked, SetSource, AppendPath, setShadow) throwing std::invalid_argument on null context, path, offset, or color pointers. - Verified color bit unpacking, OutOfLineFlag detection, and normalized RGBA channel mapping in SetSource without integer overflow or signedness issues. - Verified cairo_save and cairo_restore stack mirroring in GraphicsContextPrivate correctly tracks GraphicsContextState lifecycle and cleans up host state on destruction. Looks Good To Me
MarcZX10 commented 2026-11-22 22:55:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T22:55:33Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: apply the stored composite operator, blend mode, and global alpha to ordinary drawing operations, or explicitly limit the implementation claims and exports to behavior that is actually supported.

What I ran

  • Reviewed head f53dda487ffae92aae0933839b7adfe20a1ad406 using the prepared diff and repo_read.py source reads.
  • No commands or tests were run by me; test results in the description are author-reported.

Results

Check Result Note
Diff and targeted source review passed GraphicsContext implementation and tests inspected
Programmatic checks not run Description reports Windows and convention checks
Console comparison not run Description says no console module comparison

Findings

Blocking

  • core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:360: normal fillRect calls ApplyOperator, but that helper reads context.state.compositeOperator and blendMode while there is no implementation of the exported setCompositeOperation in the changed source; the new export remains a throwing placeholder in Export.cpp. fillRect also sets the source from the raw color without applying context.state.alpha. As a result, callers cannot set the advertised composite state, and global alpha has no effect on ordinary drawing. Implement the setter and apply global alpha consistently to fills, strokes, and text drawing (or remove those claimed capabilities until implemented).

Non-blocking

  • None.

Not verified

  • The full texts of Export.cpp and include/InventoryExports.hpp were excluded from the review folder; their changed hunks were visible in the prepared diff, but the full files were not read.
  • No tests, build, precheck, or PS5 console validation were run by me. Author-reported results were not independently confirmed.
  • No files were excluded by rule beyond the oversized files noted above; minified, build, distribution, lockfile, and SVG exclusions were not otherwise enumerated in the review bundle.

To get this to a good state

Implement and test composite-operation state updates and global-alpha rendering on a new head; rerun the GraphicsContext test and relevant NKWebKit checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6014970701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6014970701). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T22:55:33Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: apply the stored composite operator, blend mode, and global alpha to ordinary drawing operations, or explicitly limit the implementation claims and exports to behavior that is actually supported. ## What I ran - Reviewed head `f53dda487ffae92aae0933839b7adfe20a1ad406` using the prepared diff and `repo_read.py` source reads. - No commands or tests were run by me; test results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | GraphicsContext implementation and tests inspected | | Programmatic checks | not run | Description reports Windows and convention checks | | Console comparison | not run | Description says no console module comparison | ## Findings ### Blocking - `core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:360`: normal `fillRect` calls `ApplyOperator`, but that helper reads `context.state.compositeOperator` and `blendMode` while there is no implementation of the exported `setCompositeOperation` in the changed source; the new export remains a throwing placeholder in `Export.cpp`. `fillRect` also sets the source from the raw color without applying `context.state.alpha`. As a result, callers cannot set the advertised composite state, and global alpha has no effect on ordinary drawing. Implement the setter and apply global alpha consistently to fills, strokes, and text drawing (or remove those claimed capabilities until implemented). ### Non-blocking - None. ## Not verified - The full texts of `Export.cpp` and `include/InventoryExports.hpp` were excluded from the review folder; their changed hunks were visible in the prepared diff, but the full files were not read. - No tests, build, precheck, or PS5 console validation were run by me. Author-reported results were not independently confirmed. - No files were excluded by rule beyond the oversized files noted above; minified, build, distribution, lockfile, and SVG exclusions were not otherwise enumerated in the review bundle. ## To get this to a good state Implement and test composite-operation state updates and global-alpha rendering on a new head; rerun the GraphicsContext test and relevant NKWebKit checks.
MarcZX10 commented 2026-11-23 09:39:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T09:39:28Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the noted limitations are documented and optional.

What I ran

Reviewed head ac668988a854e1bf570191f4731e4da3242697bc. Read the prepared description, commit list, manifest, diff, and relevant changed source, ABI, test, and Cairo bridge files using repo_read.py. No commands or tests were run.

Results

Check Result Note
Source review passed Core implementation and bridge inspected
Tests not run Runs reported in PR description only
Full changed-file review not run Two changed files excluded from prepared folder

Findings

Blocking

None identified in the inspected code.

Non-blocking

None.

Not verified

Export.cpp and include/InventoryExports.hpp were excluded from the prepared files as too large; their relevant hunks appear in the diff, but their full files were not read. Runtime behavior, build results, test results, and console compatibility were not independently verified. The PR description reports Windows tests and says the change was not compared with a console module.

Files read: core/libs/prx/libSceNKWebKit/CMakeLists.txt, Export.cpp diff hunks, include/GraphicsContextExports.hpp, include/LegacyExports.hpp, libSceNKWebKit.hpp, src/GraphicsContext.cpp, src/GraphicsContextAbi.hpp, tests/GraphicsContext.cpp, core/libs/prx/libcairo/Bridge.cpp, core/libs/prx/libcairo/CMakeLists.txt diff hunk, core/libs/prx/libcairo/include/Bridge.hpp, and the debt fragment. Excluded from full-file review: Export.cpp, include/InventoryExports.hpp.

To get this to a good state

Nothing is required. The PR description documents the known limitations, including shadows not being rendered and context-level composite settings not being applied.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6019330359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6019330359). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T09:39:28Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the noted limitations are documented and optional. ## What I ran Reviewed head `ac668988a854e1bf570191f4731e4da3242697bc`. Read the prepared description, commit list, manifest, diff, and relevant changed source, ABI, test, and Cairo bridge files using `repo_read.py`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Core implementation and bridge inspected | | Tests | not run | Runs reported in PR description only | | Full changed-file review | not run | Two changed files excluded from prepared folder | ## Findings ### Blocking None identified in the inspected code. ### Non-blocking None. ## Not verified `Export.cpp` and `include/InventoryExports.hpp` were excluded from the prepared files as too large; their relevant hunks appear in the diff, but their full files were not read. Runtime behavior, build results, test results, and console compatibility were not independently verified. The PR description reports Windows tests and says the change was not compared with a console module. Files read: `core/libs/prx/libSceNKWebKit/CMakeLists.txt`, `Export.cpp` diff hunks, `include/GraphicsContextExports.hpp`, `include/LegacyExports.hpp`, `libSceNKWebKit.hpp`, `src/GraphicsContext.cpp`, `src/GraphicsContextAbi.hpp`, `tests/GraphicsContext.cpp`, `core/libs/prx/libcairo/Bridge.cpp`, `core/libs/prx/libcairo/CMakeLists.txt` diff hunk, `core/libs/prx/libcairo/include/Bridge.hpp`, and the debt fragment. Excluded from full-file review: `Export.cpp`, `include/InventoryExports.hpp`. ## To get this to a good state Nothing is required. The PR description documents the known limitations, including shadows not being rendered and context-level composite settings not being applied.
MarcZX10 commented 2026-11-25 11:48:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:48:03Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 67bf855a6f56e688530d33068c450d59527dfc46 using the prepared diff and repo_read.py. No tests were run in this review; test results in the PR description are author-reported.

Results

Check Result Note
Diff and targeted source review passed Changed implementation and related declarations inspected
Automated tests not run No test command executed
PS5 behavior not run No console comparison available

Findings

Blocking

None.

Non-blocking

  • getCTM ignores the IncludeDeviceScale argument and always returns the raw Cairo matrix (core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:507). If callers request device scale, the result will not reflect that request.
  • drawNativeImage accepts the image size parameter but does not use it when mapping the source rectangle (core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:416). Confirm that the intended contract is to rely solely on the supplied source rectangle, or use the size to validate or constrain the source region.

Not verified

No tests or console behavior were run or independently confirmed. Export.cpp was read only at its changed tail additions. Full contents were read for the other changed source files and declarations except tests/GraphicsContext.cpp, of which only lines 1–110 were read. Excluded by the review bundle: Export.cpp full text (too large); the diff also omits lockfiles, minified files, dist/, build/, and .svg files by preparation rule. Author-reported test results were not independently verified.

To get this to a good state

Nothing is required. Optional: honor IncludeDeviceScale in getCTM and clarify or use the drawNativeImage image size parameter.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6057036950 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6057036950). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T11:48:03Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this; the points below are optional. ## What I ran Reviewed head `67bf855a6f56e688530d33068c450d59527dfc46` using the prepared diff and `repo_read.py`. No tests were run in this review; test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Changed implementation and related declarations inspected | | Automated tests | not run | No test command executed | | PS5 behavior | not run | No console comparison available | ## Findings ### Blocking None. ### Non-blocking - `getCTM` ignores the `IncludeDeviceScale` argument and always returns the raw Cairo matrix (`core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:507`). If callers request device scale, the result will not reflect that request. - `drawNativeImage` accepts the image size parameter but does not use it when mapping the source rectangle (`core/libs/prx/libSceNKWebKit/src/GraphicsContext.cpp:416`). Confirm that the intended contract is to rely solely on the supplied source rectangle, or use the size to validate or constrain the source region. ## Not verified No tests or console behavior were run or independently confirmed. `Export.cpp` was read only at its changed tail additions. Full contents were read for the other changed source files and declarations except `tests/GraphicsContext.cpp`, of which only lines 1–110 were read. Excluded by the review bundle: `Export.cpp` full text (too large); the diff also omits lockfiles, minified files, `dist/`, `build/`, and `.svg` files by preparation rule. Author-reported test results were not independently verified. ## To get this to a good state Nothing is required. Optional: honor `IncludeDeviceScale` in `getCTM` and clarify or use the `drawNativeImage` image size parameter.
ligmaSec commented 2026-12-03 19:48:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:48:57Z.

Review: COMMENTED


drawNativeImage calls CairoSave before mapping the composite operator and blend mode. CairoOperator can throw for unsupported values, which skips the matching restore. A caller that catches the exception inherits an extra Cairo state frame, and the next public restore can pop that frame while popping the preceding WebCore state. Please validate the operator before saving or scope the Cairo restore to the operation.

Source review at 67bf855a6f. A trial merge onto 484e8e6b77 conflicts in Export.cpp and LegacyExports.hpp.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6177271285 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24980#pullrequestreview-6177271285). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T19:48:57Z. **Review:** COMMENTED --- `drawNativeImage` calls `CairoSave` before mapping the composite operator and blend mode. `CairoOperator` can throw for unsupported values, which skips the matching restore. A caller that catches the exception inherits an extra Cairo state frame, and the next public `restore` can pop that frame while popping the preceding WebCore state. Please validate the operator before saving or scope the Cairo restore to the operation. Source review at `67bf855a6f`. A trial merge onto `484e8e6b77` conflicts in `Export.cpp` and `LegacyExports.hpp`. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/24980:upstream-pr/24980'
git switch 'upstream-pr/24980'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/24980'
git switch 'upstream-pr/24980'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/24980'
git switch 'upstream-pr/24980'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/24980'
git switch 'main'
git merge --squash 'upstream-pr/24980'
git switch 'main'
git merge --ff-only 'upstream-pr/24980'
git switch 'main'
git merge 'upstream-pr/24980'
git push origin 'main'
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!24980
No description provided.