blob: f1248d90c3eab47ef975c7720301cb3173387122 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
This is code for using the Skia library as a drawing library in VCL backends.
See external/skia for info on the library itself.
Environment variables:
======================
See README.vars in the toplevel vcl/ directory. Note that many backends do not
use Skia. E.g. on Linux it is necessary to also use SAL_USE_VCLPLUGIN=gen .
There are also GUI options for controlling whether Skia is enabled.
Skia drawing methods:
=====================
Skia supports several methods to draw:
- Raster - CPU-based drawing (here primarily used for debugging)
- Vulkan - Vulkan-based GPU drawing, this is the default
There are more (OpenGL, Metal on Mac, etc.), but (as of now) they are not supported by VCL.
GrContext sharing:
==================
We use Skia's sk_app::WindowContext class for creating surfaces for windows, that class
takes care of the internals. But of offscreen drawing, we need an instance of class
GrContext. There is sk_app::WindowContext::getGrContext(), but each instance creates
its own GrContext, and apparently it does not work to mix them. Which means that
for offscreen drawing we would need to know which window (and only that window)
the contents will be eventually painted to, which is not possible (it may not even
be known at the time).
To solve this problem we patch sk_app::WindowContext to create just one GrContext object
and share it between instances. Additionally, using sk_app::WindowContext::SharedGrContext
it is possible to share it also for offscreen drawing, including keeping proper reference
count.
|