Hello all,
Sorry for this long post/question.
I am working on a WPF application (for making maps for games and worldbuilding) that can potentially work with large bitmaps (3840x2160 or more). The maps consist of 20+ layers, each with a backing bitmap and canvas that get composited to a final canvas/bitmap for display on the screen in a control that handles zooming and panning (so I don't have to mess with the math for that). It works well for the most part, but some of the components of the map (landforms) get drawn by the user in real time by building a Skia path from circles added to the path as the user moves the mouse. Obviously, a whole lot of data is getting moved and there's a lot of number crunching to compute perimeters of paths, etc., especially for large maps. Up to about 2K resolution, it works pretty well. Above that, it bogs down and becomes basically unusable.
From the reading I've done, it appears that a Windows WPF application will "automatically" render on the GPU when it can, but it appears to me that my application either isn't using the GPU, or (probably more likely) it is having to move a lot of data between the CPU and GPU, so there isn't any performance benefit.
So, I have 2 questions:
1) In a WPF application, do I have to do anything to get Skia to render on the GPU, like set up an OpenGL context, etc., or will Skia just use the GPU because the WPF app does?
2) If I do have to set up an OpenGL context, it seems like I would have to set up an OpenGL context and surface and derive a canvas from the surface for each layer. Is that correct?
I'm hoping to improve the performance of the application so that users can draw smoothly with the mouse even on 4K or larger maps with a lot of layers. Any architecture/implementation advice on how to achieve that would be super appreciated!
Thanks.