Performance in C#

80 views
Skip to first unread message

Daniel Benčík

unread,
Jul 2, 2022, 5:14:54 AM7/2/22
to skia-discuss
Hello, 

I am new to Skia so apologies if Im asking trivial stuff. I googled but didnt find my answers. 

I am running on Win11, C# compiled as x64, GTX 3060 card. 

1/ Drawing with a nonantialiased pen seems approx 3x slower than drawing with an antialiased pen - is this expected? With GDI, its the opposite, so it seems counterintuitive.

2/ My app uses SkglControl onto which is draws a million circles using a SKPicture. A simplified code is something like 

            var clippingBounds = skglControl1.ClientRectangle.ToSKRect();
            using (var recorder = new SKPictureRecorder())
            {
                recorder.BeginRecording(clippingBounds);

                SKCanvas canvas = recorder.RecordingCanvas;

                while (idx < count)
                {
                    canvas.DrawCircle((float)rand.Next(max_x_), (float)rand.Next(max_y_), 3.0f, paint);
                    idx++;
                }
            }

            m_Picture = recorder.EndRecording();
            e.Surface.Canvas.DrawPicture(m_Picture);
            Debug.WriteLine("finished");

At application start, the skglControl is white, when I run the code there is a delay of a couple of seconds between seeing 'finished' in the Immediate window and seeing the drawn circles in the skglControl. Is there a way for me to make this delay disappear, i.e. to make drawing faster?

Thank you, 
Daniel

Reply all
Reply to author
Forward
0 new messages