Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/Uno.UI/UI/Xaml/Media/Imaging/RenderTargetBitmap.skia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,6 @@ private static ImageData Open(UnmanagedArrayOfBytes buffer, int bufferLength, in
}
}

/// <summary>
/// Renders synchronously on the UI thread using the software rasterizer. For internal
/// callers that cannot yield to the dispatcher β€” e.g. the drag visual must be captured
/// within the DragStarting sequence so DragEnter/DragOver still fire synchronously right
/// after it, matching WinUI. Must not be called while a RenderAsync is in flight on the
/// same instance.
/// </summary>
internal void RenderSync(UIElement element, int scaledWidth, int scaledHeight)
{
(_bufferSize, PixelWidth, PixelHeight) = PrepareRender(element, new Size(scaledWidth, scaledHeight)) is { } render
? RenderSoftware(element.Visual, render)
: (0, 0, 0);
InvalidateSource();
}

/// <summary>
/// Computes the render dimensions and sizes the pixel buffer accordingly; null when the
/// element has nothing to render.
Expand Down
13 changes: 5 additions & 8 deletions src/Uno.UI/UI/Xaml/UIElement.Pointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,11 @@ private async Task<DataPackageOperation> StartDragAsyncCore(PointerPoint pointer
// so we provide the ActualSize to request the image to be scaled back in logical pixels.

var target = new RenderTargetBitmap();
#if __SKIA__
// RenderAsync completes during a later render pass; the drag visual must instead be
// captured without yielding so DragStarted/DragEnter below still fire synchronously
// within the DragStarting sequence (matching WinUI).
target.RenderSync(this, (int)ActualSize.X, (int)ActualSize.Y);
#else
await target.RenderAsync(this, (int)ActualSize.X, (int)ActualSize.Y);
#endif
// Deliberately not awaited: on Skia the render completes during a later render pass,
// and yielding here would break the synchronous DragStarting β†’ DragStarted β†’
// DragEnter/DragOver sequence (matching WinUI). The drag view redraws itself when
// the bitmap's pixels arrive (InvalidateSource).
Comment thread
ramezgerges marked this conversation as resolved.
_ = target.RenderAsync(this, (int)ActualSize.X, (int)ActualSize.Y);

routedArgs.DragUI.Content = target;
routedArgs.DragUI.Anchor = -ptPosition;
Expand Down
Loading