Skip to content

feat(skia): Expose frame data on Rendering event - #23762

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:feat/rendering-event-frame-picture
Jul 15, 2026
Merged

ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:feat/rendering-event-frame-picture

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: https://github.com/unoplatform/kahua-private/issues/505

PR Type:

What changed? 🚀

PR Checklist ✅

Copilot AI review requested due to automatic review settings July 14, 2026 16:38
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Skia render pipeline so CompositionTarget.Rendering can carry opaque per-frame data (currently the recorded Skia picture) through RenderingEventArgs, enabling advanced scenarios that need access to frame artifacts.

Changes:

  • Added RenderingEventArgs.FrameData and internal tracking to detect whether frame data was accessed.
  • Refactored Skia rendering to use SKPicture/SKPictureRecorder.EndRecording() instead of raw IntPtr, introducing FramePicture to manage picture lifetime.
  • Updated SkiaRenderHelper to record/render using managed SKPicture APIs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Uno.UI/UI/Xaml/Media/RenderingEventArgs.cs Adds FrameData to carry opaque per-frame payload and tracks whether it was accessed.
src/Uno.UI/UI/Xaml/Media/CompositionTarget.Rendering.skia.cs Passes the recorded frame picture into Rendering args and adds FramePicture lifetime management around event dispatch.
src/Uno.UI/Helpers/SkiaRenderHelper.skia.cs Switches recording/rendering helpers from raw pointers to SKPicture managed APIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Each CompositionTarget's latest recorded picture is kept in a static
cache; Rendering is raised once per coalesced batch of recordings, on
the UI thread, with the latest picture of every live window — targets
that haven't re-rendered since the last raise (e.g. a window
minimized on hosts that stop servicing invalidations, like macOS)
have their previous picture resent.

RenderingEventArgs.FrameData exposes the batch as a list of
(Window, object) pairs, with each entry's data castable to a
SkiaSharp.SKPicture on Skia targets. The frame pipeline holds managed
SKPictures instead of raw native handles; a picture is disposed
deterministically once the pipeline and the cache release it, unless
a subscriber read FrameData, in which case user code may hold it and
the GC reclaims it instead.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 14, 2026 18:20
@ramezgerges
ramezgerges force-pushed the feat/rendering-event-frame-picture branch from 45afe85 to 617bba5 Compare July 14, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222370 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ImageIconPage.png-dark
    • DisplayInformation.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • ButtonClippingTestsControl.png-dark
    • Examples.png-dark
    • Examples.png
    • ListViewHeaderUpdate.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
  • skia-windows-screenshots: 2348 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBar_KeyBoard.png-dark
    • AppWindowTitleBar Properties.png-dark
    • AuthenticationBroker_Demo.png-dark
    • AutoSizedPathCentered.png
    • BadgeNotificationTests.png-dark
    • Basics_Automated.png
    • BenchmarkDotNet.png
    • BitmapImage_vs_SvgImageSource.png
    • BorderVersusPanelClipping.png-dark
    • BorderVersusPanelClipping.png
    • Border_CornerRadius_Clipping.png-dark
    • Border_CornerRadius_Clipping.png
    • Border_Simple.png
    • Border_Simple_No_Background.png-dark
    • Border_With_ScaleTransform.png-dark
    • Border_With_ScaleTransform.png
    • Button_Opacity_Automated.png-dark
    • Button_Opacity_Automated.png
    • CenteredGridinGridwithtwofixedsizechildren.png-dark
    • CenteredGridinGridwithtwofixedsizechildren.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation

@ramezgerges
ramezgerges merged commit 6aabf91 into unoplatform:master Jul 15, 2026
48 checks passed
@ramezgerges
ramezgerges deleted the feat/rendering-event-frame-picture branch July 15, 2026 13:54
ramezgerges added a commit to ramezgerges/uno that referenced this pull request Sep 23, 2026
RenderingEventArgs.FrameData kept its shape through the port but nothing
ever filled it in, so the API that unoplatform#23762/unoplatform#23815 added was always null and
its consumers got nothing. The frame is an opaque IRenderRecord now, so
the backend says what it can expose: Skia hands out the SKPicture it
recorded, and a backend with no meaningful equivalent hands out null.

SkiaSharp has no public way to wrap an existing handle, so the managed
picture has to be the one EndRecording produced -- and that costs a
wrapper per recording. It is therefore opt-in through
RenderRecordingOptions.CaptureFrameData, which is set only while a
Rendering subscriber is attached; nothing else pays for it.

Frames handed to subscribers outlive the pipeline, so ownership goes
through FrameHold: the record is disposed once the pipeline is done and
no in-flight raise still holds it, unless a subscriber actually read
FrameData, in which case app code may keep it and the GC reclaims it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants