Skip to content

[BUG / QUESTION] DrawBitmap with SKFilterQuality.High causes bad performance #756

Open
@nor0x

Description

@nor0x

Description

I'm drawing several SKBitmaps on a SKGLView on macOS, I'm using SKFilterQuality.High to get the best quality of the images. If the canvas is zoomed in and only one image is visible the performance is okay, but once I zoom out and multiple SKBitmaps are visible performance and rendering speed drops. Some of the images are quite big (i.e. 4000*300px) - so I wanted to check if the performance drop is caused by my code or if Skia(Sharp)s performance is limited in this case (even on the GPU)

Code
This is my PaintSurface method - repro link contains my full source

void CanvasView_PaintSurface(object sender, SkiaSharp.Views.Mac.SKPaintGLSurfaceEventArgs e)
{
    e.Surface.Canvas.Clear(SKColors.Black);
    e.Surface.Canvas.SetMatrix(_m);

    for(int i = 0; i < imgs.Count; i++)
    {
        e.Surface.Canvas.DrawBitmap(imgs.ElementAt(i), rects.ElementAt(i), HighQualityImagePaint);
    }
}

Expected Behavior
Since drawing is happening on the GPU (SKGLView) i expect smooth rendering and good performance.

Actual Behavior
Framerate drops and panning / zooming feels really slow

Basic Information

  • Version with issue: 1.60.3
  • IDE: <!-- Visual Studio for Mac 7.7.2 (Build 21)
  • Platform Target Frameworks: Xamarin.Mac
    • macOS: 10.14.2 (18C54)
  • Target Devices: Macbook Pro 13" (2018 Touchbar)

Screenshots

test

Reproduction Link

https://github.com/nor0x/SkiaSharp_PerfomanceExperiments

VS bug #770230

Metadata

Metadata

Assignees

Type

No type

Projects

Status

New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions