initDrawingLayers method
Future<void>
initDrawingLayers(
- RenderInfoCollection renderInfoCollection
)
Implementation
Future<void> initDrawingLayers(RenderInfoCollection renderInfoCollection) async {
var session = PerformanceProfiler().startSession(category: "PainterFactory.initDrawingLayers");
List<Future> futures = [];
for (RenderInfo renderInfo in renderInfoCollection.renderInfos) {
// Synchronous fast path: the render info already carries its painter or
// the painter is already cached. Only render instructions that really need
// async creation (e.g. bitmap / icon loading) go into the futures list.
if (_applyCachedPainter(renderInfo)) continue;
futures.add(getOrCreateShapePainter(renderInfo));
if (futures.length > 200) {
await Future.wait(futures);
futures.clear();
}
}
await Future.wait(futures);
session.complete();
}