Skip to content

fix(skia): Bound frame picture recording to frame size - #23815

Merged
ramezgerges merged 1 commit into
unoplatform:masterfrom
ramezgerges:feat/rendering-event-frame-picture
Jul 23, 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:

🐞 Bugfix

What changed? 🚀

Follow-up to #23762. The SKPicture exposed through RenderingEventArgs.FrameData had a near-infinite CullRect, so consumers couldn't size a surface from it. The root frame recording is now bounded to the frame (BeginRecording(new SKRect(0, 0, width, height)) instead of Visual.InfiniteClipRect), making CullRect report the frame bounds in logical pixels.

This only affects the root frame picture, whose consumers are the window present (already clipped to the window) and FrameData readers; RenderTargetBitmap records its own picture, and the per-Visual picture caches keep the infinite cull rect they require. Draw ops entirely outside the frame are now culled at record time — they were never visible in the window.

Validated at runtime on Skia Desktop (Win32): Given_CompositionTarget, Given_RenderTargetBitmap, Given_ItemCollectionTransitionProvider, and Given_AnimatedVisualPlayer runtime tests all pass (11/11).

PR Checklist ✅

🤖 Generated with Claude Code

The frame picture's CullRect now reports the frame bounds in logical
pixels instead of a near-infinite rect, so FrameData consumers can
size surfaces from it. Ops entirely outside the frame get culled at
record time; they were never visible in the window.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 20, 2026 15:42
@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Jul 20, 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 adjusts Skia’s root frame SKPicture recording bounds so that the picture’s CullRect reflects the actual frame size (logical pixels), enabling RenderingEventArgs.FrameData consumers to derive a correctly sized surface from the frame picture.

Changes:

  • Bound the root frame recording via BeginRecording(new SKRect(0, 0, width, height)) instead of Visual.InfiniteClipRect.
  • Documented the behavioral reason (FrameData consumers rely on CullRect being frame-bounded).

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

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 223077 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) 🚨🚨
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ClipboardTests.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png
    • DisplayInformation.png-dark
    • CalendarView_Theming.png-dark
    • ContextRequested.png-dark
    • ContextRequested.png
    • Buttons.png-dark
    • Buttons.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Focus_FocusVisual_Properties.png-dark
    • DropDownButtonPage.png-dark
  • skia-windows-screenshots: 2348 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowPresenters.png
    • AuthenticationBroker_Demo.png
    • AutomationProperties_Name.png-dark
    • BasicAutoSuggestBox.png-dark
    • Battery.png-dark
    • BezierSegment.png-dark
    • BitmapImage_vs_SvgImageSource.png
    • BorderBottomwithmargins.png-dark
    • Border_CornerRadius.png
    • Border_CornerRadius_Alignments.png-dark
    • Border_Simple.png-dark
    • Border_Simple.png
    • Border_With_ScaleTransform.png-dark
    • Border_With_ScaleTransform.png
    • Button_Opacity_Automated.png
    • Button_UseUWPDefaultStyles.png-dark
    • Capture with overlap.png-dark
    • Capture with overlap.png
  • wasm: 11 changed over 1076

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

@ramezgerges

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 223687 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) 🚨🚨
    • Focus_FocusVisual_Properties.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • ImageIconPage.png-dark
    • DisplayInformation.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Buttons.png-dark
  • skia-windows-screenshots: 2348 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarButtonTest.png-dark
    • Accessibility_ScreenReader.png
    • AnimatedIconPage.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowTitleBar Properties.png
    • ApplicationViewSizing.png-dark
    • Arrange_Performance01.png
    • AutoBorderStretchwithbottommargin.png-dark
    • ArcSegment.png
    • AutoBorderStretchwithrightmargin.png
    • AutomationProperties_AutomationId.png
    • AutomationPropertiesExtensions_Role.png-dark
    • AutoSizedTopLeft.png-dark
    • AutoSuggestBox_Icons.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • BackGesture.png-dark
    • Basics_Automated.png
    • BackGesture.png
    • Basics.png
    • BindableDrawerLayout_ChangePane.png-dark
  • wasm: 11 changed over 1076

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

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 223687 has failed on Uno.UI - CI.

@mergify

mergify Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@ramezgerges
ramezgerges merged commit 624a257 into unoplatform:master Jul 23, 2026
66 checks passed
@ramezgerges
ramezgerges deleted the feat/rendering-event-frame-picture branch July 23, 2026 16:44
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