Searches the atlas for a slot that can fit a coverage mask for a clipped shape with the given bounds in device coordinates and submits the mask to be drawn into the found atlas region. For atlases that cache coverage masks, will first search the cache before adding.
Returns an empty result if a the shape cannot fit in the atlas. Otherwise, returns the CoverageMaskShape (including the texture proxy) for sampling the eventually-rendered coverage mask and the device-space origin the mask should be drawn at (e.g. its recorded draw should be an integer translation matrix), and the Renderer that should be used to draw that shape. The Renderer should have single-channel coverage, require AA bounds outsetting, and have a single renderStep.
The bounds of the atlas entry is laid out with a 1 pixel outset from the given dimensions. The returned shape's UV origin accounts for the padding, and its mask size does not include the padding. This allows the mask to be sampled safely with linear filtering without worrying about HW filtering accessing pixels from other entries.
shape
will be drawn after applying the linear components (scale, rotation, skew) of the provided localToDevice
transform. This is done by translating the shape by the inverse of the rounded out transformedShapeBounds
offset. For an unclipped shape this amounts to translating it back to its origin while preserving any sub-pixel translation. For a clipped shape, this ensures that the visible portions of the mask are centered in the atlas slot while invisible portions that would lie outside the atlas slot get clipped out.
addShape()
schedules the shape to be drawn but when and how the rendering happens is specified by the subclass implementation.
The stroke-and-fill style is drawn as a single combined coverage mask containing the stroke and the fill.
Definition at line 38 of file PathAtlas.cpp.
42 {
43
44
45
46
47
48 const bool emptyMask = transformedShapeBounds.isEmptyNegativeOrNaN();
49
50
51
52 Rect maskBounds = transformedShapeBounds.makeRoundOut();
53
54 CoverageMaskShape::MaskInfo maskInfo;
55
56
59 const TextureProxy* atlasProxy = this->
onAddShape(shape,
60 atlasTransform,
61 style,
62 maskInfo.fMaskSize,
63 &maskInfo.fTextureOrigin);
64 if (!atlasProxy) {
65 return std::make_pair(nullptr, std::nullopt);
66 }
67
68 std::optional<PathAtlas::MaskAndOrigin> atlasMask =
69 std::make_pair(CoverageMaskShape(shape, atlasProxy, localToDevice.inverse(), maskInfo),
70 SkIPoint{(int) maskBounds.left(), (int) maskBounds.top()});
72}
virtual const TextureProxy * onAddShape(const Shape &, const Transform &transform, const SkStrokeRec &, skvx::half2 maskSize, skvx::half2 *outPos)=0
const RendererProvider * rendererProvider() const
const Renderer * coverageMask() const
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
skgpu::graphite::Transform Transform