build method
RenderSnapshot
build(
- CanvasSceneDocument scene, {
- ContentBoundsSpec? contentBounds,
- TextMeasureCache? textMeasureCache,
Implementation
RenderSnapshot build(
CanvasSceneDocument scene, {
ContentBoundsSpec? contentBounds,
/// Optional: inject a per-batch cache to avoid allocations.
TextMeasureCache? textMeasureCache,
}) {
final services = createServices(textMeasureCache: textMeasureCache);
final computed = computeScene(scene, services);
final ops = buildPaintOpsFromScene(scene, computed);
Rect2D? bounds;
final spec = contentBounds;
if (spec != null) {
bounds = computePaddedContentBounds(
scene: scene,
computed: computed,
policy: spec.policy,
paddingPx: spec.paddingPx,
);
}
return RenderSnapshot(
scene: scene,
computed: computed,
ops: ops,
contentBounds: bounds,
);
}