You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pan and Pinch gestures bad performance in Forms UWP #274
Hi!
I tested Pich and Pan gestures from sample project in Forms/UWP app and it's slow. When dragging image from BitmapScale sample it doesn't move smoothly, especially when drag distance is large. In OpenGL backed gestures don't work at all. Tested on Lumia 950 (not XL), SkiaSharp 1.56-2 (latest from nuget, I had to downgrade from 1.57 used in sample project).
My setup is a charting control that draws in PaintSurface handler. I implemented panning and pinch to zoom that update actual drawing parameters in PaintSurface handler. My first resuts yielded normal-ish performance for panning, and variable, slow performance while zooming (slow framerates, only refreshed while slowly pinching). Turns out, calling Debug.WriteLine in PinchUpdated handler is a bad idea - the handler should be as short as possible because it takes priority over PaintSurface.
@mgierlasinski you may have better results if you separate bitmap drawing out of the gesture event handlers.
I had a look at this, and the reason is that the OpenGL for UWP is not quite perfect yet when it comes to the view.
I need to go back and investigate the correct (or better) way to get the scaling correct. Currently, to preserve the quality of high density screens, I am rendering the large framebuffer. However, there is some disconnect with the framebuffer and the view, so I am having to scale the view down using a ScaleTransform:
As a result of the scaling, the actual view is (on my Lumia 950 XL) only a third of the total visible view. Thus, it gives the impression that the gestures aren't working at all, but in fact they do work, but only in the top left third of the screen.
This way of rendering should now be fixed. And, we are not really supporting UWP anymore, WinUI is the way to go. That has a totally new implementation, so I am going to close this for now.
Activity
bugadani commentedon Apr 10, 2017
I've run into this today.
My setup is a charting control that draws in PaintSurface handler. I implemented panning and pinch to zoom that update actual drawing parameters in PaintSurface handler. My first resuts yielded normal-ish performance for panning, and variable, slow performance while zooming (slow framerates, only refreshed while slowly pinching). Turns out, calling Debug.WriteLine in PinchUpdated handler is a bad idea - the handler should be as short as possible because it takes priority over PaintSurface.
@mgierlasinski you may have better results if you separate bitmap drawing out of the gesture event handlers.
mattleibow commentedon Aug 29, 2017
I had a look at this, and the reason is that the OpenGL for UWP is not quite perfect yet when it comes to the view.
I need to go back and investigate the correct (or better) way to get the scaling correct. Currently, to preserve the quality of high density screens, I am rendering the large framebuffer. However, there is some disconnect with the framebuffer and the view, so I am having to scale the view down using a
ScaleTransform:https://github.com/mono/SkiaSharp/blob/master/source/SkiaSharp.Views/SkiaSharp.Views.UWP/SKSwapChainPanel.cs#L46-L50
As a result of the scaling, the actual view is (on my Lumia 950 XL) only a third of the total visible view. Thus, it gives the impression that the gestures aren't working at all, but in fact they do work, but only in the top left third of the screen.
jross100 commentedon Jan 9, 2018
Hi @mattleibow
I've run into this bug too with touch events and the SKGLView.
I think this could be solved by setting the scale when creating the surface. See here for info:
microsoft/angle#29 (comment)
It looks like the information that Dmitry wrote might be relevant as well:
https://developernote.com/2015/11/combining-opengl-and-xaml-together-in-a-windows-store-app-uwp/
mattleibow commentedon Oct 30, 2024
This way of rendering should now be fixed. And, we are not really supporting UWP anymore, WinUI is the way to go. That has a totally new implementation, so I am going to close this for now.
For any similar issues, please open a new issue.
[skia-sync] Update Skia to milestone m151 (4.151.0) (#4294)
Auto-apply milestone labels to the mono/skia sync PR too (#4329)